|
The default install of Linux will usually set the hostname to some generic value such as, "localhost" or something having to do with the name of the distribution. Some may want to give their node a more meaningful name. Although there's no functional advantage to changing it, at least for most IRLP nodes, some node owners opt to do it anyway. One user advantage of doing it is in the case that you own or administer several nodes. It becomes much easier if you can quickly look at the command prompt and instantly know with which node you are interacting. To change the node's hostname simply edit the hostname variable within the /etc/sysconfig/network file. On Ubuntu systems, simply change it within the /etc/hostname file. To make the change take affect immediately, you can restart the network. On Ubuntu systems, the command, "sudo hostname <name>" will suffice. In either case, a reboot will also accomplish the task. Once you change your hostname, you need to make sure it resolves or more correctly, reverse maps to something. The easiest way to accomplish this is to edit the /etc/hosts file and make sure you have a line that tells your node what it's new name reverse maps to. Since 127.0.0.1 is the host's local loopback address, we can map the new hostname to that address with the addition of the following line:
127.0.0.1 localhost <name>
Obviously replace <name> with what you actually named it. For example, on one of my nodes, I have:
127.0.0.1 localhost stnxxxx
After applying the changes and restarting the network, you can (and should) test to make sure the new name is properly mapped to the host address. The ping utility will come in handy for this. Simply ping the new name and you should get responses back. If you do, you're set! If not, go back and verify that your /etc/hosts file is correct and fix it if necessary. To stop the pings, use CTRL-c and the ping utility will exit with some statistics. Here's an example of a working configuration's responses to 4 pings:
repeater@stnxxxx:~$ ping stnxxxx
PING stnxxxx (127.0.0.1) 56(84) bytes of data.
64 bytes from stnxxxx (127.0.0.1): icmp_seq=1 ttl=64 time=0.030 ms
64 bytes from stnxxxx (127.0.0.1): icmp_seq=2 ttl=64 time=0.017 ms
64 bytes from stnxxxx (127.0.0.1): icmp_seq=3 ttl=64 time=0.016 ms
64 bytes from stnxxxx (127.0.0.1): icmp_seq=4 ttl=64 time=0.017 ms
--- stnxxxx ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2997ms
rtt min/avg/max/mdev = 0.016/0.020/0.030/0.005 ms
|