# 配置换回lo地址 /sbin/ifconfig lo 127.0.0.1 # 配置以太网eth0地址 /etc/init.d/ifconfig-eth0
#!/bin/sh echo -n Try to bring eth0 interface up......>/dev/ttySAC0 # 检查/etc/目录下是否存在eth0-setting文件,存在的话执行if语句 if [ -f /etc/eth0-setting ] ; then # 读取eth0-setting文件,从而获取IP、Mask、Gateway、DNS、MAC等变量的值 source /etc/eth0-setting # 判断文件/etc/mtab中是否存在从NFS启动的设置 if grep -q " / nfs " /etc/mtab ; then echo -n NFS root ... > /dev/ttySAC0 else # 不是从NFS驱动,配置ip、mask等网络参数 ifconfig eth0 down ifconfig eth0 hw ether $MAC ifconfig eth0 $IP netmask $Mask up route add default gw $Gateway fi # 获取DNS的值并写到文件/etc/resolv.conf中 echo nameserver $DNS > /etc/resolv.conf else # /etc/目录下不存在eth0-setting文件,那么手动配置网络参数 if grep -q " / nfs " /etc/mtab ; then echo -n NFS root ... > /dev/ttySAC0 else /sbin/ifconfig eth0 192.168.1.230 netmask 255.255.255.0 up fi fi echo Done > /dev/ttySAC0
#!/bin/sh echo -n Try to bring eth0 interface up......>/dev/ttySAC0 if grep -q "^/dev/root / nfs " /etc/mtab ; then echo -n NFS root ... > /dev/ttySAC0 else udhcpc -i eth0 fi echo Done > /dev/ttySAC0
原文地址:http://blog.csdn.net/u013686019/article/details/42119433