Search code examples
macossocketstcp

Accessing tcp port 8080 externally on macos mojave


I am trying to access a listening tcp socket on my macbook from any external client on the same wi-fi lan.

This works for specific ports, eg. 8000, but not other ports, eg. 8080, 8081, 8082

How can I open up or access the 8080 tcp port externally?

Working steps on port 8000

Server

$ nc -lv 8000

Client

$ nc -z 192.168.101.98 8000
Connection to 192.168.101.98 port 8000 [tcp/irdmi] succeeded!

Non-working steps on port 8080

Server

$ nc -lv 8080

Client

$ nc -z 192.168.101.98 8080 (The command just hangs)

Diagnostics

$ lsof -P -i TCP:8000
COMMAND   PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
nc      75782 ...    3u  IPv4 0x5be3e11e5a732339      0t0  TCP *:8000 (LISTEN)

$ lsof -P -i TCP:8080
COMMAND   PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
nc      75952 ...    3u  IPv4 0x5be3e11e581e2fb9      0t0  TCP *:8080 (LISTEN)

$ sudo pfctl -s all | grep Status
No ALTQ support in kernel
ALTQ related functions disabled
Status: Disabled                              Debug: Urgent

I am running macOS Mojave 10.14.1 (same behavior on 10.14 as well).

Update

I changed nothing, everything suddenly works. I am very curious what made the difference. Will close the question, if everything keeps working.


Solution

  • Solution

    I had the Endpoint Security VPN client installed. This activates a firewall at all times blocking some ports. Even when not connecting to a vpn server.

    By shutting down the client daemon, i can access all ports again.

    Steps to shutdown daemon

    From: https://gist.github.com/phoob/671e65332c86682d5674

    kill client and run commands to stop daemon:

    sudo launchctl unload /Library/LaunchDaemons/com.checkpoint.epc.service.plist
    sudo kextunload /Library/Extensions/cpfw.kext