确保当前拥有root权限
ifconfig -a 先用此命令查看网卡名
打开网卡配置 vi /etc/network/interfaces
---------------------------------------------------
eth0为我测试机器的默认网卡名。不同机器可能有不懂,自己用上方的命令查看
auto eth0
iface eth0 inet static
address 1.1.1.1
netmask 255.255.255.0
---------这行虚线之间的是双IP配置---单IP忽略-------
auto eth0:1
iface eth0:1 inet static
address 1.1.1.2
netmask 255.255.255.0
---------这行虚线之间的是双IP配置---单IP忽略--------
gateway 1.1.1.254
配置DNS地址
vi /etc/resolvconf/resolv.conf.d/head
--------------------------------------------
nameserver 192.168.23.1