This HAS to be something that can be done. I've searched and found many answers that claim to do what I want, but I can't seem to put it together. So...
I am running a Linux virtual machine under Mountain Lion. The VM runs Apache. I need to redirect all traffic that arrives on the host's port 80 to the guest's port 80. I can reach the VM's web site from the host using:
I can also reach the default Mountain Lion Apache server from other machines on the local network using:
(Proving that port 80 is open on the host. And yes, I have tried shutting off the Mac OS installation of Apache to no avail)
I need for other machines on the network to be able to reach the server that is running under the VM by the latter address (
I have tried ipfw from the host:
ipfw add 100 forward 192.168.100.2,80 ip from any to any 80 in
After I do that, machines on the local network timeout trying to reach
http://10.0.42.22/ instead of reaching the Mac OS "It Works!" screen, which tells me that "something" has happened, but unfortunately, that something isn't that forwarding to the guest is working.
I also tried adding to /etc/pf.conf:
rdr on en1 inet proto tcp from any to any port 80 -> 192.168.100.2 port 80
pfctl -f /etc/pf.conf
Which results in this output:
No ALTQ support in kernel
ALTQ related functions disabled
Which is the same thing I get when reloading pfctl with the default configuration. This has no affect (machines on the local network receive the Mac OS Apache default "It Works!" screen). I have also tried using both of the above together, with the results being the same as using only the ipfw trick.
I have read about and tried many combinations of ipfw and pfctl, but none got any different results or seem more correct than what I mention above.
I've done this exact thing for nearly two decades with BSD and various flavors of Linux as the host, but I just can't seem to get it to work with a Mac OS host. I'm hoping that I overlooked something stupid and/or simple and that somebody out there can point out what it is.