neutron基础四(vlan)

20 篇文章 0 订阅
简历一个vlan,ping主机ip,并使用tcpdump查看效果

加载内核模块
[code="java"]
# lsmod|grep 8021
#
#
# modprobe 8021q
# lsmod|grep 8021
8021q 29022 0
garp 14384 1 8021q
mrp 18542 1 8021q
[/code]

在已有的eth0上添加vlan ,并up起来
[code="java"]
# ip link add link eth0 name eth0.10 type vlan id 10
#
# 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
# ip link set eth0.10 up
[/code]

从这个vlan ping本机的ip
[code="java"]# 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[/code]

另一个ssh终端查看效果
[code="java"]
# 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
[/code]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值