**模拟FORWARD链实现内外网络的流量控制**
实现内网访问可以访问外网,反之禁止
-
在防火墙上安装iptables (yum -y install iptables-services)
-
在防火墙上开启iptables (systemctl enable --now iptables)
-
在所有设备上安装httpd(yum -y install httpd)
-
在所有设备上开启httpd服务:(systemctl )
-
查看所有设备上是否开启成功
-
准备环境(internet设置网络)
hostname -I
-
route -n
-
server环境
-
防火墙
-
起路由 echo “net.ipv4.ip_forward=1” > /etc/sysctl.conf
-
开始配置防火墙规则
-
查看是否成功
-
测试:
用server1:ping 192.168.116.6
用server2:ping 192.168.116.6
14. 允许内网访问外网,在防火墙上添加
15. 测试:curl 10.0.0.11 (忘记安装httpd服务,图就没截到)
测试成功,大致实现了一个小型的实验