After playing with the autoyast process, I think I figured out how-to
convert from dhcp to static IP on a installed system.
It's not pretty, but it works. :) Please keep in mind I just started
playing with autoyast a couple of weeks ago.
This is what I have in the networking section of the control file:
<networking>
<allowed config:type="list">
@lab_nis(rw,sync)
</allowed>
<mountpoint>/local</mountpoint>
true
<dns>
true
true
</dns>
<interfaces config:type="list">
<interface>
<bootproto>dhcp</bootproto>
<device>eth0</device>
<startmode>onboot</startmode>
</interface>
</interfaces>
<modules config:type="list">
</modules>
<routing>
false
</routing>
</networking>
Then I have the following in the post-scripts section:
<script>
<debug config:type="boolean">false</debug>
<feedback config:type="boolean">false</feedback>
<filename>staticIP</filename>
<interpreter>shell</interpreter>
<location></location>
false
<source><![CDATA[#!/bin/bash
GW=`netstat -rn | tail -1 | awk '{ print $2 }'`
SM=`ifconfig | grep Mask | head -1 | awk '{ print $4 }' | sed
's/Mask://g'`
IP=`ifconfig | grep "inet addr" | head -1 | awk '{ print $2 }' | sed
's/addr://g'`
MAC=`ifconfig | grep HWaddr | awk '{ print $5 }'`
FQDN=`host $IP | awk '{ print $5 }' | sed 's/.$//g'`
DOMAIN=`host $IP | awk '{ print $5 }' | sed 's/.$//g' | awk -F"." '{
print $2"."$3"."$4 }'`
CLIENT=`host $IP | awk '{ print $5 }' | awk -F"." '{ print $1 }'`
rm -rf /etc/sysconfig/network/routes
cat > /etc/sysconfig/network/routes <<-GATEWAY
default $GW - -
GATEWAY
rm -rf /etc/sysconfig/network/ifcfg-eth-id-*
cat > /etc/sysconfig/network/ifcfg-eth-id-$MAC <<-IFCFG_FILE
BOOTPROTO='static'
STARTMODE='onboot'
IPADDR='$IP'
NETMASK='$SM'
_type='eth'
IFCFG_FILE
rm -rf /etc/hosts
cat > /etc/hosts <<-HOSTS_FILE
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
$IP $CLIENT.$DOMAIN $CLIENT
127.0.0.1 localhost
HOSTS_FILE
rm -rf /etc/resolv.conf
cat > /etc/resolv.conf <<-RESOLV_FILE
domain $DOMAIN
nameserver xx.xx.xx.xx # resolver1
nameserver xx.xx.xx.xx # resolver2
RESOLV_FILE
rm -rf /etc/HOSTNAME
cat > /etc/HOSTNAME <<-HOST
$CLIENT.$DOMAIN
HOST
hostname $CLIENT
/etc/init.d/network restart
]]></source>
</script>
</post-scripts>
</scripts>
--
Rick King
-----Original Message-----
From: King, Richard
Sent: Friday, May 04, 2007 10:42 AM
To: opensuse-autoinstall@opensuse.org
Subject: [opensuse-autoinstall] SuSE 10.1 + Converting from dhcp to
static IP
***Sending Message again, first message didn't seem to go through***
SuSE Version: 10.1
Install Method: PXEBOOT/DHCP
Hello Everyone!
I was wondering if anyone had any suggestions on how-to convert from
dhcp-boot to static IP during the autoyast install?
Questions:
1) Should converting from dhcp-boot to static IP take place during
pre-scripts, or post-scripts?
2) When the install is initiated with dhcp, what file holds the
network/dhcp information during the install process?
3) Would it be practical to use commands such as ifconfig and netstat to
get the network information, and write to the
/etc/sysconfig/network/ifcfg-eth-id-$MAC and
/etc/sysconfig/network/routes files?
Observations:
I have noticed if a client is using dhcp, the package "NetworkManager"
is installed, and will manage the network settings for eth0. However, if
a client is using dhcp/NetworkManager, the NTP & NIS services will fail
to start during bootup. If I manually change the network settings to
static, NTP & NIS will start during bootup.
Any help with this would be greatly appreciated.
My best to you
--
Rick King
This is what I have in the network section of my control file.
<networking>
<allowed config:type="list">
@lab_nis(rw,sync)
</allowed>
<mountpoint>/local</mountpoint>
true
AUTO
<dns>
true
true
<hostname>AUTO</hostname>
</dns>
<interfaces config:type="list">
<interface>
<bootproto>dhcp</bootproto>
<device>eth0</device>
<startmode>onboot</startmode>
</interface>
</interfaces>
<modules config:type="list">
</modules>
<routing>
false
</routing>
</networking>
--
To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
--
To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org