3 #dhclient a ip from dhcp server
4 #if give a parameter 'fix', I will fix eth0 ip to 172.21.5.133
10 sudo killall
-9 dhcpcd
1>/dev
/null
2>&1
12 #if [ "$isfixip" != "fix" ]; then
13 sudo killall
-9 dhclient
15 echo "--------------------"
16 if [ "$?" = "0" ]; then
17 echo "get ip from dhcp server success"
19 echo "occur err when get ip for $IFACE"
22 if [ -x /etc
/init.d
/xinetd
]; then
23 /etc
/init.d
/xinetd restart
27 if [ "$isfixip" = "fix" ]; then
29 sudo ifconfig
$IFACE $FIXIP
30 sudo ifconfig
$IFACE down
31 sudo ifconfig
$IFACE up
33 if [ "$?" = "0" ]; then
34 echo "arrow:you have fix ip($FIXIP) success -_-"
36 echo "arrow:check fix ip correct ?"
38 echo "--------------------"
40 sudo
/etc
/rc.d
/rc.inet1 restart
41 #if [ -x /etc/init.d/xinetd ]; then
42 #/etc/init.d/xinetd restart
44 sudo
/etc
/rc.d
/rc.inet2 restart
46 echo "DONE success dynamic ip"
47 sudo killall
-9 dhcpcd
1>/dev
/null
2>&1
50 sudo killall
-9 dhclient