添加虚拟网卡
- 临时添加删除
# 临时添加
ifconfig eth0:0 192.168.10.10 up
# 删除
ifconfig eth0:0 down
- Ubuntu
sudo vim /etc/network/interfaces
# 增加内容
auto eth0:0
iface eth0:0 inet static
address 192.168.10.10
netmask 255.255.255.0
- CentOS
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE=eth0:1
ONBOOT=yes
BOOTPROTO=static
IPADDR=172.16.4.90
NETMASK=255.255.255.0
GATEWAY=172.16.4.254
DNS1=172.16.10.22
DNS2=172.16.10.13