设置Linux router

作者: Inwind 2008-04-23 00:38:49
如果Linux机器上有两块网卡,eth0(外部网)和eth1(内部局域网),可以如下设置让内部局域网的机器通过这台电脑连接外部网络:

iptables -t nat --flush
iptables -t nat --delete-chain
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables --insert FORWARD -i eth1 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward

相关资讯