I recently started taking the Udacity course on Computer Networking and while it looks like a good course it suffers from the same problem all the Udacity courses seem to suffer from: really badly put together examples and quizzes. It’s a shame because the material itself is generally of a really high quality. The problem I hit here was after starting up the virtual machine they provide for learning against I found I didn’t have a connection to the Internet. The instructions mention putting the network adaptor into bridged mode but nothing about what to do if the adaptor doesn’t configure itself.
The error message shown during boot is:
Waiting for network configuration... Waiting up to 60 more seconds for network configuration...
And when that looooong 60 seconds is up the machine boots and you have no connections configured. The problem seems to be that for some reason what would normally be called “eth0” ends up with a different name. If you run the command
You will get a list of all the interfaces known to the machine. As you can seen in the screenshot below my ethernet interface has, for some reason, ended up with the name eth2.
The quickest solution is to open the /etc/network/interfaces file (e.g. sudo emacs /etc/network/interfaces) and change all references to eth0 to eth2. After a restart of the virtual machine it should pick up an IP address automatically. The problem is that eth0 is generally assumed to be the first ethernet port so all examples will refer to it as such and so you’ll have to remember whereever you see eth0 on your machine is means eth2 – yuck.
A better solution is to open the file /etc/udev/rules.d/70-persistent-net.rules and modify it so that there is only one network defined and it’s called eth0. What is happening is the machine is linking a MAC address to an interface. When I deployed the virtual machine I told it to reassign MAC addresses. Normally this reassignment isn’t an issue but this machine ties the MAC address to the interface name so when it found a new MAC address is created a new interface eth1. Trying to make it work I reassigned the MAC address again hence the creation of eth2.
This screen shot shows the current situation:
There are two ways to fix this:
- Jot down the MAC address of eth0 as shown in the rules file. Delete the bottom two entries.
- Stop the virutal machine.
- Edit the MAC address shown for Adapter 1 in the VirutalBox settings.
- Start the virtual machine.
- In the rules file delete the first two entries and change the name eth2 to eth0.
- Restart the virtual machine.
The latter requires less typing so that’s what I’ll do.