I'm trying to modify my router's NAT Table / Port-forwarding rules using the terminal on my Mac. My current setup looks something like this
Public <-> Internet <-> Modem + Router (1.1.1.1) <-> Macbook (192.168.1.2)
There's a webserver / app running on port 7919 on my Macbook and I'd like to port-forward it so anyone can access it publicly from the internet. Specifically, I want 1.1.1.1:7919
to forward data to 192.168.1.2:7919
.
I know I can do this by going in to the Router settings web interface, or using other GUI apps such as PortMap, but I need to do this using the command line.
I've been searching for a solution for hours and still haven't been able to find a simple solution that does this for me. The closest I came was to natd
, but it has been deprecated in favor of pfctl
, and I can't make any sense of it.