[et-mgmt-tools] static ip network snippet

drew einhorn drew.einhorn at gmail.com
Mon Jul 30 17:50:59 UTC 2007


I have this in %pre

ETH=`grep DEVICE /tmp/netinfo | cut -d = -f 2`
IP=`ifconfig $ETH | grep "inet " | cut -d : -f 2 | cut -d " " -f 1`
NETMASK=`ifconfig $ETH | grep "inet " | cut -d : -f 4`
GATEWAY=`route | grep default | cut -b 17-32 | cut -d " " -f 1`
HOSTNAME=`grep HOSTNAME /tmp/netinfo | cut -d = -f 2 | cut -d . -f 1`

cat << EOF > /tmp/buildnet
network --device $ETH --bootproto static --ip=$IP --netmask=$NETMASK
--gateway=$GATEWAY --hostname=$HOSTNAME
EOF

That code setting shell variables is really ugly and I had to fix it.

    ipv6 info from ifconfig caused problems,
    and possibly something else I have forgotten

According to the wiki:

    $ip_address and $mac_address are kickstart variables

But I still need values for $ETH, $NETMASK, and $GATEWAY

A snippet one liner would be nice.
--
Drew Einhorn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/et-mgmt-tools/attachments/20070730/e8697a8c/attachment.htm>


More information about the et-mgmt-tools mailing list