Changing Hostname in Ubuntu

To permanently change your host name make sure you hit all the spots.  You can start by looking at the following:

1
sudo hostname NEW_HOST

You will first want to edit your hostname file:

1
sudo vi /etc/hostname

Then run:

1
/etc/init.d/hostname.sh start

After you have done that then change your hosts file:

1
sudo vi /etc/hosts

If you are running this on VMWare you will need to delete this file

There is a file /etc/udev/rules.d/<some number>_persistent-net.rules, where udev caches, which hardware device should get named eth0. Here it looks like this:

1
2
\# PCI device 14xx:16xx (tg3)
ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", SYSFS\{address}=="00:11:xx:xx:xx:xx", NAME="eth0"

Make sure that you have configured to use dhcp instead of static ip for your machine. Otherwise it will grab the same ip address of the other machine already on your network.