Find the answer to your Linux question:
Results 1 to 3 of 3
I have a Virtual Dedicated Server with 6 IP Addresses. 1 for the server and 5 for other websites. I want to block the access to port 9999(control panel) and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2009
    Posts
    2

    [SOLVED] ipTables rule to block a port for all internal IP Addresses except one


    I have a Virtual Dedicated Server with 6 IP Addresses. 1 for the server and 5 for other websites.
    I want to block the access to port 9999(control panel) and 22(SSH) for all IP Addresses except 1.
    They are internal IP Addresses not external.

    So w1.x1.y1.z1:9999 is accessible but
    w2.x2.y2.z2:9999
    w3.x3.y3.z3:9999
    w4.x4.y4.z4:9999
    w5.x5.y5.z5:9999
    w6.x6.y6.z6:9999
    do not work. Please help

    I plan to use ipTables to do so since I am using it currently to block ports 993 and 995

    Also, I plan to add more IP Addresses later to the same server.
    SO I would prefer a rule which would allow access to w1.x1.y1.z1:9999
    instead of writing 5 rules to deny access to other IP Addresses, so that I dont have write new rules when I add another IP Address.

    Although this is just preference. Any rule works fine for the time being.

    Please help.

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Not a problem, what do you already have written for your rules?

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    Just Joined!
    Join Date
    Jul 2009
    Posts
    2

    Soved

    I used this:
    iptables -A INPUT -p TCP -d ! w1.x1.y1.z1 --dport 22 -j REJECT
    iptables -A INPUT -p TCP -d ! w1.x1.y1.z1 --dport 9999 -j REJECT

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •