neutron基础四(vlan)

简历一个vlan,ping主机ip,并使用tcpdump查看效果

加载内核模块
[root@centos7 ~]# lsmod|grep 8021
[root@centos7 ~]# 
[root@centos7 ~]# 
[root@centos7 ~]# modprobe 8021q
[root@centos7 ~]# lsmod|grep 8021
8021q                  29022  0 
garp                   14384  1 8021q
mrp                    18542  1 8021q


在已有的eth0上添加vlan ,并up起来
[root@centos7 ~]# ip link add link eth0 name eth0.10 type vlan id 10  
[root@centos7 ~]# 
[root@centos7 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 50:50:18:aa:80:17 brd ff:ff:ff:ff:ff:ff
    inet 192.168.139.55/20 brd 192.168.143.255 scope global dynamic eth0
       valid_lft 3494sec preferred_lft 3494sec
    inet6 fe80::5250:18ff:feaa:8017/64 scope link 
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN 
    link/ether 52:54:00:71:94:cc brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
4: virbr0-nic: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500
    link/ether 52:54:00:71:94:cc brd ff:ff:ff:ff:ff:ff
5: veth0@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master mybridge state UP qlen 1000
    link/ether be:ab:06:b0:59:fa brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::bcab:6ff:feb0:59fa/64 scope link 
       valid_lft forever preferred_lft forever
7: mybridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether be:ab:06:b0:59:fa brd ff:ff:ff:ff:ff:ff
    inet 192.168.3.1/29 scope global mybridge
       valid_lft forever preferred_lft forever
    inet6 fe80::bcab:6ff:feb0:59fa/64 scope link 
       valid_lft forever preferred_lft forever
8: eth0.10@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN 
    link/ether 50:50:18:aa:80:17 brd ff:ff:ff:ff:ff:ff
[root@centos7 ~]# ip link set eth0.10 up


从这个vlan ping本机的ip
[root@centos7 ~]# ping -I eth0.10 192.168.139.55
ping: Warning: source address might be selected on device other than eth0.10.
PING 192.168.139.55 (192.168.139.55) from 192.168.139.55 eth0.10: 56(84) bytes of data.
From 192.168.139.55 icmp_seq=1 Destination Host Unreachable
From 192.168.139.55 icmp_seq=2 Destination Host Unreachable
From 192.168.139.55 icmp_seq=3 Destination Host Unreachable
From 192.168.139.55 icmp_seq=4 Destination Host Unreachable


另一个ssh终端查看效果
[root@centos7 ~]# tcpdump -i eth0 -e -v -l|grep vlan
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
02:26:33.602322 50:50:18:aa:80:17 (oui Unknown) > Broadcast, ethertype 802.1Q (0x8100), length 46: vlan 10, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has localhost tell localhost, length 28
02:26:38.604977 50:50:18:aa:80:17 (oui Unknown) > Broadcast, ethertype 802.1Q (0x8100), length 46: vlan 10, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has localhost tell localhost, length 28
02:26:39.607021 50:50:18:aa:80:17 (oui Unknown) > Broadcast, ethertype 802.1Q (0x8100), length 46: vlan 10, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has localhost tell localhost, length 28
02:26:41.604321 50:50:18:aa:80:17 (oui Unknown) > Broadcast, ethertype 802.1Q (0x8100), length 46: vlan 10, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has localhost tell localhost, length 28

猜你喜欢

转载自haoningabc.iteye.com/blog/2272016
今日推荐