FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 03-08-2010, 07:14 AM
Marcus Moeller
 
Default Convert DHCP to static during kickstart

Hi all.

is there an easy way to kickstart a system using DHCP, but then use
the obtained settings to define static network configurations on the
installed system?

Best Regards
Marcus
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 03-08-2010, 07:19 AM
Christoph Maser
 
Default Convert DHCP to static during kickstart

Am Montag, den 08.03.2010, 09:14 +0100 schrieb Marcus Moeller:
> Hi all.
>
> is there an easy way to kickstart a system using DHCP, but then use
> the obtained settings to define static network configurations on the
> installed system?
>
> Best Regards
> Marcus


A simple %post script comes to mind.


financial.com AG

Munich head office/Hauptsitz München: Maria-Probst-Str. 19 | 80939 München | Germany
Frankfurt branch office/Niederlassung Frankfurt: Messeturm | Friedrich-Ebert-Anlage 49 | 60327 Frankfurt | Germany
Management board/Vorstand: Dr. Steffen Boehnert | Dr. Alexis Eisenhofer | Dr. Yann Samson | Matthias Wiederwach
Supervisory board/Aufsichtsrat: Dr. Dr. Ernst zur Linden (chairman/Vorsitzender)
Register court/Handelsregister: Munich – HRB 128 972 | Sales tax ID number/St.Nr.: DE205 370 553
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 03-08-2010, 07:26 AM
Marcus Moeller
 
Default Convert DHCP to static during kickstart

Hi Christoph,

>> is there an easy way to kickstart a system using DHCP, but then use
>> the obtained settings to define static network configurations on the
>> installed system?
>>
>> Best Regards
>> Marcus
>
>
> A simple %post script comes to mind.

And also to this list ?-)

Marcus
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 03-08-2010, 07:54 AM
Marcus Moeller
 
Default Convert DHCP to static during kickstart

2010/3/8 Marcus Moeller <mail@marcus-moeller.de>:
> Hi Christoph,
>
>>> is there an easy way to kickstart a system using DHCP, but then use
>>> the obtained settings to define static network configurations on the
>>> installed system?
>>>
>>> Best Regards
>>> Marcus
>>
>>
>> A simple %post script comes to mind.
>
> And also to this list ?-)

Okay, got one.

KSDEVICE=`LANG=C /sbin/route -n | awk '/^0.0.0.0/ { print $8 }'`
IP=`LANG=C /sbin/ifconfig $KSDEVICE | /bin/awk '/inet/ && !/inet6/
{sub(/addr:/, ""); print $2}'`
HOSTNAME=`LANG=C /usr/bin/host $IP | /bin/awk '{sub(/.$/, ""); print $5}'`
NETMASK=`LANG=C /sbin/ifconfig $KSDEVICE | /bin/awk '/inet/ &&
!/inet6/ {sub(/Mask:/, ""); print $4}'`
NETWORK=`LANG=C /bin/ipcalc $IP -n $NETMASK | /bin/cut -d= -f2`
GATEWAY=`LANG=C echo $NETWORK | awk -F'.' '{print $1"."$2"."$3"."$4+1}'`
HWADDR=`LANG=C /sbin/ifconfig $KSDEVICE | /bin/awk '/HWaddr/ { print $5 }'`

cat << EOF > /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=$HOSTNAME
GATEWAY=$GATEWAY
EOF

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$KSDEVICE
DEVICE=$KSDEVICE
BOOTPROTO=static
IPADDR=$IP
NETMASK=$NETMASK
ONBOOT=yes
HWADDR=$HWADDR
EOF

Best Regards
Marcus
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 03:24 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org