进入到网卡配置目录
cd /etc/netwrok/
vim interfaces
网卡配置信息
source /etc/network/interfaces.d/*.conf
auto lo
iface lo inet loopback
allow-hotplug eth0
auto eth2
allow-hotplug eth2
iface eth2 inet static
address 100.100.100.1
netmask 255.255.0.0
以上配置文件是一个完整的配置文件。添加IP地址,只需要添加以下的配置信息即可。
auto eth2
allow-hotplug eth2
iface eth2 inet static
address 100.100.100.1
netmask 255.255.0.0
添加完IP地址后,重启网卡
sudo service networking restart