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

What commands are commonly used in firewalls in linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

What firewall commands are commonly used in linux, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this to learn, I hope you can gain something.

I. iptables firewall

1. Basic operation

#View firewall status

service iptables status

#Stop the firewall

service iptables stop

#Start firewall

service iptables start

#Restart firewall

service iptables restart

#Turn off firewall permanently

chkconfig iptables off

#Restart after permanent shutdown

chkconfig iptables on

2. Open port 80

vim /etc/sysconfig/iptables

#Add the following code

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Reboot firewall after save exit

service iptables restart

Second, firewall firewall

1. Check firewall service status

systemctl status firewalld

Active: active (running) is highlighted.

Active: inactive (dead) appears. Gray indicates stop.

2. Check the status of firewall

firewall-cmd --state

3. Start, restart, close, firewalld.service

#Open

service firewalld start

#Restart

service firewalld restart

#Close

service firewalld stop

4. View firewall rules

firewall-cmd --list-all

5. Query, open and close ports

#Query whether the port is open

firewall-cmd --query-port=8080/tcp

#Open Port 80

firewall-cmd --permanent --add-port=80/tcp

#Remove port

firewall-cmd --permanent --remove-port=8080/tcp

#Restart firewall (restart firewall after modifying configuration)

firewall-cmd --reload

#Parameter explanation

Firwall-cmd: A tool provided by Linux to operate firewalls;

2, --permanent: means set to permanent;

3. --add-port: identifies the added port;

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

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

Internet Technology

Wechat

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

12
Report