The DNS setup is also a starignt forward job in Ubuntu 10.04 LTS. Like all other major distributions like Redhat Enterprise Linux, Ubuntu distributions also use the /etc/resolv.conf file for DNS resolving.
To cause your machine to consult with a particular server for name lookups you simply add their addresses to /etc/resolv.conf.
Open the /etc/resolv.conf file in your favoirite editor and specify the DNS server in it.
# sudo vi /etc/resolv.conf
search example.com
nameserver 192.168.10.1
Here 192.168.10.1 is my DNS server in my example.com domain. Now if your server does not have the file resolv.conf in your /etc directory, dont worry you can simply create it and edit it as above.
# touch /etc/resolv.conf
Similarly you can assign static lookups in your /etc/hosts file.
# sudo vi /etc/hosts
#
192.168.10.100 test test.example.com
If you specify these host explicitely in the /etc/hosts file then the domain name rsolution will takes place fastly.
In my last post i have described how to configure network in Ubuntu 10.04 LTS in bare metal form. Now we will check how to configure hostname in Ubuntu based distributions. First of all let me asure that the process of seting up hostname is very straight forward in Ubuntu 10.04 LTS.
You can directly query or set the hostname with the "hostname" command.
The current hostname can be viewed using:
# sudo /bin/hostname
To set hostname you can use the command:
# sudo /bin/hostname demo.demoserver.in
NOTE: Need not to say that you should change the hostname from demo.demoserver.in to your requirements.
While rebooting Ubuntu based distributions will read the hostname from /etc/hostname file.
So you can open the file /etc/hostname in your favourite editor and specify the hostname there to make the change persistant.
# sudo vi /etc/hostname
# specify your hostname here.
demo.demoserver.in
Normally all the users will create and configure their network while installing the Operating System Itself. However here I am post the process of configuring the network using command line in Ubuntu 10.04 LTS Lucid Lynx. You can also configure network using GUI utilities in Ubuntu 10.04 LTS such as network-admin or else your famous ifcfg command etc.
Here I am following the bare metal method and will edit the main network configuration files for providing the network information. The main network configuration file of any Ubuntu based distribution is the "/etc/network/interfaces" file. Just open the file in your favourite editor and start configuring it as follows.