Sign in with
Sign up | Sign in
Your question

Restrict a port access to particular ip in linux

Last response: in Networking
Share
July 8, 2010 6:53:12 AM

Hello,

I need to restrict a port access to particular ip in linux. How to do it ?
October 17, 2010 5:52:56 PM

Make sure iptables is installed and use it.
personally I don't recommend learning the command line syntax, but instead download and install webmin and use the wizard.
On the local PC, open a web brower and goto http://localhost:10000/ and login in with your normal root credentials.
Goto "networking" and open it.
Click on "linux firewall"
Make sure the drop down says "packet filtering".

The hardest part is knowing where to add it, and that all depends on your distro. Additionally your distro may have another gui for you to use. SuSE has "yast firewall" or in KDE or GNOME use "yast2 firewall"

Depending on the other rules present, you may want to click "Reset Firewall" and start over with a fresh clean slate.

Then you add a rule, and you will get a web based GUI to guide you. You will be able to specific source IP and port(s) and all that when your in the wizard.

In general, I usually add a new chain. Then I use the wizard to run the chain based on the ethernet adapter(eth0,eth1,eth2, etc) and whether what we want to filter is INPUT, OUTPUT, or FORWARD.
Then I add the rules, to the new chain, for what I want to accept.
The the last line is DROP, and anything that wasn't previously allowed is dropped.
m
0
l
!