centos firewall open port code example
Example 1: firewall port open centos
firewall-cmd --zone=public --add-port=2888/tcp --permanent
Then remember to reload the firewall for changes to take effect.
firewall-cmd --reload
Example 2: centos 7 port open
firewall-cmd --zone=public --add-port=55555/tcp --permanent
firewall-cmd --reload
Example 3: open port 22 centos 7
firewall-cmd --zone=public --add-port=22/tcp --permanent
firewall-cmd --reload
iptables-save | grep 22
firewall-cmd --zone=public --remove-port=22/tcp --permanent
firewall-cmd --reload
service iptables status
service iptables start
chkconfig --list iptables
chkconfig iptables on
iptables -L
iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT
iptables -D INPUT -i eth0 -p tcp --dport 22 -j ACCEPT
iptables-save | grep 22
Example 4: open firewall port in linux
Debian: sudo ufw allow PORT. CentOS: sudo firewall-cmd --zone=public --permanent --add-port=PORT/tcp sudo firewall-cmd --reload