第一种方案
ping -w 2 60.0.0.1 || ifconfig eth0 122.13.72.118 netmask 255.255.255.240 up;route add default gw 122.13.72.113;ifconfig eth0:0 183.57.77.198 netmask 255.255.255.240 up ;ifconfig eth0:1 183.232.72.185 netmask 255.255.255.240 up
第二种方案
#!/bin/bash
ping -w 5 60.0.0.1
if (( $?==0 ));then #如果ping的状态码返回的结果是0也就是成功的就退出脚本否则就执行手动配置IP和网关
exit 0
else
ifconfig eth0 192.168.1.2 netmask 255.255.255.0 up
route add default gw 192.168.1.1
fi
大神看看哪里有错误呢?
ping -w 2 60.0.0.1 || ifconfig eth0 122.13.72.118 netmask 255.255.255.240 up;route add default gw 122.13.72.113;ifconfig eth0:0 183.57.77.198 netmask 255.255.255.240 up ;ifconfig eth0:1 183.232.72.185 netmask 255.255.255.240 up
第二种方案
#!/bin/bash
ping -w 5 60.0.0.1
if (( $?==0 ));then #如果ping的状态码返回的结果是0也就是成功的就退出脚本否则就执行手动配置IP和网关
exit 0
else
ifconfig eth0 192.168.1.2 netmask 255.255.255.0 up
route add default gw 192.168.1.1
fi
大神看看哪里有错误呢?