[BACK]
Home Office Networking: RedHat Linux 7.2/7.3 using DHCP Server
Summary This is my personal experience of setting my home network using RedHat 7.2 as gateway. I write down all the steps and some look outs to remind myself and the others. There is no guarantee these steps will fit you. Please feel free to try them.

Scenario Now, I have setup my home LAN using static ip address that i assign to each local machine on my LAN. You can stop at this point if you want to. Your network will work fine. Great, my network is working However, If i have many machines, setting all machines will be a tedious task, if not impossible. If my friend visits me, I have to setup their laptop as well. So I decide to put dhcp server on my Linux gateway machine. You can find the instruction from http://www.tldp.org/HOWTO/mini/DHCP/.
Setup Layout Pretty much the same as static ip setup. Linux gateway has two ethernet card, eth0 and eth1. The changes are very small. eth0 will connect to the internet(Cable modem) and eth1 will be the gateway interface.

Server Setup Setup eth0 and eth1 on Linux machine same as the above for static ip. Here is the summary of steps i perform above.
  • Edit or create /etc/sysconfig/network-scripts/ifcfg-eth1.
  • Edit or create /etc/sysconfig/network-scripts/ifcfg-eth0.
  • Setup IP-Masquerading is described above.
Please refer to Home Office Networking: RedHat Linux 7.2/7.3 using Static IP document.

Server DHCP Setup Here is the meat of the setup. The idea of dhcp setup is to apply dhcp functionality on the interface that acts as gateway for the LAN. Everytime a client machine on LAN boots up, client will request an ip from the server. The request will go to eth1 in my setup. Thus eth1 is the gateway for client on LAN. The goal is to make eth1 capable of assigning ip address when a request for ip comes in from client. In my setup, i donwload DHCP from ftp://ftp.isc.org/isc/dhcp/dhcp-2.0p15.tar.gz. to compile and install. If you have already installed dhcpd, you can skip this step.
  • Untar and unzip the source.
  • ./configure
  • make
  • make install
Now you have dhcpd installed on /usr/sbin/. Next step is to create a configuration file (dhcpd.conf) for dhcp daemon. This file should be saved as /etc/dhcpd.conf. Here is the example i extracted from http://www.tldp.org/HOWTO/mini/DHCP/x369.html and used. Please visit the site for detail explanation.
# Sample /etc/dhcpd.conf
# (add your comments here) 
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1,24.205.1.14;
option domain-name "mydomain.org";

subnet 192.168.0.0 netmask 255.255.255.0 {
   range 192.168.0.10 192.168.0.100;
   range 192.168.0.150 192.168.0.200;
}

Small Changes I make some changes in my configuration file(dhcpd.conf).
  • option bradcast-address in my LAN is 192.168.0.255 because I use 192.168.0.0 network. The source use 192.168.1.0 network.
  • option routers should be the gateway interface which all client machines should talk to. In my case, all client machine is connected through eth1 to go online and my eth1 it is assigned 192.168.0.1, so I change the routers option to suite my setting.
  • option domain-name-servers is the DNS server for the local machine. I use my gateway machine plus one of the DNS server provided by CharterPipeline. You can only use DNS from your ISP, it should not hurt.
  • subnet 192.168.0.0 netmask 255.255.255.0. My network is 192.168.0.0, which is my subnet. If you use 192.168.1.0 network, then replace all associated parameters to this network.
  • range 192.168.0.10 192.168.0.100. You can assign any range between 0-254 for client IP. Don't include your gateway ip address. In my case, I don't include 192.168.0.1 in the ranges.
  • ddns-update-style adhoc. If you are using RedHat 9.0 version, add this line to your dhcpd.conf.
Now I am ready with my dhcpd setting. I need to start my dhcpd with /usr/sbin/dhcpd -d -f eth1 because eth1 is the interface which will assign ip address to all the client on the LAN. -d and -f option will log the ip request message from client into /var/log/message. This is useful to troubleshoot the communication problem between dhcp client and dhcp server. After making sure everything is working fine, you may want to start up dhcpd when Linux boots up. This can be easilly done. Just create a simple text file named mydhcpd under /etc/rc.d directory. Put your dhcpd startup command /usr/sbin/dhcpd -d -f eth1 in mydhcpd. Make sure this file is executable by chmod 755 mydhcpd. Finally, you add this file to /etc/rc.d/rc.local. rc.local will be executed after xinetd finishes all startup.

DHCP Client Setup Setup all client to obtain IP address automatically and use dynamic DNS. Configuration on Windows and Linux client is straighforward. Thus i don't mention too much here. That's all fols. Hope it helps.
Hosted by www.Geocities.ws

1