Restrict a port access to particular ip in linux


I need to restrict a port access to particular ip in linux. How to do it ?
1 answer Last reply
More about restrict port access linux
  1. 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.
Ask a new question

Read More

Firewalls IP Linux Networking