eth0为内网,eth1为外网 【程序编程相关:Linux命令-改变文件或目录的访问权限】
【推荐阅读:转自《读者文摘》杂志的几句话】echo 1 > /proc/sys/net/ipv4/ip_forward 【扩展信息:BASH脚本编写教程】 可以使其局域网上网的简单命令 1.iptables -t nat -a postrouting -j masquerade 2.iptables -t nat -a postrouting -s 192.168.2.0/24 -j snat --to-source 218.17.*.* 或者 iptables -t nat -a postrouting -s 192.168.0.0/16 -j snat --to-source 218.17.*.* 3.iptables -t nat -a postrouting -s 192.168.2.0/24 -o eth1 -j snat --to-source 218.17.*.* 或者 iptables -t nat -a postrouting -o eth1 -s 192.168.2.0/24 -j snat --to-source 218.17.*.* 4.iptables -t nat -a postrouting -o eth1 -s 192.168.2.0/24 -j masquerade 例如:简单的脚本 1.编写脚本vi /usr/local/sbin/iptables.sh #! /bin/bash # project by lch, 2005-09-02 #initialize modules modprobe ip_nat_ftp modprobe ip_conntrack_ftp ... 下一页