iptables共享上网

[root@lb01 ~]# sysctl -p
net.ipv4.ip_forward = 1
vim /etc/sysctl.conf

modprobe ip_tables
modprobe iptable_filter
modprobe iptable_nat
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
modprobe ipt_state


[root@lb01 ~]# lsmod|egrep ^ip
iptable_nat 5923 0
iptable_filter 2793 0
ip_tables 17831 2 iptable_nat,iptable_filter
ipv6 335589 264
[root@lb01 ~]#

iptables -t nat -nL
iptables -t nat -A POSTROUTING -s 172.16.1.0/24 -j SNAT --to-source 10.0.0.5
以上内容在 路由器上配置


客户机要在route add default gw 172.16.1.5
永久生效在内网网卡添加路由器的网关地址 GATEWAY=172.16.1.5

 

posted @ 2017-08-19 11:47  kkblog  阅读(228)  评论(0编辑  收藏  举报