snat on ecth

1,install system with pppoe
install modules=ppp-udeb

2,update
#vi /etc/apt/sources.list
deb http://debian.cn99.com/debian etch main contrib non-free
deb-src http://debian.cn99.com/debian etch main contrib non-free
deb http://debian.cn99.com/debian-security etch/updates main contrib non-free
deb-src http://debian.cn99.com/debian-security etch/updates main contrib non-free

#aptitude update
#aptitude dist-upgrade

3,install pppoeconf
#apt-cdrom add
#aptitude install pppoeconf

4,set up lan
#vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0

#/etc/init.d/networking restart

5,set snat
#vi /etc/sysctl.conf
net.ipv4.ip_forward=1

#vi /etc/ppp/ip-up.d/snat
#!/bin/sh
#
# iptrules
#
LAN_NET="192.168.0.0/24"
LAN_IF="eth0"
DSL_IF="ppp0"
iptables -t nat -A POSTROUTING -o $DSL_IF -j MASQUERADE
iptables -t filter -A FORWARD -i $DSL_IF -o $LAN_IF -m state \
  --state RELATED,ESTABLISHED -j ACCEPT
iptables -t filter -A FORWARD -i $LAN_IF -o $DSL_IF -j ACCEPT

Leave a Reply

Your email address will not be published. Required fields are marked *