Tuesday, September 9, 2008

Port Forwarding in Leopard using natd

I spent a couple hours trying to get port forwarding to work in OS X Leopard. I found natd, the bsd command line port forwarding thing. I couldn't get it to work. I had my virtual machine running, netstat said it was on 192.168.131.132 or whatever, and i had nginx installed on it listening to port 80. The challenge was to get traffic to my machine on port 8080 or whatever to forward to the virtual machine on port 80. If that could happen then I could force my coworkers to test my software on their workstations instead of having to do it all myself. Alas, I couldn't figure it out. The closest I came was

spinach$ ipfw flush
spinach$ natd -a lo0 -redirect_port tcp 192.168.131.132:80 8080

something like that, and it didn't work. If anyone figures it out, I'd love to hear.

No comments: