Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Wednesday, January 19, 2011

ubuntu vm networking weirdness

Over the past week, I've been working quite a bit with Ubuntu 10.04 and VMware. Two problems confronted me:
1) /etc/resolv.conf was getting overwritten
2) /etc/network/interfaces was missing my eth0 network interface

Number One
The first problem was more easily solved than the second issue. What I did to resolve this issue was to edit /etc/dhcp3/dhclient.conf and add the following line:
supersede domain-name-servers [server1],[server2],etc;
(yes, supersede is misspelled)

Number Two
The second problem was a little more esoteric. What I found was that the network interface of my Ubuntu VM kept getting renamed (from eth0 to eth1 and then eth2). The cycling interface names may be caused by moving the VM to different machines. This is because Ubuntu will remember the MAC address of the first machine it was installed on. Ifconfig can see the newly named interfaces, but the ifup and ifdown commands to start and stop the network interfaces cannot see the new names. Ifup and ifdown rely upon entries in /etc/network/interfaces.

In order for ifup and ifdown to see eth0, I added the interface back into /etc/network/interfaces with the following lines:
auto eth0
iface eth0 inet dhcp


By the way, you can use a second command to restart a network interface:
sudo invoke-rc.d networking restart

Back to the original problem, that of the switching network interface names. Ubuntu uses the udev service to detect hardware. So, the solution was to either edit /etc/udev/rules.d/70-persistent-net.rules or delete it and have udev the system regenerate the file. As deleting the file was easier, I opted for that method. After deleting the file, I reboot the vm and voila, my eth0 interface was back.

all in a good days work,
TAG

Reference
http://serverfault.com/questions/63103/newsid-program-for-linux
http://en.wikipedia.org/wiki/Udev

Wednesday, April 16, 2008

Ubuntu 7.10 install in VMware Server gotcha

Trying to install Ubuntu 7.10 in VMware Server 1.04, I came upon a lot of these messages as Ubuntu was trying to install itself into the virtual machine's hard drive:
sd 2:0:15:6 rejecting I/O to offline device

Background
A caveat to installing most Linux distributions within VMware Server for XP is that you need to set the SCSI driver to Lsilogic in the configuration file for the virtual machine. The config file will be a file with the extension ".vmx" in the VM's directory. For example, the config file for my Ubuntu install was "Other.vmx"

Solution
Here is the line you need to add to your .vmx file:
scsi0.virtualDev = "lsilogic"

My entire .vmx file ended up looking like this:
config.version = "8"
virtualHW.version = "4"
scsi0.present = "TRUE"
scsi0.virtualDev = "lsilogic"
memsize = "1024"
ide0:0.present = "TRUE"
ide0:0.fileName = "Other.vmdk"
ide1:0.present = "TRUE"
ide1:0.fileName = "auto detect"
ide1:0.deviceType = "cdrom-raw"
floppy0.fileName = "A:"
Ethernet0.present = "TRUE"
displayName = "Ubuntu 7.10"
guestOS = "other"
priority.grabbed = "normal"
priority.ungrabbed = "normal"
ide0:0.redo = ""

ethernet0.addressType = "generated"
uuid.location = "56 4d 32 f1 73 c7 b5 15-26 b3 bf 4b eb 77 4f c6"
uuid.bios = "56 4d 32 f1 73 c7 b5 15-26 b3 bf 4b eb 77 4f c6"
ide1:0.autodetect = "TRUE"
ethernet0.generatedAddress = "00:0c:29:77:4f:c6"
ethernet0.generatedAddressOffset = "0"
numvcpus = "2"



Of course, the line you add may differ if you have more than one SCSI device. Once the line is added, you'll need to restart your virtual machine for the change to take effect.

Good luck!
sodo
Feel free to drop me a line or ask me a question.