iptables:
搭建web服务,设置任何人能够通过80端口访问。
[root@localhost ~]# systemctl stop firewalld #关闭防火墙
[root@localhost ~]# systemctl start iptables #启用iptables
[root@localhost ~]# systemctl restart httpd #启用httpd
[root@localhost ~]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT #设置80端口允许所有IP通过
[root@localhost ~]# iptables -vnL --line-numbers #查看链条
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
2 61 3980 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
3 0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
4 0 0 ACCEPT all -- lo * 0.0.0.0