Allow incoming/outgoing ports on iptables
2 mins read
Last couple of years, I just used to disable iptables on my system, this time I decided not to disable it and keep it enabled.
So far so good, now comes the tricky part, I have http server enabled on my system and since this is on local network with already firewall and other security in place so I can allow all incoming to my system and similarly I need to enable XDMCP outgoing. So, I can add the rules like this :
iptables -A INPUT -p tcp –dport 22 -j ACCEPT iptables -A OUTPUT -p udp -s 0/0 -d 0/0 --dport 177 -j ACCEPT for XDMCP
This works only till I reboot my system and is not persistent. Okay, so I can put this in rc.local file. But why I should do that, there should be more elegnant way. So, I searched and finally found that I can simply put the rules in /etc/sysconfig/iptables as follows:
-A INPUT -p tcp –dport 22 -j ACCEPT -A OUTPUT -p udp -s 0/0 -d 0/0 --dport 177 -j ACCEPT for XDMCP
- 2012/02/09 Tora installation on Fedora 16 with rpm
- 2012/07/03 Ubuntu setup – post installation script
- 2012/06/22 tora installation on Fedora 17.
- 2012/05/27 unable to browse windows network with samba4
- 2012/04/17 systemadm – simpler way to manage the service files for systemd
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.