訪問80埠
發布時間: 2024-06-14 01:36:50
1. linux防火牆iptable如何設置只允許某個ip訪問80埠,只允許特定ip訪問某埠
1、vi /etc/sysconfig/iptables
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i eth0 -s 192.168.1.2 -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -i eth0 -p icmp -j ACCEPT
-A INPUT -i eth0 -j DROP
COMMIT
2、/etc/init.d/iptables restart
3、iptables -nvL檢查
4、-s 192.168.1.2即只允許192.168.1.2訪問
熱點內容