1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# OpenNebula Network Contextualization
MAC=`ifconfig eth0|grep HWaddr|awk '{print $5}'`

for i in `echo $MAC|cut -d: -f3-|tr : ' '`; do
    [ -n "$IP" ] && IP=$IP.
    let c=0x$i
    IP=${IP}$c
done

GATEWAY=`echo $IP|cut -d. -f1-3`.1
                                        
ifconfig eth0 $IP netmask 255.255.255.0 
route add default gw $GATEWAY

# OpenNebula Contetualization
mkdir -p /mnt/context
mount -t iso9660 -o ro /dev/cdrom /mnt/context
    [ -f /mnt/context/init.sh ] && /mnt/context/init.sh
umount /mnt/context