ubuntu系统中ip地址的配置文件为: /etc/network/interfaces
配置或修改或添加均是在此文件中完成,一个完整的格式如下:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.200.99
netmask 255.255.255.0
gateway 192.168.200.100
auto eth1
auto ath0
iface ath0 inet dhcp
auto wlan0
iface wlan0 inet dhcp
配置文件修改完成重,使用如下命令重起服务即可生效:
sudo /etc/init.d/networking restart
—————————————————
有时在修改完毕后,重起时会报错误:
/etc/network/interfaces:20: misplaced option
ifup: couldn't read interfaces file "/etc/network/interfaces"
大概的错误都为 misplaced option 不能读取配置文件,这类错误,基本是都是由于 interfaces 这个配置文件配置格式错误导致的,并非什么权限问题,导致的不能读取配置,请仔细检查你的配置文件。
同时想说一下,在处理问题的时候,不要把焦点总放在某个位置盯着不放,也许错误根本不在那儿,上下文联系一下,也许就会发现问题所在。
另外,在修改文件时,要养成随时备份的好习惯,一旦修改出错,还可以用备份还原和对比。
转载自 <a href="http://www.yanghengfei.com/archives/285/" title="ubuntu系统如何配置或修改IP地址" rel="bookmark">ubuntu系统如何配置或修改IP地址 | 星外飞客 </a>
我简单说几句