PoundHost – BlueSquare Adding an IP address and IP’s to VMWare virtual machines

316th Feb 2010Systems Administration, ,

Add a virtual IP address to the host server. This is done on the loopback rather than eth0:0.

3.3.3.3 = This is the virtual IP address you’ve been given.

[root@host network-scripts]# vi /etc/sysconfig/network-scripts/ifcfg-lo:0
DEVICE=lo:0
IPADDR=3.3.3.3
NETMASK=255.255.255.255
ONBOOT=yes
NAME=whatever
IPV6INIT=no
IPV6_AUTOCONF=no

Add an IP addressfor a VMWare machine (guest).

Make sure the the network interface for the guest machine is setup as “Custom” vmnet1 (this is host only).

host: 1.1.1.1
guest: 2.2.2.2

[root@host network-scripts]# vim /etc/rc.local

Add the following to the bottom of the file:

sleep 30
route add 1.1.1.1 dev vmnet1

Login to the guest machine and add the eth0 config.

[root@guest ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BROADCAST=2.2.2.2
IPADDR=2.2.2.2
IPV6INIT=no
IPV6_AUTOCONF=no
NOZEROCONF=yes
NETMASK=255.255.255.255
NETWORK=2.2.2.2
ONBOOT=yes

Now create a route on the guest machine.

[root@guest ~]# cat /etc/sysconfig/network-scripts/route-eth0
ADDRESS0=1.1.1.1
NETMASK0=255.255.255.255
DEVICE0=eth0
ADDRESS1=0.0.0.0
NETMASK1=0
GATEWAY1=1.1.1.1

Finished.

3 Comments Comments Feed

  1. John (February 25, 2010, 6:44 pm).

    hello – I’m wondering if this was with view to assigning public IP’s to virtual machines?

  2. Harry (February 25, 2010, 9:19 pm).

    These notes were actually made a couple of years ago but have since moved onto a few physical boxes, the VMs were really a concept proof which is now in production.

    I think when we originally setup the VMWare networking the traffic didn’t get back out so with some fudging this was the result.

  3. John (February 26, 2010, 10:10 pm).

    I’m currently trying to get networking sorted out on a VMWare virtual machine which is running on a dedicated server (Poundhost). I intend running a website on the VM so need to be able to assign the VM a public IP. I also need to sort out routing so that the VM can see the internet.If you have this working can you let me know how you did it? I was forwarded the info below, however this didn’t work – IPs are examples;

    install vmware server as per normal.
    Edit the ‘Virtual Network Settings’
    disable NAT and DHCP
    Set the vmware guest to use host only networking. (vmnet 1)
    Put the first usable IP address on vmnet1 and set the subnet mask appropriately.
    This is done in the normal windows manner, the “Network connections” panel in the control panel. In my case 92.48.112.225, 255.255.255.252
    Enable IP forwarding under windows as per
    http://support.microsoft.com/kb/323339
    Install the guest vms. Set the network up with an IP from your routed block, in my case 92.48.112.226, netmask 255.255.255.252. Use a default gateway of 92.48.112.225

Add a Comment

*

Spam protection by WP Captcha-Free