Debian 下双网卡共享上网设置 ZT

1. 首先在/etc/network/interfaces里加入下面的内容;这里eth0与外网连,eth1与内网连。

auto lo eth0 eth1

iface lo inet loopback

iface eth0 inet dhcp

iface eth1 inet static

address 192.168.0.1

netmask 255.255.255.0

2. echo "1" > /proc/sys/net/ipv4/ip_forward

或修改/etc/sysctl.conf,加上

net.ipv4.ip_forward = 1

3. iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

4. /etc/init.d/inetd restart 或者重新启动计算机。双网卡就可以用了