1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | <scripts> <init-scripts config:type="list"> <listentry> <filename>network_setup</filename> <interpreter>shell</interpreter> <source><![CDATA[#!/bin/bash ### Disable ipv6 echo 'install ipv6 /bin/true' >> /etc/modprobe.conf.local ### Variables to Calculate Network Configuration Settings for a static configuration ### ACTIVE_INTERFACE=`/sbin/ifconfig | grep eth | awk '{print $1}'` IP_ADDRESS=`/sbin/ifconfig $ACTIVE_INTERFACE | grep 'inet addr' | awk '{print $2}' | sed 's/addr://'` NETMASK=`/sbin/ifconfig $ACTIVE_INTERFACE | grep 'inet addr' | awk '{print $4}' | sed 's/Mask://'` BROADCAST=`/sbin/ifconfig $ACTIVE_INTERFACE | grep Bcast: | awk '{ print $3 }' | sed 's/Bcast://'` NETWORK=`/sbin/ip route list | grep $IP_ADDRESS | awk '{ print $1 }' | sed 's/\/[1-9][1-9]//'` GATEWAY=`/sbin/route | grep default | awk '{print $2}'` HOSTNAME=`/usr/bin/host $IP_ADDRESS | awk '{print $5}' | sed '$s/.$//'` ### Setup HOSTNAME echo "$HOSTNAME" > /etc/HOSTNAME ### Setup Gateway Address echo "default $GATEWAY - -" > /etc/sysconfig/network/routes ### Setup /etc/hosts with correct host information HOST=`/usr/bin/host $IP_ADDRESS | awk '{print $5}' | sed '$s/.$//' | cut -d "." -f 1` echo "$IP_ADDRESS $HOSTNAME $HOST" >> /etc/hosts ### Network configuration file rewrite for static configuration INT_CONF_FILE=/etc/sysconfig/network/ifcfg-eth-id-`ifconfig eth0 | grep HWaddr | awk '{ print $5 }' | perl -ne '$var=$_; print lc($var)'` echo 'DEVICE=eth0' > $INT_CONF_FILE echo 'BOOTPROTO=static' >> $INT_CONF_FILE echo "IPADDR=$IP_ADDRESS" >> $INT_CONF_FILE echo "NETMASK=$NETMASK" >> $INT_CONF_FILE echo "BROADCAST=$BROADCAST" >> $INT_CONF_FILE echo "NETWORK=$NETWORK" >> $INT_CONF_FILE echo 'STARTMODE=onboot' >> $INT_CONF_FILE echo 'TYPE=Ethernet' >> $INT_CONF_FILE ### Restart Network /etc/init.d/network restart ]]></source> </listentry> </init-scripts> </scripts> |
1 2 3 4 5 6 7 8 9 10 11 12 | ddns-update-style ad-hoc; allow bootp; subnet 0.0.0.0 netmask 0.0.0.0 { host rcc-hny-poc-003 { option host-name "myserver.cloud9.ibm.com"; fixed-address 192.168.0.203; hardware ethernet 16:E9:10:94:87:03; filename "inst64"; } next-server 192.168.0.201; option routers 192.168.0.201; } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |