说明做路由机器需要一个外网地址(191.192.187.45)和一个网网地址(192.168.0.206)

配置

做路由的机器配置

1、打开内核ip转发

     #vim  /etc/sysctl.conf
     net.ipv4.ip_forward = 1
     #sysctl -p

2、iptables配置

     #vim /etc/sysconfig/iptables
     *filter
     :INPUT ACCEPT [0:0]
     :FORWARD ACCEPT [0:0]
     :OUTPUT ACCEPT [0:0]
     :RH-Firewall-1-INPUT - [0:0]
     -A INPUT -j RH-Firewall-1-INPUT
     -A FORWARD -j RH-Firewall-1-INPUT
     -A RH-Firewall-1-INPUT -i lo -j ACCEPT
     -A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
     -A RH-Firewall-1-INPUT -p 50 -j ACCEPT
     -A RH-Firewall-1-INPUT -p 51 -j ACCEPT
     -A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
     -A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT      -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT      *nat
     :PREROUTING ACCEPT [12001:793841]
     :POSTROUTING ACCEPT [0:0]
     :OUTPUT ACCEPT [0:0] -A PREROUTING -i eth1 -s 202.91.251.245 -p tcp -d 60.191.141.225 --dport 27017 -j DNAT --to-destination 192.168.1.8:29017 
     COMMIT
     保存退出
     #iptables-restore < /etc/sysconfig/iptables

 客户端配置

1、执行命令

#route add default gw 192.168.0.206

爱慕尔商城欢迎您的光临!
穿衣打扮  
城市物语