Linux DHCP Configuration
Red Hat and Fedora Linux:
- Start the GUI network administration/configuration tool by typing redhat-config-network (Red Hat 9 and Enterprise 3.0) or system-config-network (Fedora) at a shell prompt.
- Make sure your network interface (typically eth0) is highlighted and click the Edit icon.
- Select the Automatically obtain IP address settings with dhcp radio button.
- Check the Automatically obtain DNS information from provider checkbox.
- Select Save from the File menu and close the window.
Alternately,
- Run ifconfig to identify your network interface (typically eth0).
- Bring down the network interface with ifdown eth0.
- Edit the file /etc/sysconfig/network-scripts/ifcfg-eth0 so that it contains only the following lines for eth0:
DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes
- Bring the network interface back up with ifup eth0.
Debian GNU/Linux
- Run ifconfig to identify your network interface (typically eth0).
- Bring down the network interface with ifdown eth0.
- Edit /etc/network/interfaces so that the only lines for eth0 are:
auto eth0 iface eth0 inet dhcp
- Bring the network interface back up with ifup eth0.
For Ubuntu Linux
To add IP address on eth0 interface
sudo ifconfig eth0 10.0.0.99 netmask 255.255.255.0
ifconfig eth0 (to check eth0)
sudo route add default gw 10.0.0.1 eth0 (to add gateway to eth0 interface)
To verify your default gateway configuration, you can use the route command in the following manner.
route -n
sudo ifup eth0 (to enable the interface eth0)
sudo ifdown eth0 (to disable the interface eth0)