Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Iptables simple Firewall configuration

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Firewall with camouflage enabled.

[root@server ~]# vi /etc/sysconfig/iptables*filter:INPUT DROP [0:0]:FORWARD DROP [0:0]:OUTPUT DROP [0:0]-A INPUT -m state --state INVALID -j DROP-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT-A INPUT -p tcp -m tcp --dport 22 --syn -m state --state NEW -j ACCEPT-A INPUT -p tcp -m tcp --dport 80 --syn -m state --state NEW -j ACCEPT-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -s 0.0.0.0/32 -d 255.255.255.255/32 -i wlp2s0 -j ACCEPT-A INPUT -s 172.16.0.0/16 -i wlp2s0 -j ACCEPT-A FORWARD -m state --state INVALID -j DROP-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT-A FORWARD -p tcp -m tcp --syn -m state --state NEW -j ACCEPT-A FORWARD -p udp -m state --state NEW -j ACCEPT-A FORWARD -p icmp -m icmp --icmp-type 0 -j ACCEPT-A FORWARD -p icmp -m icmp --icmp-type 8 -j ACCEPT-A FORWARD -o lo -j ACCEPT-A FORWARD -s 172.16.0.0/16 -i wlp2s0 -j ACCEPT-A OUTPUT -m state --state INVALID -j DROP-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT-A OUTPUT -p tcp -m tcp --syn -m state --state NEW -j ACCEPT-A OUTPUT -p udp -m state --state NEW -j ACCEPT-A OUTPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT-A OUTPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT-A OUTPUT -o lo -j ACCEPT-A OUTPUT -d 172.16.0.0/16 -o wlp2s0 -j ACCEPTCOMMIT*nat:PREROUTING ACCEPT [0:0]:INPUT ACCEPT [0:0]:OUTPUT ACCEPT [0:0]:POSTROUTING ACCEPT [0:0]-A POSTROUTING -s 172.16.0.0/24 -o enp3s0 -j MASQUERADECOMMIT

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report