Network renewing within virtual box

For some situations I use an ubuntu virtual machine on my macbook with oracle virtual box. Previously I always set the network bridged but recently I decided to try out the NAT-configuration. Using port forwarding made my virtual box accessible from outside. But it don’t worked like I expected. After resuming the system and changing the network and starting the virtual box again, my virtual environment could not connect to the environment. Finally I got it fixed and this is how.

Most of those problem can get fixed with a little googling around. I tried it but most were old and referred to some configuration problems. There didn’t seemed to be any specific resuming problems with ubuntu and macosx combined on with virtual box. My experience learned me that it’s ratter seldom to be the only one out there with a specific bug, especially related to popular software. So the searching continued.
My virtual machine has been set up to use dnsmasq and it’s been used over a few years now. The original version runned ubuntu 8.10. It must have been one of my first virtual machines I downloaded from thoughtpolice. As I needed to be able to connect to the machine without loging in, I removed eth0 from the networkmanger and added it to the interface file. So there were a few possibilities where it could go wrong.
I decided to first check out dnsmasq. When watching /var/run/dnsmasq/resolv.conf after changing the network there wasn’t any changes so seemed like dhclient didn’t received any notification on changing it’s IP address although according to the leases file, it should have send out a RENEW message but it didn’t. As it didn’t renewed its address there was no fresh resolv file so we knew why we couldn’t connect to google.com. We could officially state it was a dns problem.
At the other side, /var/log/syslog told me that NetworkManager received a restart signal. Network manager knew there had been a network event but could do anything with it because it wasn’t in charge. The official debian network manager pages brought be the answer. Setting managed=true in /etc/NetworkManager/NetworkManager.conf made network manager able to manage the interfaces. Restarting the network manager and doing some resuming tests showed me my guess was right: it fixed my issue.
I really don’t know it is possible to do it without networkmanager. I guess there must be solution using hotplug events but I didn’t searched that direction because there is no signal we can send to dhclient to make him renewing it’s ip.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s