Difference between revisions of "Change Default Host Names"
(Created page with "In order to ensure that every device has a unique hostname for [http://en.wikipedia.org/wiki/Dynamic_dns Dynamic] DNS (and because unique hostnames are simply good form), the ube...") |
(No difference)
|
Revision as of 01:19, 18 November 2011
In order to ensure that every device has a unique hostname for Dynamic DNS (and because unique hostnames are simply good form), the ubermix automatically assigns a hostname on first boot to every device it is installed on. This hostname, by default, is set to the word "system" followed by a "-" and the last 3 octets of the device's ethernet card MAC address. So, for example, of my device's ethernet card has a MAC address of 18:03:73:78:36:67, on first boot my device's hostname will be set to "system-783667". While this works fine for most installations, some people would prefer to set hostnames to something else.
If you would like to set the hostname to something else, you basically have two options:
- Alter the hostname script that sets the hostname by adding your own customizations
- Disable the script entirely, and manually set the hostname (or ignore it altogether)
To alter the hostname script, do the following:
- Boot or reboot your machine, and press "esc" when the screen goes blank immediately after showing the model specific splash screen.
- Select "Normal Boot" and press the "e" key on your keyboard
- Select the line in the box that begins with the word "initrd" and move the cursor to the end of the line. Backspace over the four letters "aufs" and replace them with "generic". Do not add any spaces.
- Press "ctrl-x" to boot your machine
- When your machine finishes booting up, open a terminal (ctrl-alt-t) and type the following: sudo gedit /usr/local/bin/update-hostname
- Locate the following two sections of the script, and change the two instances of the word "system" to whatever you like. Be careful not to delete the "\t" before the word "system" in the second section:
if ! grep -q $ETH_ADDR /etc/hostname; then echo "system-$ETH_ADDR" >/etc/hostname UPDATE=true fi if ! grep -q $ETH_ADDR /etc/hosts; then sed -i "s/127.0.1.1.*$/127.0.1.1\tsystem-$ETH_ADDR/g" /etc/hosts UPDATE=true fi
When you are done, save your changes, reboot, and all future machines will use your new scheme.
If you want to disable the script altogether, perform steps 1-4 above, then:
- Open a terminal (ctrl-alt-t) and type the following: sudo gedit /etc/rc.local /etc/hostname /etc/hosts
- In the rc.local tab, locate the "update-hostname" line and delete it. Save and close the file.
- In the hostname tab, change the hostname to whatever you want
- In the hosts tab, change the "system-xxxxxx" to the same thing you set the hostname to in step 3 above.