static ip network snippet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux