United States (change)
Shortcuts: Downloads Fedora Red Hat Network
How can more than one machine use a single Internet connection? How can you set up a lab, such that students or faculty can roam with their own laptops? A small business or school or anyone who uses laptops or moves their computers around may need to assign IP addresses on the fly. And it's really pretty easy to see how, in this month's Tips and Tricks.
This exercise describes a simple DHCP example where mobile Linux and Windows computers use a portion of the 192.168.1.0 subnet.
First, you have to install the DHCP on a server, as shown in the following steps:
up2date -i dhcp
option routers 192.168.1.254;
shared-network YOUR.NET {
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.40 192.168.1.50;
}
}
The first section describes the range of IP addresses, within the class C subnet 192.168.1.0, that the DHCP clients are going to use.
touch /etc/dhcpd.leases
You don't need to put anything into this file. The dhcpd daemon dynamically puts information here about the computers that are getting their IP addresses from DHCP. Those addresses are called leases.
dhcpd server:
/sbin/service dhcp start#starts the service now
/sbin/chkconfig dhcpd on#makes sure it starts next time
Your dhcpd server is now ready for client computers to get their IP addresses and routing information.
You can use Main Menu > System Settings > Network, highlight and edit the network device, and click "edit" to set it to use DHCP
You can also modify the /etc/sysconfig/network-scripts/ifcfg-eth0 file to make a Linux box look to the dhcpd server for its network configuration. The file should look as follows:
DEVICE=eth0BOOTPROTO=dhcpONBOOT=yes
The next time that you boot your Linux computer, or restart the network, you'll obtain the IP address, netmask, broadcast address, and routing information from the dhcpd server.
NoteIf you manually modify the ifcfg-eth0 file, you don't need to remove the static IP information. By modifying the PROTOCOL parameter to use DHCP, your system will ignore the static information and pick up its parameters dynamically. However, your computer will revert to using the static parameters if the DHCP service is unavailable.
Setting up a Microsoft Windows computer to use DHCP is very simple:
Start--> Control Panel --> Network
Your Windows computer will now obtain its address from the DHCP server on your network. For instance, you can now use your laptop on both your home and work network (if they both use DHCP) without reconfiguring it each time.
For more tips like this refer to http://www.redhat.com/docs/ or the Red Hat Press line of books.