1) prepare shell script file to ipforward
gedit netshare.sh
2) write next scripts in the netshare.sh
#! /bin/bash
echo "1"> /proc/sys/net/ipv4/ip_forward
iptables -P FORWARD DROP
iptables -A FORWARD -o eth0 -j ACCEPT
iptables -A FORWARD -o eth1 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
ifconfig eth1 192.168.0.1 up
/etc/init.d/networking restart
3) setting to use at the booting
3-1) copy the file to /etc/init.d
cp netshare.sh /etc/init.d/netshare.h
3-2) set permission
chmod +x netshare.sh
3-3) update shell scripts
update-rc.d netshare.sh defaults
댓글 없음:
댓글 쓰기