3

I followed the instructions mentioned in the following blog to open a port on Mac. But i see still see that my port is closed after following all these instructions. Is there any change that needs to be done for OS X Elcapitan ? Any help is appreciated/

https://gauravsohoni.wordpress.com/2015/04/14/mac-osx-open-port/

nmap -p 1234 localhost

This will output the status ..

Nmap scan report for localhost (127.0.0.1) Host is up (0.00013s latency). PORT STATE SERVICE 1234/tcp closed ppp

To open this port, add the following line in /etc/pf.conf sudo vim /etc/pf.conf

Open port 1234 for TCP on all interfaces

pass in proto tcp from any to any port 1234

You can limit the ip addresses .. replace any with allowed addresses ..

Save the file.

Restart the Mac and run nmap command to see if the port is open/

3

Are you running any application which is listening on port 1234? Even if the port is not blocked by pf, it will still show as closed if no-one has opened it.

For example, after unblocking the port as above, in one terminal execute

$ nc -l 1234

to have nc listen for incoming connections on port 1234. (Nothing will happen, and you won't get a prompt back, because netcat is just... listening.) Then, in another terminal, run your

$ nmap -p 1234 localhost

This should show the port as open.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.