CentOS网关服务器配置

参考:https://blog.csdn.net/cjy37/article/details/7104898

 

 1.

eth0:192.168.1.12(外网)

eth1:192.168.200.1(内网)

 

2.客户机IP地址

192.168.200.0/25

3. 网关服务器配置:
打开IP转发功能:

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


建立nat 伪装

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 192.168.200.0/25 -o eth0 -j MASQUERADE


建立转发(特定子网的转发)

iptables -A FORWARD -i eth1 -j ACCEPT
iptables -A FORWARD -s 192.168.200.0/25 -m state --state ESTABLISHED,RELATED -j ACCEPT


保存iptables 配置

service iptables save

 

posted @ 2018-06-28 13:47  邱比比  阅读(343)  评论(0编辑  收藏  举报