1 修改网卡配置文件
$ vi /etc/network/interfaces
输入如下内容,注意enp2s0为网卡名,可以通过ifconfig查看网卡名称:
auto lo
iface lo inet loopback
#ip config
auto enp2s0
iface enp2s0 inet static
address 192.168.105.55
netmask 255.255.255.0
gateway 192.168.105.254
dns-nameserver 202.96.209.5
2.重启网卡服务,输入如下指令,不行则重启电脑
/etc/init.d/networking restart