修改/etc/network/interfaces文件中网卡eth0的IP为静态IP的问题:
要将下面的行:
iface eth0 inet dhcp
iface eth1 inet dhcp
修改为:
iface eth0 inet static
address 192.168.1.45
netmask 255.255.255.0
gateway 192.168.1.1
iface eth1 inet dhcp
ipAddress="192.168.1.45"
netMask="255.255.255.0"
gateWay="192.168.1.1"
sed -e "/^iface eth0 inet dhcp/, /^iface eth1/!b" -e "/^iface eth0 inet dhcp/ s/dhcp/static/" -e "/^iface eth0 inet/a \\\taddress ${ipAddress}\n\tnetmask ${netMask}\n\tgateway ${gateWay}\n" /etc/network/interfaces
为什么替换命令a后面接着的\t要加另外两个\, \\\taddress , "address 192.168.1.45"这一行的前面才能加一个TAB, 如果address前加\t,或者\\t都不行
--
修改:mykeyboard FROM 113.116.128.*
FROM 113.116.128.*