+ Post New Thread
Results 1 to 3 of 3
*nix Thread, IPTables - Port rules in Technical; Hi Guys, Anyone know how to block external (internal) access to a port on a *nix machine. Currently running a ...
  1. #1
    ahuxham's Avatar
    Join Date
    Apr 2008
    Posts
    1,122
    Thank Post
    76
    Thanked 138 Times in 109 Posts
    Rep Power
    31

    IPTables - Port rules

    Hi Guys,

    Anyone know how to block external (internal) access to a port on a *nix machine. Currently running a SQUID(NTLM)>DANSGUARDIAN>SQUID(CACHE) setup and its working beautifully, only problem. Changing ports allows skipping of both S1, and DG.

    NTLM running on 8080, DG running on 1355, CACHE running on 1356. I can change the port to 1356 and head straight onto the interweb, how do I only allow 127.0.0.1 to access port 1356?

    I found this code somewhere on the interweb, however it wasn't related to the topic.

    Code:
    iptables -t nat -D PREROUTING -s ! 127.0.0.1/24 -p tcp --dport 1356 -j DROP
    Not quite sure, not sure on the /24 either.

    Any ideas?

  2. #2

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,813
    Thank Post
    110
    Thanked 586 Times in 507 Posts
    Blog Entries
    1
    Rep Power
    225
    Easier way, make squid listen only on localhost.

    Code:
    http_port localhost:1356

  3. Thanks to Geoff from:

    ahuxham (17th September 2008)

  4. #3
    ahuxham's Avatar
    Join Date
    Apr 2008
    Posts
    1,122
    Thank Post
    76
    Thanked 138 Times in 109 Posts
    Rep Power
    31
    Quote Originally Posted by Geoff View Post
    Easier way, make squid listen only on localhost.

    Code:
    http_port localhost:1356
    Thanks Geoff, I did think of that but had tried 127.0.0.1:1356 and it still allowed a connection through, however localhost works perfectly!

    P.S Would the above code do the same?

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 3
    Last Post: 19th February 2008, 10:13 PM
  2. iptables multiple ports
    By Jackd in forum *nix
    Replies: 1
    Last Post: 23rd December 2007, 10:19 PM
  3. HASH Rules
    By bigb3n in forum Windows
    Replies: 3
    Last Post: 29th October 2007, 01:20 PM
  4. Setting up NAT using IPTABLES
    By ChrisH in forum *nix
    Replies: 23
    Last Post: 9th November 2005, 01:54 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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