Linux opens ports and operates firewalls

Command line method: Add 10002 port method

1.vi etc/sysconfig/iptables

2. Open port command: -A INPUT -p tcp -m state --state NEW -m tcp --dport 10002 -j ACCEPT

3. Restart the service: /etc/init.d/iptables restart              

4. Check if the port is open: /sbin/iptables -L -n

 

The way to turn off the firewall is:

1. Permanent effect

Enable: chkconfig iptables on

Off: chkconfig iptables off

2. Immediately effective, invalid after restart

Start: service iptables start

Shutdown: service iptables stop

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326310272&siteId=291194637