I am trying to forward traffic like this:
Internal Network Computer (192.168.1.*) → Server (192.168.186:1234) → Internal Network Computer (192.168.1.198:80)
Server is plugged into the router via ethernet on interface en0
Internal Computer is connected to router via wifi
Server can access 192.168.1.198:80 with no problems
According to various other related questions, I have gotten the following rules
nat on en0 from any to en0 -> (en0) rdr pass inet proto tcp from any to any port 1234 -> 192.168.1.198 port 80
However I get the following when
$ telnet 192.168.1.186 1234 Trying 192.168.1.186... telnet: connect to address 192.168.1.186: Operation timed out telnet: Unable to connect to remote host
Using Wireshark on the 192.168.1.198 I have confirmed that the telenet connection is received however it doesn't seem to connect.
Some more info:
127.0.0.1work fine, for example:
rdr pass inet proto tcp from any to any port 1234 -> 127.0.0.1 port 80
I have confirmed that port 80 is open on 192.168.1.198, and that it is accessible from the server
Firewall (in System Preferences) is disabled on both computers
I have enabled cross interface traffic forwarding with
sudo sysctl -w net.inet.ip.forwarding=1
I think it may be something with NAT (see the below posts) but I am not sure
The same issue is discussed on GitHub. @ctgreybeard, @dandriana, @snimavat, and @sergeyzwezdin have all reported the same issue. Does anyone have a solution?
Please Note: I would like to use pfctl and not SSH or another service.
Here are some other related posts: