Opening ports in Firewall

In Tiger this is easy to do: just create a new connection in the Firewall tab and enter the TCP and UDP ports you want to use. However, I can't find out how to do this in Leopard. The Firewall tab allows you to create new connections, but then restricts you to to either allow or disallow connections for specific applications. Where can I SPECIFY which ports to use?

For example, for the new Home Sharing feature of iTunes 9, I need TCP ports 3689 & 49152 open, and UDP port 5353 open. How can I confirm that they are open?

What if I add software that requires specific ports open; how will Leopard know which ones?

Message was edited by: romad

Active: iMac (G5, G4), Powerbook G4, iPhone, iPod, MP2100 Retired: iMac G3, A2c, Mac OS X (10.4.11), Mac OS 10.5.8, Mac OS 9.2.2, iPhone OS 3.0, Newton OS 2.1

Posted on Oct 30, 2009 9:11 AM

Reply
18 replies

Nov 1, 2009 8:06 AM in response to romad

How ever you start Home Sharing, do that, then run netstat -anp tcp or(which is part of Network Utility)
sudo /Applications/Utilities/Network\ Utility.app/Contents/Resources/stroke 192.blah.blah.blah 1 1000 (1-1000 are port numbers to check and change to your search). And in answer to "how does Leopard know which ones?", here is a quote: "One nice feature to be included in Leopard’s (OSX 10.5) firewall is the addition of an Adaptive Firewall. This allows you the ability to setup firewall rules based on an application rather that a particular port. What this really means for an administrator is, now you don’t have to hunt down which ports to open for say iChat. In the past you had to know UDP ports 5060, 5190, 5297, 5298, 5678, 16384 through 16403 had to be open to allow full functionality; miss one of them and you may spend a day trying to figure out why the video chat doesn’t work. Now all you have to do is specify that you want to allow iChat and the firewall knows which ports to open for you." Interesting answer that iChat(et al) "just know". This entire App FW makes some sense to me but the CL IPFW rules, to me, do not show as opened after being set and running data thru a new ruled port, by any open port tracing command I use. Tiger was , for sure, easier. If that grammar makes sense.

Nov 1, 2009 12:21 PM in response to doug pennington

Just trying to figure out HOW the AF knows which ports to open; I thought that when there is new software port requirements, how is the AF updated, and was wondering if it might be via the Security Updates.

I look on "adaptive firewall" like "adaptive cruise control"; nice idea with great future possibilities, but right now a work-in-progress.

Nov 1, 2009 12:49 PM in response to Austin Kinsella1

I understand that and have done so. The problem, as stated, does not show the ports being opened(OP orig question) by various commands. Even when a transaction is happening on an open port. doug-penningtons-power-mac-g4:~ dougp$ tftp tftp.server.test.net
tftp> get C0A8010A.SUN4C
Example:(paste above should be below, after tftp was started)
sudo services start tftp (which is port 69) coupled with: sudo ipfw add allow tcp from any to any 69
and doug-penningtons-power-mac-g4:~ dougp$ sudo ipfw list
00100 allow tcp from any to any dst-port 69
65535 allow ip from any to any
then: doug-penningtons-power-mac-g4:~ dougp$ netstat -anp tcp
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp4 0 0 192.168.0.5.52395 204.2.148.105.80 ESTABLISHED
tcp4 0 0 *.88 . LISTEN
tcp6 0 0 *.88 . LISTEN
tcp4 0 0 127.0.0.1.25 . LISTEN
tcp4 0 0 127.0.0.1.631 . LISTEN
tcp6 0 0 ::1.631 . LISTEN
and:ug-penningtons-power-mac-g4:~ dougp$ sudo /Applications/Utilities/Network\ Utility.app/Contents/Resources/stroke 192.168.0.5 1 1000
Password:
Port Scanning host: 192.168.0.5

Open TCP Port: 88 kerberos

Nov 1, 2009 3:52 PM in response to doug pennington

Doug

The rule 100 that you add to ipfw does not actually change anything, as the default final rule 65535 allows everything anyway.

The port scan (using stroke) on my machine shows listening ports - if for example I enable web and printer sharing, it lists the several ports. I tried to start a tftp service, using launchctl, but it just logs a bug and doesn't start, so naturally it doesn't show in stroke. Are you sure that yours did actually start? (Use Activity Monitor, or ps in Terminal).

When I try to connect to your example (tftp.server.test.net) the attempt times out - but while trying it shows in netstat.

User uploaded fileAK

Nov 1, 2009 4:54 PM in response to Austin Kinsella1

Austin, Due to whatever I gave you the wrong command. Should be as follows:
sudo service tftp start
It does show a time out(always has), but check your Home directory(or whatever dir you go from) for SUN4C. Should be there via my new correct command. Top shows PID and command for tftp.
User uploaded file
I can't seem to show that tftp is even listening when running?
doug-penningtons-power-mac-g4:~ dougp$ netstat -a
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp4 0 0 *.kerberos . LISTEN
tcp6 0 0 *.kerberos . LISTEN
tcp4 0 0 compose.smtp . LISTEN
tcp4 0 0 compose.ipp . LISTEN
tcp6 0 0 localhost.ipp . LISTEN
udp4 0 0 *.tftp .
udp6 0 0 *.tftp .
udp4 0 0 192.168.0.5.kerberos .
And finally, then to do a custom ipfw rule(s), the default rule always stays(as seen on all other rule sets I've seen), so what am I missing? Or is my syntax wrong?Thanks. Doug

Nov 2, 2009 2:45 AM in response to doug pennington

Good morning Doug.

Your latest netstat is showing tftp - the tftp protocol uses UDP, not TCP. There is thus never an active connection.

You don't need to start a tftp server (sudo service tftp start) in order to use tftp to retrieve files from another server, you just use the tftp command to start a client.

In IPFW the final rule always allows everything else (the opposite of what you would get on a router packet filter) so I have a rule 65534 deny log ip from any to any. I have a series of rules to allow specific services to set up new TCP connections, and a general rule to allow TCP established. If you like I will email you my ipfw set-up file - it is reasonably commented, as I used it in teaching.

User uploaded fileAK

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Opening ports in Firewall

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.