05 How To Allow Custom Ports in Firewall | Allow Multiple Ports in Firewall | Working with firewall-cmd command line

Linuxtopic
1
How To Allow Custom Ports in Firewall | Allow Multiple Ports in Firewall
How To Allow Custom Ports in Firewall | Allow Multiple Ports in Firewall


In this topic we will add custom single and multiple ports in firewall

We will add 10000 TCP and 10001 UDP port in linuxtopic zone , below command

To add single port in firewall
firewall-cmd --list-all
firewall-cmd --zone=linuxtopic --add-port=10000/tcp
firewall-cmd --zone=linuxtopic --add-port=10001/udp

Note: Here we add both ports temporary to add permanently you can add  --permanent 

To add firewall ports in permanent
firewall-cmd --zone=linuxtopic --add-port=10000/tcp --permanent
firewall-cmd --zone=linuxtopic --add-port=10001/udp --permanent
To add multiple ports in firewalld

We will add 10010 to 10020 tcp and 10010 to 10015 udp ports in firewall
firewall-cmd --zone=linuxtopic --add-port=10010-10020/tcp --permanent
firewall-cmd --zone=linuxtopic --add-port=10010-10015/udp --permanent
firewall-cmd --reload

How to allow port Instead of service in firewall, first we will check which ports is used by service. we can get info with following command, for the example of samba service
firewall-cmd --info-service=samba

Here we get 137/tcp 138/udp 139/tcp and 445/tcp port used by samba. Now we have all ports of samba
firewall-cmd --zone=linuxtopic --add-port=137/tcp --permanent
firewall-cmd --zone=linuxtopic --add-port=138/udp --permanent
firewall-cmd --zone=linuxtopic --add-port=139/tcp --permanent
firewall-cmd --zone=linuxtopic --add-port=445/tcp --permanent
firewall-cmd --reload





Thanks






Post a Comment

1Comments

  1. If you are looking for more information about flat rate locksmith Las Vegas check that right away. History of Tea

    ReplyDelete
Post a Comment

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Ok, Go it!