Monday, November 19, 2012

Reset the IP address of your Ubuntu VM after changing host network

If you changed your host machine to a different network, your previous network setup might not be working, as the gateway and IP address of the host VM might have become invalid. So you need to reset the VM and assign new IP to your network. I'm using VMware Workstation 6.5 as an illustration. And I'm showing only the NAT connection as an example here:

Note the default setup of the following virtual ethernet cards:
VMnet0 is bridged to eth0
VMnet1: for private host-only network
VMnet8: for NAT

Suppose I'm using the NAT connection, then I will change the VMnet8 setup. Before you start, you need to take a look at your host network setup, identify the gateway, and decide your desired IP address range for your VM.

//setup VMnet8 address:
control panel--> Networking settings --> VMnet8 --> TCP/IP --> Properties
Suppose I choose the address as 192.168.0.100

//next setup VM WorkStation network configuration:

Edit --> Virtual Network Editor --> Host Virtual Network Mapping--> VMnet8
> subnet
IP Address:192.168.0.0
Subnet Mask: 255.255.255.0

> DHCP
Start IP Address: 192.168.0.100
End IP Address: 192.168.0.254

> NAT
Gateway IP: 192.168.0.1  (this should match your host gateway)

//double check if the DHCP tab is correct
Edit --> Virtual Network Editor --> DHCP -->

//in ubuntu vm:
1. change /etc/network/interfaces
 update the ip address and gateway

2. change /etc/resolv.conf
update the nameserver

//finally, restart network, and we are done!
sudo /etc/init.d/networking restart

0 Comments:

Post a Comment

<< Home