Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Thank you in advance for any help you can give. I have searched and searched and have not found an answer to my issue. I'm not sure if this should be in virtualisation or networking - since it's mostly a networking question, I'll ask here.

I have a rent-a-server with one NIC and two real-world IP addresses. The first IP,, is the actual IP address of the server. The second IP,, is an IP alias. The interface is defined as follows:

# loopback interface

auto lo
iface lo inet loopback

# ethernet interface

auto eth0
iface eth0 inet static

# virtual interfaces

auto eth0:0
iface eth0:0 inet static
name Ethernet alias LAN card

The address has a web server and a number of functioning services on it. The address is a recently purchased address. It "pings" as defined above. I've no previous experience with IP aliaes, but as I understand it, the address is NOT associated with a network at all. There is no broadcast or gateway associated with the address.

I am attempting to install a product that functions within a virtual machine hosted on the same server. I want the virtual machine to be addressed by the address. The pre-built VMWare based virtual machine obtains its IP through DHCP. Both the host and virtual machine are Ubuntu 10.04 server. I would prefer to change the VM to use the static IP, but have no idea how to set that up since there is no actual network/broadcast/gateway. When I attempt to set up the dhcp3-server on the host, it fails to start, issuing the error message: "No subnet declaration for eth0:0 ( ** Ignoring requests on eth0:0." as if the eth0:0 interface is not up. The eth0:0 is, however, up.

Host: Ubuntu 10.04 LTS server version VM: VMWare Server 2.02, Guest Ubuntu 10.04 LTS server version

Anyone know how to set the above scenerio up? Is it even possible with an IP alias?

share|improve this question

Normally you would make eth0 a bridge interface, define the virtual interface in VMWare to use that bridge, and then just configure the 209.x.y.z static IP in the guest as normal (i.e. you don't even need to create an alias entry for 209.x.y.z on the host).

So your /etc/network/interfaces on the host would change to something like:

auto br0
iface br0 inet static
  bridge_ports eth0
  bridge_fd 2

I'm not sure exactly how you configure VMWare to use br0 though (I use KVM with libvirt myself) but I'm certain it must be possible.

share|improve this answer
So how would you configure eth0 in such a scenario? I have to be really careful ... I cannot lose connectivity with the server as this is a production machine. – gregintexas Nov 7 '12 at 16:06
@gregintexas You don't need to configure eth0 because the configuration of br0 works over the interface defined ("bridge_ports eth0"). I should have been clear in my answer that this method may not be suitable if your host is routing the 209.x.y.z IP traffic specifically to the MAC address of eth0 without ability to set a different MAC (i.e. for the virtual adapter in the VM). If it's a production machine and you are not 100% comfortable that you understand all this, you might prefer to create a private network instead and use the DNAT routing method in the other answer. – Will Daniels Nov 7 '12 at 17:11

From a quick Internet search, it appears that VMPlayer has problems configuring the virtual device on Ubuntu. KVM appears to be able to run VMWare images. In any case the first issue to solve is to configure your guest to use a fixed address. Once you have known IP addresses you can do the rest quite simply.

One solution would be to resolve the issue with your new static address, and then use IP tables to DNAT traffic to the the virtual machine. A tool like Shorewall (available as an Ubuntu package) would do this simply. The Shorewall documention covers NAT very well.

Alternatively, you can move the address to the virtual machine as you desire. Replace in the following with the IP address of your virtual sever. I would add the address on one of the private address blocks (,, or I would expect your virtual server container to use one of these by default. If it sets up a DHCP server, you can add a static address on that network outside the DHCP address range.

Move the eth0:0 definition to the virtual server. (I believe you should remove the name line which may be causing problems. In any case, it is not needed.)

Route traffic for to the virtual machine with the command:

ip route add via

This command will need to be run after the network device used for the virtual machine has been created. If you can create the network in your /etc/network/interfaces file you could add it as post-up command.

A second method to move the address would be to configure it as a point to point address on the virtual machine. You should be able to use eth0:0 instead of eth0 in the following. On the virtual client /etc/network/interfaces block would be like:

auto eth0
iface eth0 inet static

The point to point network should work as your default route if you don't have an alternative default route. I haven't verified this. However, if you do have a default route it will should handle traffic correctly.

You will need a point0-to-point route. A command like this route like work if your network device for the virtual network is br0. Use the correct device for your server.

ip route dev br0

Will Daniels is correct about the using a bridge device for the virtual machine network. Your eth0 device does not need to part of the bridge. In my case, I can't connect my eth0 device to the bridge as I have multiple bridges. I document my Manual networking for KVM. If your eth0 device is not joined to the bridge, you will need to enable IP forwarding. (ShoreWall does this for me.) You should be able to safely create and remove bridge devices which are not connected to your network interface.

As you mention this is your production server, I would recommend you try setting up the require configuration on a non-production server first. You can assign address from unused portions of the private network zones for testing. Then use the correct addresses on the production setup.

share|improve this answer
So you're saying on the virtual machine: auto eth0 iface eth0 inet static address netmask Then route the traffic via: ip route add via ? – gregintexas Nov 7 '12 at 16:08
Let me ask this again, formatted correctly: auto eth0 iface eth0 inet static address netmask as the vm eth0 config and route the traffic with ip route add via ? – gregintexas Nov 7 '12 at 16:18
evidently, I cannot add a comment correctly formmatted ... * sigh * – gregintexas Nov 7 '12 at 16:21
I've updated my response including testing point to point networking. (Note: Point to point is spelled strangely.) Normally your internal network would be on a private address range. – BillThor Nov 8 '12 at 0:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.