Static Name Resolution:
This refers to your /etc/hosts file, which is really only practical for a network of a few machines, as you would need to modify the hosts file on each machine so that name resolution works effectively. This is not very practical.
Dynamic Name Resolution:
This refers to the use of a name server, this is configured in the /etc/resolv.conf file, see sample below:
search dev.com sams.orgThe file /etc/host.conf controls how name resolution is configured, see default below:
nameserver 10.168.20.1
multi onThe first entry means that all valid addresses on /etc/hosts will be returned for a host whereas the second entry specifies that name resolution should first attempt to look at the hosts file and then at the name server specfied in resolv.conf.
order hosts,bind
In a somewhat analogous situation to hostname resolution, ip addresses can be set either dynamically or statically.
Before we move on, let's have a look at /etc/sysconfig/network
NETWORKING=yesIf you need to change the hostname, this is where you need to start. The easiest way is to change the name here and reboot, as otherwise you will need to go through all places in the system where the hostname needs to be changed.
HOSTNAME=Subversion
Static IP:
This is fairly simple, just edit the following file /etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE="eth0"The lines in bold are the lines you are interested on, nothing much to say here really.
BOOTPROTO="static"
DNS1="10.168.20.1"
HOSTNAME="Subversion"
HWADDR="00:50:56:88:18:A4"
IPADDR="10.168.20.228"
MTU="1500"
NETMASK="255.0.0.0"
NM_CONTROLLED="yes"
ONBOOT="yes"
Dynamic IP:
This is fairly simple as well, in my case I just edit the configuration file for the other nic, /etc/sysconfig/network-scripts/ifcfg-eth1:
DEVICE="eth1"Needless to say that you need a dhcp server for the latter to work. The MAC Address is not necessary.
BOOTPROTO="dhcp"
HWADDR="00:50:56:88:72:2B"
ONBOOT="yes"
Note that you will need to restart the interface for the configuration changes to take place, this applies to both the static and the dynamic case. You can do this with the following command:
service network restartIn practice, you really only want to restart the interface that you have changed so you should do:
ifdown eth1
ifup eth1
No comments:
Post a Comment