编辑/etc/network/interfaces文件,加入网卡对应的IP退出并保存,最后重新启动网卡接口
#vim /etc/network/interfaces
未编辑时显示:
auto lo
iface lo inet loopback
//加入以下语句
auto eth0
iface eth0 inet static
address 192.168.1.100
etmask 255.255.255.0
gateway 192.168.1.1
:wq //保存并退出。
重新启动网络接口
#/etc/init.d/networking restart
配置好后必须重启网卡接口
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet static
address 192.168.1.100
etmask 255.255.255.0
gateway 192.168.1.1
#如果配置的是无线网络,通常是wlan0,如上面的修改下名字就可以了。