PATH=/bin:/sbin:/usr/local/sbin if [ -f /var/run/rrlogin.pid ] then kill `cat /var/run/rrlogin.pid` rm /var/run/rrlogin.pid fi rrlogin rr_login_name rr_password(Substuting your own login and password.) Now use netcfg to activate the interface. Voila, you should now be connected to the internet.
Note that the changes to /etc/sysconfig/network-scripts/ifdhcpc-done will be silently overwritten if you upgrade the initscripts package, which will probably happen if you upgrade to a later version of Redhat. Also note that you should restrict the file permissions on ifdhcpc-done now that it contains your password.
elif [ "$BOOTPROTO" = dhcp -a "$ISALIAS" = no ]; then echo -n "Using DHCP for ${DEVICE}... " IFNAME=${DEVICE} \ /sbin/dhcpcd -c /etc/sysconfig/network-scripts/ifdhcpc-done ${DEVICE} echo "echo \$$ > /var/run/dhcp-wait-${DEVICE}.pid; exec sleep 30" | sh if [ -f /var/run/dhcp-wait-${DEVICE}.pid ]; then echo "failed." exit 1 else rm -f /var/run/dhcp-wait-${DEVICE}.pid echo "done." IPSETUP=yes fi fiNote that it starts the dhcpcd daemon which runs the script /etc/sysconfig/network-scripts/ifdhcpc-done as soon as it gets the IP address. The daemon runs in the background, so the ifup script continues and puts its PID into a temporary file. It then starts a subprocess that waits up to 30 seconds for itself to be killed by the ifdhcpc-done script. The ifdhcpc-done file contains the following by default:
#!/bin/sh -x SLEEPPIDFILE=/var/run/dhcp-wait-${IFNAME}.pid if [ ! -f $SLEEPPIDFILE ]; then # the parent must have timed out already -- we can't do much about # it now echo "DHCP configured but ifup timed out" #exit 0 fi # get the pid of the process which is waiting for this to complete SLEEPPID=`cat $SLEEPPIDFILE` rm -f $SLEEPPIDFILE kill $SLEEPPID if [ -f /etc/dhcpc/resolv.conf ]; then echo "setting up resolv.conf" >> /tmp/dhcplog cp /etc/dhcpc/resolv.conf /etc fiWe need to Phil Karn's code at the beginning of this script to kill any rrlogin process that is already running and start a new rrlogin process:
PATH=/bin:/sbin:/usr/local/sbin if [ -f /var/run/rrlogin.pid ] then kill `cat /var/run/rrlogin.pid` rm /var/run/rrlogin.pid fi rrlogin rr_login_name rr_passwordThe ifdhcpc-done file belongs to the initscripts package, and it is not a config file - upgrading or re-installing the initscripts package will overwrite your changes silently. Also note that your password is contained in this file, which is installed world readable and considered world readable by the RPM database. Therefore, you should probably update initscripts to version 3.67 first:
rpm -Uvh ftp://ftp.redhat.com/updates/5.1/i386/initscripts-3.67-1.i386.rpm