Page 1 of 1

Problems using NAT adapter

Posted: 29. Sep 2010, 10:10
by sim085
Hello, I have been having some problems with the NAT adapter using Virtual Box with Windows7 as hostOS and Ubuntu 10.04 as guest OS. I have the network adapter set equal to NAT. After installation, in the /etc/network/interfaces file, I have iface eth0 inet dhcp. This from what I understand means that the IP is going to be dynamic, i.e. - given to the machine. In this case, since the adapter type is NAT, then isn't VirtualBox responsible to give an IP to this machine? For some reason eth0 is never coming up (ifconfig does not show it) and I need to resolve using a command such as sudo dhclient in order to get a connection listed. This seems to give an IP to my machine. However my question is, why do I need to run this command on startup each time??

NOTE: When I do the command dhclient the device that comes up in ifconfig is not eth0 but eth2!!

Also, if I am using NAT adapter, then does it mean that all requests from the virtual machine (in this case Linux) will appear as if coming from my hostOS to the network to which the latter is connected?

Re: Problems using NAT adapter

Posted: 29. Sep 2010, 16:37
by Perryg
You have changed the MAC address at some point more than likely and eth0 is the one that the guest saves for automatic network. To get this back you can either edit the /etc/udev/rules.d/70-persistent-net.rules or you can delete the rules and Linux will configure it on the next boot

Re: Problems using NAT adapter

Posted: 29. Sep 2010, 16:40
by sim085
Perryg wrote:You have changed the MAC address at some point more than likely and eth0 is the one that the guest saves for automatic network. To get this back you can either edit the /etc/udev/rules.d/70-persistent-net.rules or you can delete the rules and Linux will configure it on the next boot
Thanks - that's what it is :) I have been using the same vm on different instances of virtual box which obviously meant that I had different mac addresses. Thanks again for the help. You solved my problem and I learnt something new both on VirtualBox and Linux :)

Regards,
Simon J.