/etc/sysconfig/network, /etc/sysconfig/network-devices/ifup-eth0, /etc/sysconfig/network-devices/ifdown-eth0, /etc/sysconfig/network-devices/ifconfig.eth0
Note that on this and the following pages, we use eth0 as the example interface. If you want to configure a different (or more than one) interface, simply replace eth0 with the interface you wish to use.
These instructions will convert the configuration files from LFS (a static configuration) to a configuration using the DHCP protocol. Note that static and DHCP-based interfaces can co-exist on a LFS system. To do this, you should only make the alterations to those interfaces which need to support DHCP. All of the instructions on this page are applicable no matter which DHCP client you intend to use.
If the interface you intend to use as your default gateway is going to use DHCP, the first step is to remove the GATEWAY and GATEWAY_IF variables from /etc/sysconfig/network. This will only need to be done once.
cd /etc/sysconfig && cp network network.bak && sed "s/GATEWAY/# GATEWAY/" network.bak > network |
You then need to create scripts which will override the default network scripts and provide DHCP support. These two scripts are generic and so for use with both DHCP clients. First, the ifup-eth0 script:
cat > /etc/sysconfig/network-devices/ifup-eth0 << "EOF" #!/bin/sh source /etc/sysconfig/rc || exit source $rc_functions || exit source $network_devices/ifconfig.eth0 || exit echo "Bringing up the eth0 interface..." modprobe eth0 loadproc $DHCP_PROG $DHCP_START EOF |
Then the ifdown-eth0 script:
cat > /etc/sysconfig/network-devices/ifdown-eth0 << "EOF" #!/bin/sh source /etc/sysconfig/rc || exit source $rc_functions || exit source $network_devices/ifconfig.eth0 || exit echo "Bringing down the eth0 interface..." $DHCP_PROG $DHCP_STOP evaluate_retval EOF |
Finally, we need to make these scripts executable:
chmod 755 /etc/sysconfig/network-devices/ifup-eth0 && chmod 755 /etc/sysconfig/network-devices/ifdown-eth0 |