1.增加vlan

[root@localhost ~]# ip link add link em1 name em1.100 type vlan id 100

[root@localhost ~]# ip link add link em1 name em1.200 type vlan id 200

[root@localhost ~]# ip addr add 192.168.100.1/24 dev em1.100 brd +

[root@localhost ~]# ip addr add 192.168.200.1/24 dev em1.200 brd +

[root@localhost ~]# ip link set em1.100 up

[root@localhost ~]# ip link set em1.200 up

其中em1为dell服务器的网卡接口名称,在em1上增加两个vlan,并设置ip地址,启用两个虚拟接口

2.查看vlan

[root@localhost ~]# ip link show

[root@localhost ~]# ip addr show

3.删除vlan

[root@localhost ~]# ip link delete em1.100 type vlan

[root@localhost ~]# ip link delete em1.200 type vlan

4.开启vlan间路由

只要设置ip_forward为1即可互相通信,


通过iproute2的ip 命令可以取代vconfig,ifconfig,route等原始网络配置命令。