比思論壇

標題: 配置LINUX nat [打印本頁]

作者: perl0302    時間: 2011-12-3 07:54
標題: 配置LINUX nat
fedora_0  eth0 192.168.0.2/24       外网

                eth1 192.168.10.10/24   内网

fedora_1  eth1 192.168.10.1/24     内网

fedora_2  eth2 192.168.10.2/24     内网

第一步 配置路由

fedora_0

     netstat -rn

        192.168.0.0      0.0.0.0      255.255.255.0      U  ……  eth0

        192.168.10.0    0.0.0.0      255.255.255.0      U  ……  eth1

         0.0.0.0         192.168.0.1   0.0.0.0                UG …… eth0

fedora_1

     netstat -rn

        192.168.10.0   0.0.0.0     255.255.255.0   U  ……  eth1

        0.0.0.0         192.168.10.10  0.0.0.0 UG …… eth1

fedora_2

      netstat -rn

        192.168.10.1  0.0.0.0  255.255.255.0  U …… eth2

        0.0.0.0   192.168.10.10  0.0.0.0  UG  …… eth2     

   

  第二步,fedora 打开NAT功能

/etc/rc.local 加入

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

iptables -F

iptables -F -t nat

iptables -t nat -A POSTROUTING -s 192.168.10.10 -o eth0 -j SNAT --to 192.168.0.2

iptables -P INPUT ACCEPT

iptalbes -P OUTPUT ACCEPT

iptalbes -P FORWARD ACCEPT
作者: ly3209    時間: 2011-12-29 14:12
iptables 还不怎么了解

不过基于内核的防火墙很强大




歡迎光臨 比思論壇 (http://108.170.5.102/) Powered by Discuz! X2.5