Re: dynamic to static ip
On Mon, 2003-06-02 at 05:03, Robert Readman wrote:
> Anyone know of a script to convert existing dhcp clients to static
> addresses, using their currently assigned address for the static IP?
This is ugly, but seems to work:
IFACE='eth0'
echo iface $IFACE inet static
ifconfig $IFACE | grep 'inet addr' | awk '{print $2"\n"$4}' | sed 's/addr:/\taddress /' | sed 's/Mask:/\tnetmask /'
echo -e '\tgateway '`/sbin/route -n | grep $IFACE | grep ^0\\.0\\.0\\.0 | awk '{print $2}'`
-Mark
Reply to: