This configuration will work on all RPM based linux distributions (Redhat,Fedora,CentOS,etc.)
Configure DHCP ( Dynamic Host Configuration Protocol ) Server. If you make your linux computer DHCP server, it’s neccesarry to disable DHCP function on router in LAN.
Step1: Install dhcp packages
[root@server ~ #]yum install dhcp |
Step2: Edit the dhcp configuration file located in /etc/dhcp/dhcpd.conf
[root@server ~ #]vi /etc/dhcp/dhcpd.conf |
#[Note: The lines to add or edit in dhcpd.conf file is colored brown. Enable the lines by removing ‘#’ if required and edit. Allways backup the configuration file before editing.]
#Add your domain name
option domain - name "vjetnamnet.com" ; |
#Add DNS server addresses(for clients)
option domain - name - servers 10.1 0.1 0.1 0 , 8.8 . 8.8 ; |
#Set lease time
default - lease - time 600 ; |
#set maximum lease time
max - lease - time 7200 ; |
#activate dhcp server
authoritative; |
#Add your ip address pool in below format. In this example network 10.10.10.0/24 and ip address pool is 10.10.10.200 to 250 for clients,gateway=10.10.10.10.
subnet 10.1 0.1 0.0 netmask 255.2 55.2 55.0 { range dynamic - bootp 10.1 0.1 0.2 00 10.1 0.1 0.2 50 ; option broadcast - address 10.1 010.2 55 ; option routers 10.1 0.1 0.1 0 ; } |
#This is the way to Reserve an ip address 10.10.10.29 for a special client named Accounts . [ MACaddress based reservation]. Here 00:E0:5D:A0:6A:0C is the mac address of accounts pc’s NIC card(optional).
host Accounts { hardware ethernet 00 : E 0 : 5 D : A 0 : 6 A : 0 C; fixed - address 10.1 0.1 0.2 9 ; } |
Step3: Start dhcp service
[root@server ~ #]service dhcpd start |
Step4: Add dhcp service to startup
[root@server ~ #]chkconfig dhcpd on |
Step5: To do in client computers
Set Obtain ip automatically in all windows and “Use DHCP” in linux client computers.