Debian双网卡设置

环境:eth0是外网,eth1是内网

1.

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

 

1

2

3

4

5

6

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.

 

1

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

或修改/etc/sysctl.conf,将下面这句的#号去掉

 

1

net.ipv4.ip_forward = 1

 

3.

 

1

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

4.

reboot重新启动计算机。双网卡就可以用了。

你可能感兴趣的:(linux)