Page 1 of 1

NAT/Port Forward to Virtual IP Interfaces

Posted: 5. Mar 2012, 19:15
by crayfellow
I have Windows 8 and Ubuntu 11.04 guests running on a OS X Lion Server host.

The host has multiple "virtual" IP devices on a single hardware device (en0) that happen to have LAN IP's assigned 10.1.1.87-90. I know the IP's work because they are mapped to the outside world on the firewall and, for instance, Tomcat containers are able to bind to the separate IP's to appear as 4 different "servers" to the outside.

What I am trying to do is use NAT and port forwarding (or, even better, a Bridged Adapter) to route all traffic to a given IP to a specific guest. For example, something like this:

10.1.1.87 routed directly to Windows 8 guest
10.1.1.88 routed directly to Ubuntu 11.04 guest
10.1.1.89-90 handled by the OS X Lion Server host as usual

In this way, I could access the guests from the outside world using the usual ports via the outside IP's that are being routed to these. I believe the Bridged Adapter is the usual way to do this, but when I select Bridged Adapter in the Network configuration for the guests, only the actual hardware interfaces are available to select, not the IP aliases.

I am guessing NAT with Port Forwarding should work (say, make rules for ports 22, 80, 443, etc. to route them directly for each host IP), but this also does not appear to work. I am testing using a simple Apache configuration on the Ubuntu guest that I know is open and available.

Any pointers for a configuration like this? Or is this actually not possible with IP aliases?

Here is what ifconfig says on the host:
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_HWTAGGING>
ether 00:24:36:f2:92:82
inet6 fe80::224:36ff:fef2:9282%en0 prefixlen 64 scopeid 0x4
inet 10.1.1.90 netmask 0xffffff00 broadcast 10.1.1.255
inet 10.1.1.89 netmask 0xffffff00 broadcast 10.1.1.255
inet 10.1.1.88 netmask 0xffffff00 broadcast 10.1.1.255
inet 10.1.1.87 netmask 0xffffff00 broadcast 10.1.1.255
media: autoselect (1000baseT <full-duplex>)
status: active

Re: NAT/Port Forward to Virtual IP Interfaces

Posted: 5. Mar 2012, 19:58
by Perryg
VirtualBox NAT port forwarding is for the VirtualBox NAT.
If you are using the LAN NAT you would port forward from the LAN NAT router.

Re: NAT/Port Forward to Virtual IP Interfaces

Posted: 5. Mar 2012, 20:02
by crayfellow
Right, I understand that.

I also now understand Bridged cannot bind to aliases of network devices. Simply port forwarding using the IP of the hardware device (not one of the aliases) worked fine.

It would be interesting if at some point it would be possible to use Bridged with network interfaces, as opposed to only allowing binding directly to hardware.

Cheers,
Patrick

Re: NAT/Port Forward to Virtual IP Interfaces

Posted: 6. Mar 2012, 02:04
by BillG
crayfellow wrote:Right, I understand that.

I also now understand Bridged cannot bind to aliases of network devices. Simply port forwarding using the IP of the hardware device (not one of the aliases) worked fine.

It would be interesting if at some point it would be possible to use Bridged with network interfaces, as opposed to only allowing binding directly to hardware.

Cheers,
Patrick
That would be very difficult. The filter driver used to separate vm traffic from host traffic works with the device driver for the physical NIC. It would need a major re-write to work some other way.

Re: NAT/Port Forward to Virtual IP Interfaces

Posted: 6. Mar 2012, 02:11
by crayfellow
got it. Thanks for your replies, guys! NAT and port fwd will work just fine for my needs (Jenkins build slaves)