Port forwarding to static IP on guest not binding
Posted: 10. Jun 2014, 23:08
Trying to port forward from host (Mac OS X) 127.0.0.1:8282 -> guest (CentOS)'s 10.10.10.10:8080. Existing port forwards include 127.0.0.1:8181 and 9191 to guest without any IP specified (so whatever it gets through DHCP, as explained in the documentation).
Here is how the non-working binding was added:
Here is how the working ones were added:
And by "non-working", I of course mean not listening (as a prerequisite to forwarding):
There should be a similar line above but with 127.0.0.1:8282.
Just to be clear, this port is listening perfectly fine on the guest itself. And when I remove the guest IP (i.e., clear the 10.10.10.10) the forward works fine, albeit to eth0 (not eth1 where I need it). I can tcpdump and watch the traffic flow back and forth. And yes, I've disabled iptables entirely while testing -- it's not getting blocked anywhere on the guest.
As VirtualBox writes in their documentation www . virtualbox . org /manual/ch06.html, you are required to specify the guest IP if it's static (makes sense, no DHCP record it keeps): "If for some reason the guest uses a static assigned IP address not leased from the built-in DHCP server, it is required to specify the guest IP when registering the forwarding rule:". However, doing so (as I need to), seems to break the port forward with nary a report in any log file I can find. (I've reviewed everything in ~/Library/VirtualBox/).
Other notes:
Here is how the non-working binding was added:
Code: Select all
VBoxManage modifyvm "VM name" --natpf1 "rule3,tcp,127.0.0.1,8282,10.10.10.10,8080"Code: Select all
VBoxManage modifyvm "VM name" --natpf1 "rule1,tcp,127.0.0.1,8181,,80"
VBoxManage modifyvm "VM name" --natpf1 "rule2,tcp,127.0.0.1,9191,,9090"
Code: Select all
$ lsof -Pi -n|grep Virtual|grep LISTEN
VirtualBo 27050 user 21u IPv4 0x2bbdc68fd363175d 0t0 TCP 127.0.0.1:9191 (LISTEN)
VirtualBo 27050 user 22u IPv4 0x2bbdc68fd0e0af75 0t0 TCP 127.0.0.1:8181 (LISTEN)Just to be clear, this port is listening perfectly fine on the guest itself. And when I remove the guest IP (i.e., clear the 10.10.10.10) the forward works fine, albeit to eth0 (not eth1 where I need it). I can tcpdump and watch the traffic flow back and forth. And yes, I've disabled iptables entirely while testing -- it's not getting blocked anywhere on the guest.
As VirtualBox writes in their documentation www . virtualbox . org /manual/ch06.html, you are required to specify the guest IP if it's static (makes sense, no DHCP record it keeps): "If for some reason the guest uses a static assigned IP address not leased from the built-in DHCP server, it is required to specify the guest IP when registering the forwarding rule:". However, doing so (as I need to), seems to break the port forward with nary a report in any log file I can find. (I've reviewed everything in ~/Library/VirtualBox/).
Other notes:
- While I used the above command to add the third rule, I've also verified it showed up correctly in GUI and then removed/re-added from there just to
- This forum link www . virtualbox . org /ticket/5654 -- while very dated -- looks somewhat related in that a port forward to a static IP was not appearing (perhaps they think due to lack of gratuitous arp being sent for host to know IP is there/avail?).make sure).