[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-users] ip autoconfig via DIY script
Hello, Do I really need this hack? I have a PV xen 4.1 domU. I want to use IP auto config. In my xm config, I insert ------------------- xm config ---------- ip='10.0.2.5' gateway='10.0.2.2' server='127.0.255.255' netmask='255.255.255.0' hostname='natmin' interface='eth0' dhcp='off' ------------------ snip --------------- None of the kernels I use have CONFIG_IP_PNP however the running domU has proc/cmdline with ip=10.0.2.5:127.0.255.255:10.0.2.2:255.255.255.0:natmin:eth0:off if I have no config for eth0 in /etc/network/interfaces, I can use this script in domU /etc/rc.local to setup the domU network via domU -------------------------- /etc/rc.local -------------- SCM=$(cat /proc/cmdline| grep -Po 'ip.*dhcp') #echo ${#SCM} is len # try dhcp first if [ ${#SCM} -gt 0 ]; then echo launching dhcp dhclient eth0 fi echo trying static SCM=$(cat /proc/cmdline| grep -Po 'ip.*off') # check cmdline for ip autoconfig if [ ${#SCM} -gt 0 ]; then SCM=${SCM#ip\=} SCM=$(echo $SCM | sed 's/:/ /g') #${SCM//\:/\ } j=0 for i in $SCM; do echo $i $j case $j in 0) MIP=$i;; 1) echo ;; 2) MGATE=$i;; 3) MMASK=$i;; 4) MHOST=$i;; 5) MINT=$i;; esac j=$((j+1)) done /sbin/ifconfig -a $MINT $MIP netmask $MMASK up sleep 1 /sbin/route add default gw $MGATE echo $MHOST > /etc/hostname fi sleep 2 wget --spider http://192.168.1.1/favicon.ico?xendomU exit 0 ------------------------- snip ------------ -- Mark _______________________________________________ Xen-users mailing list Xen-users@xxxxxxxxxxxxx http://lists.xen.org/xen-users
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |