Benches macOS

8

How do we open a specific port?

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I have a service running on port 8888, it's a command line c application.

How do I open this port in the firewall?

Come on Apple, it can't be that hard can it??

8 replies

Sign in or join Beachball Help to reply.

  1. 0

    Craig Brady

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    In the terminal:

    sudo ipfw add allow tcp from x to y

    x = starting port

    y = ending port

    If only opening one port, make both x and y the single port number. Your admin password will be requested, and does not echo on the screen.

    To close the port(s) again, replace the word "allow" with the word "deny"

  2. 0

    Redwoodtree

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Good question ! This is one reason I don't like the command line administration of firewall rule sets, it's so easy to make a mistake and/or forget what the original settings were.

    I'll take a list of the default settings and post them here if no one else does (I'm not on leopard right now).

  3. 0

    toddimus

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I've been having the same problem trying to figure out how to open up port 24800 so I can use synergy to share my keyboard and mouse. So after much searching I found an app with a somewhat lacking user interface that allows you to open and close ports amongst other things. It's free so I guess I shouldn't complain. It's called Waterroof and is a gui wrapper for terminal methods that have been discussed as solutions on this and other threads.

    http://www.hanynet.com/waterroof/index.html

  4. 0

    Redwoodtree

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Sorry I didn't reply sooner, Leopard has not been my day-to-day OS because of issues such as this one 😉

    Anyway, the default I have with the System Preferences set to "Allow all incoming connections" is this:

    65535 allow ip from any to any

    When I change the System Preference to "Block all incoming connections" or "Set access for specific services . . . " it makes no difference, it's always just this same: 65535 allow ip from any to any

  5. 0

    direwolf8

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I haven't checked this for syntax. From a terminal window, type man ipfw for the man page,

    You want something like:

    ipfw add allow tcp from any 8888 to any

  6. 0

    jamesfromhereford

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Is there a terminal command to reset all the ports to default? I have been experimenting with ports and would like to reset it back to default so no ports are left open.

  7. 0

    jamesfromhereford

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks very much, look forward to hearing back from you.

  8. 0

    jamesfromhereford

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks for your help.