1.图形界面下可以直接修改,就略去不谈了
2.终端下命令ifconfig;
例如要将本机eth0(单一网卡的话一般是这个)IP设置为192.168.0.2掩码为255.255.255.0
命令为sudo ifconfig eth0 192.168.0.2 netmask=255.255.255.0
然后执行sudo ifdown eth0
接着sudo ifup eth0来重启网络
3.直接修改配置文件,sudo vi /etc/network/interfaces
里面的文件格式为:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
将auto eth0后面的内容按照上面格式改成你要的IP即可,上面显示的是配置为192.168.0.2的情况