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
On Mon, Mar 19, 2012 at 7:54 AM, Mark Pryor <tlviewer@yahoo.com> wrote:> 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''Depends on what you need, really. The "hack" is necessary if you want to store ip address configuration in xen config file. Personally, I think a more elegant solution would be just to setup a DHCP server with static allocation (for example, using freeradius which can store DHCP allocation in a database, or whatever you''re comfortable with), plus some additional iptables rules so that the client can only use that particular IP address. -- Fajar