Connecting via DHCP

Connecting via DHCP

I’m a cable modem user. My first provider was TCI. Then it became AT&T. Now, it’s Mediacom. All these changes have occurred without so much as touching the line that runs into my home. It’s obviously an ustable world, this business of providing high-speed Internet access to homes.

Aside from cutting my bandwidth and raising my rates, Mediacom has recently implemented DHCP – the Dynamic Host Configuration Protocol. That’s a ten-dollar phrase for a relatively simple concept; my IP address is regularly changed by Mediacom. Mediacom claims this protocol is more secure for its users and that it allows them to free up IP addresses that aren’t currently in use. To a customer using Linux, though, DHCP can present its own set of problems. If you’ve been moved to DHCP by *your* provider recently, here’s a quick summary of how to set up your machine to utilize this dynamic protocol.

RedHat, Mandrake and Suse provide DHCP clients by default. Configuring your machine to use this protocol is relatively simple in these distributions. First, start your control panel (or YaST2 in Suse). You can do that with the start menu, or by entering control-panel in a terminal window. Next, select “Network Configuration.” Choose “Interfaces.” Select the interface you’re currently using (named in a way that begins with eth). In the edit interface for your device, select “Activate at boot” and “Use DHCP,” or DHCP as the interface configuration protocol. Save and close the window, then restart your network services, as root, with the following command:

    /etc/rc.d/init.d/network restart

In Slackware, you’ll need to download, make and install the dhcpd client. You can find a current version of this package at Psytech.com. Change directories to /usr/local/src and untar-unzip the package. Change directories to the newly untarred subdirectory. Use the make and make install commands to build and install the package. You’ll then need to rename your current rc.inet1 file with:

    cd /etc/rc.d
    mv rc.inet1 rc.inet1.OLD

This renames your curren rc.inet1 file to rc.inet1.OLD. Now, create the following file in the /etc/rc.d directory, naming it rc.inet1:

#!/bin/sh
#
# rc.inet1 This shell script boots up the base INET system.

HOSTNAME=`cat /etc/HOSTNAME`
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo

/usr/sbin/dhcpcd

Reboot, and you’re good to go.

Debian users can find the deb dhcpd package here. After downloading, use the following command to install:

    dpkg -i /location/of/deb/packages/dhcpcd*deb

Restart your network service with the command:

     /etc/init.d/dhcpcd start

With dhcpd installed, your Linux system will be able to connect to the Internet and change you IP address according to your provider’s DHCP server.

Article Written by