xDSL and Linux: Go Speed Racer!
Configuring IP Addresses

Nicholas M.M. Donovan
Tuesday, January 25, 2000 04:36:29 PM
Typically, the Linux user is able to configure most things from a command
line or script. Often configuration utilities like netconfig on
Slackware 7.0 and LinuxConf in Mandrake 7.0 make such
configuration quite easy and painless.
Using your favorite utility, simply choose your appropriate hostname of your
machine, the network to which it belongs, and any other details required of the
utility. Most utilities will automatically restart the network for you and
allow you to see your assigned IP address by typing :
/sbin/ifconfig
If you are unsure as to what tool to use, consult the HOW-TOs and other
documentation on your system or available in various books.
Security is an issue when dealing with xDSL. If you are the system
administrator and would like to script a simple control mechanism for your
Internet-connected server or workstation, consider and modify to taste the
following script. This script forces a new election of IP address on your
machine, which can add to the security of your machine by making addresses a
little more difficult to pin down.
#!/bin/sh
#
# Name: renet
# Author: Nicholas Donovan <nick@bynari.net)
# Function: resets the IP by bumping a request from DHCPCD
#
# Revisions:
# remove the old information
rm /etc/dhcpc/dhcpcd-eth0.cache - f
rm /etc/dhcpc/dhcpcd-eth0.info - f
# kill the runtime PID reference
rm /var/run/dhcpcd-eth0.pid - f
# request a new IP from server...
echo "making new DHCP request..."
/sbin/dhcpcd
sleep 3
# if changed properly tell it then pipe to log file...
echo "(dhcpcd) IP address changed to $1" | logger
# Display the new IP
clear
echo "Your new DHCP address is:"
/sbin/ifconfig eth0
# End of Script
Simply chmod 744 this script and place it into the
/sbin directory.
As the administrator, you can add this command to your cron jobs that run on
a regular basis and change this IP as often as desired.
Next: Firewall Considerations »