Modify router port-forwarding rules from Terminal
After searching for hours, I still wasn't able to find a built-in command-line utility that does what I'm asking for. But I did find something else that's pretty close. It's PortMapper, a java applet that comes with a command-line interface to manage the port-mappings of your router (must be UPnP compatible).

Since my plan was to do everything from the terminal, I'll walk you through the steps:

# Download the latest version
curl -fSL "https://sourceforge.net/projects/upnp-portmapper/files/latest/download" -o portmapper.jar

# See the basic help
java -jar portmapper.jar -h

# List all port-forwarding rules
java -jar portmapper.jar -list

# Create a new rule
java -jar portmapper.jar -add -externalPort 7919 -internalPort 7919 -ip 192.168.1.2 -protocol tcp

# Delete a rule
java -jar portmapper.jar -delete -externalPort 7919 -protocol tcp




This assumes you have java installed and available in your shell