[et-mgmt-tools] static ip network snippet
Michael DeHaan
mdehaan at redhat.com
Mon Jul 30 19:35:57 UTC 2007
drew einhorn wrote:
> 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
cobbler system edit --name=foo --ksmeta="eth=eth0 netmask=255.255.255.0
gateway=192.168.1.5"
this will give your template three new variables: $eth, $netmask, and
$gateway
>
> A snippet one liner would be nice.
> --
> Drew Einhorn
> ------------------------------------------------------------------------
>
> _______________________________________________
> et-mgmt-tools mailing list
> et-mgmt-tools at redhat.com
> https://www.redhat.com/mailman/listinfo/et-mgmt-tools
More information about the et-mgmt-tools
mailing list