当前位置:网站首页>LCP插件创建对等802.1ad接口
LCP插件创建对等802.1ad接口
2022-07-25 05:15:00 【redwingz】
首先,在VPP中创建物理接口GigabitEthernet8/0/0的802.1ad子接口,VLAN ID指定为2345。
vpp# create sub GigabitEthernet8/0/0 2345 dot1ad 2345 exact-match
GigabitEthernet8/0/0.2345
将802.1ad子接口设置为UP状态,MTU设置为9000,802.1ad子接口的IP地址设置为40.0.1.1。
vpp# set interface state GigabitEthernet8/0/0.2345 up
vpp# set interface mtu packet 9000 GigabitEthernet8/0/0.2345
vpp# set interface ip address GigabitEthernet8/0/0.2345 40.0.1.1/24
LCP对等接口
LCP创建802.1ad子接口的对等接口。前提是已经创建了物理接口GigabitEthernet8/0/0的对等接口e8。
vpp# lcp create GigabitEthernet8/0/0.2345 host-if e8.2345
vpp#
vpp# show interface
Name Idx State MTU (L3/IP4/IP6/MPLS) Counter Count
GigabitEthernet8/0/0 11 up 1500/0/0/0 rx packets 1035
GigabitEthernet8/0/0.2345 19 up 9000/0/0/0
以上操作LCP在内核中创建了对等接口e8.2345,如下所示。
# ip -d link show type vlan
24: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 00:60:e0:6f:5a:f1 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535
vlan protocol 802.1ad id 2345 <REORDER_HDR> addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
设置linux中对等接口e8.2345的地址,与VPP接口GigabitEthernet8/0/0.2345地址相同。
# ip link set e8.2345 up mtu 9000
# ip addr add 40.0.1.1/24 dev e8.2345
连通性测试
在外部主机配置802.1ad接口,配置接口IP地址40.0.1.2。
# ip link add link ens33 name ens33.2345 type vlan id 2345 proto 802.1ad
# ip link set ens33.2345 up mtu 9000
# ip address add 40.0.1.2/30 dev ens33.2345
# ip link set ens33.2345 up
#
# ip -d link show type vlan
46: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 00:60:e0:68:9f:ee brd ff:ff:ff:ff:ff:ff promiscuity 0
vlan protocol 802.1ad id 2345 <REORDER_HDR> addrgenmode eui64 numtxqueues 1 numrxqueues 1
在VPP主机linux中ping以上外部主机的802.1ad接口地址40.0.1.2。
# ping 40.0.1.2
PING 40.0.1.2 (40.0.1.2) 56(84) bytes of data.
64 bytes from 40.0.1.2: icmp_seq=1 ttl=64 time=0.280 ms
如下为主机40.0.1.2回复的ICMP报文。
vpp# trace add dpdk-input 100
vpp# show trace
------------------- Start of thread 1 vpp_wk_0 -------------------
Packet 1
06:31:10:942744: dpdk-input
GigabitEthernet8/0/0 rx queue 0
buffer 0x877c1: current data 0, length 102, buffer-pool 0, ref-count 1, trace handle 0x1000000
ext-hdr-valid
PKT MBUF: port 10, nb_segs 1, pkt_len 102
buf_len 2176, data_len 102, ol_flags 0x180, data_off 128, phys_addr 0x8efdf0c0
packet_type 0x0 l2_len 0 l3_len 0 outer_l2_len 0 outer_l3_len 0
rss 0x0 fdir.hi 0x0 fdir.lo 0x0
Packet Offload Flags
PKT_RX_IP_CKSUM_GOOD (0x0080) IP cksum of RX pkt. is valid
PKT_RX_IP_CKSUM_NONE (0x0090) no IP cksum of RX pkt.
PKT_RX_L4_CKSUM_GOOD (0x0100) L4 cksum of RX pkt. is valid
PKT_RX_L4_CKSUM_NONE (0x0108) no L4 cksum of RX pkt.
IP4: 00:60:e0:68:9f:ee -> 00:60:e0:6f:5a:f1 802.1ad vlan 2345
ICMP: 40.0.1.2 -> 40.0.1.1
tos 0x00, ttl 64, length 84, checksum 0x2e4f dscp CS0 ecn NON_ECN
fragment id 0xfa57
ICMP echo_request checksum 0x5819 id 4352
06:31:10:942748: ethernet-input
frame: flags 0x3, hw-if-index 11, sw-if-index 11
IP4: 00:60:e0:68:9f:ee -> 00:60:e0:6f:5a:f1 802.1ad vlan 2345
06:31:10:942749: ip4-input
ICMP: 40.0.1.2 -> 40.0.1.1
tos 0x00, ttl 64, length 84, checksum 0x2e4f dscp CS0 ecn NON_ECN
fragment id 0xfa57
ICMP echo_request checksum 0x5819 id 4352
06:31:10:942750: ip4-lookup
fib 0 dpo-idx 9 flow hash: 0x00000000
ICMP: 40.0.1.2 -> 40.0.1.1
tos 0x00, ttl 64, length 84, checksum 0x2e4f dscp CS0 ecn NON_ECN
fragment id 0xfa57
ICMP echo_request checksum 0x5819 id 4352
06:31:10:942751: ip4-receive
ICMP: 40.0.1.2 -> 40.0.1.1
tos 0x00, ttl 64, length 84, checksum 0x2e4f dscp CS0 ecn NON_ECN
fragment id 0xfa57
ICMP echo_request checksum 0x5819 id 4352
06:31:10:942751: ip4-icmp-input
ICMP: 40.0.1.2 -> 40.0.1.1
tos 0x00, ttl 64, length 84, checksum 0x2e4f dscp CS0 ecn NON_ECN
fragment id 0xfa57
ICMP echo_request checksum 0x5819 id 4352
06:31:10:942751: ip4-icmp-echo-request
ICMP: 40.0.1.2 -> 40.0.1.1
tos 0x00, ttl 64, length 84, checksum 0x2e4f dscp CS0 ecn NON_ECN
fragment id 0xfa57
ICMP echo_request checksum 0x5819 id 4352
06:31:10:942752: ip4-load-balance
fib 0 dpo-idx 15 flow hash: 0x00000000
ICMP: 40.0.1.1 -> 40.0.1.2
tos 0x00, ttl 64, length 84, checksum 0x0cda dscp CS0 ecn NON_ECN
fragment id 0x1bcd
ICMP echo_reply checksum 0x6019 id 4352
06:31:10:942752: ip4-rewrite
tx_sw_if_index 19 dpo-idx 15 : ipv4 via 40.0.1.2 GigabitEthernet8/0/0.2345: mtu:9000 next:6 flags:[] 0060e0689fee0060e06f5af188a809290800 flow hash: 0x00000000
00000000: 0060e0689fee0060e06f5af188a809290800450000541bcd000040010cda2800
00000020: 01012800010200006019110020004aae664900000000b9ee04000000
06:31:10:942753: GigabitEthernet8/0/0-output
GigabitEthernet8/0/0.2345
IP4: 00:60:e0:6f:5a:f1 -> 00:60:e0:68:9f:ee 802.1ad vlan 2345
ICMP: 40.0.1.1 -> 40.0.1.2
tos 0x00, ttl 64, length 84, checksum 0x0cda dscp CS0 ecn NON_ECN
fragment id 0x1bcd
ICMP echo_reply checksum 0x6019 id 4352
06:31:10:942753: GigabitEthernet8/0/0-tx
GigabitEthernet8/0/0 tx queue 1
buffer 0x877c1: current data 0, length 102, buffer-pool 0, ref-count 1, trace handle 0x1000000
ext-hdr-valid
vlan-1-deep local l2-hdr-offset 0 l3-hdr-offset 18
PKT MBUF: port 10, nb_segs 1, pkt_len 102
buf_len 2176, data_len 102, ol_flags 0x180, data_off 128, phys_addr 0x8efdf0c0
packet_type 0x0 l2_len 0 l3_len 0 outer_l2_len 0 outer_l3_len 0
rss 0x0 fdir.hi 0x0 fdir.lo 0x0
Packet Offload Flags
PKT_RX_IP_CKSUM_GOOD (0x0080) IP cksum of RX pkt. is valid
PKT_RX_IP_CKSUM_NONE (0x0090) no IP cksum of RX pkt.
PKT_RX_L4_CKSUM_GOOD (0x0100) L4 cksum of RX pkt. is valid
PKT_RX_L4_CKSUM_NONE (0x0108) no L4 cksum of RX pkt.
IP4: 00:60:e0:6f:5a:f1 -> 00:60:e0:68:9f:ee 802.1ad vlan 2345
ICMP: 40.0.1.1 -> 40.0.1.2
tos 0x00, ttl 64, length 84, checksum 0x0cda dscp CS0 ecn NON_ECN
fragment id 0x1bcd
ICMP echo_reply checksum 0x6019 id 4352
在外部主机抓取报文,如下,以太网类型为802.1ad类型0x88a8,vlan id值为2345。
# tcpdump -i ens33 -env
tcpdump: listening on ens33, link-type EN10MB (Ethernet), capture size 262144 bytes
09:55:47.921391 00:60:e0:68:9f:ee > 00:60:e0:6f:5a:f1,
ethertype 802.1Q-QinQ (0x88a8), length 102: vlan 2345, p 0,
ethertype IPv4, (tos 0x0, ttl 64, id 1147, offset 0, flags [none], proto ICMP (1), length 84)
40.0.1.2 > 40.0.1.1: ICMP echo request, id 4608, seq 0, length 64
09:55:47.921461 00:60:e0:6f:5a:f1 > 00:60:e0:68:9f:ee,
ethertype 802.1Q (0x8100), length 102: vlan 2345, p 0,
ethertype IPv4, (tos 0x0, ttl 64, id 50901, offset 0, flags [none], proto ICMP (1), length 84)
40.0.1.1 > 40.0.1.2: ICMP echo reply, id 4608, seq 0, length 64
配置802.1.ad QinQ接口
如下在VPP中配置QinQ接口,内部协议802.1q,VLAN id为1000,外部ID为2345,配置接口IP地址50.0.1.1。
vpp# create sub GigabitEthernet8/0/0 1237 dot1ad 2345 inner-dot1q 1000 exact-match
GigabitEthernet8/0/0.1237
vpp#
vpp# set interface state GigabitEthernet8/0/0.1237 up
vpp# set interface mtu packet 9000 GigabitEthernet8/0/0.1237
vpp# set interface ip address GigabitEthernet8/0/0.1237 50.0.1.1/24
LCP创建对等接口e8.1237。
vpp# lcp create GigabitEthernet8/0/0.1237 host-if e8.1237
vpp#
vpp# show lcp
lcp lcp-auto-subint off
lcp lcp-sync on
itf-pair: [0] GigabitEthernet7/0/0 tap10 e7 18 type tap
itf-pair: [1] GigabitEthernet8/0/0 tap11 e8 19 type tap
itf-pair: [2] GigabitEthernet8/0/0.2345 tap11.2345 e8.2345 24 type tap
itf-pair: [3] GigabitEthernet8/0/0.1237 tap11.1237 e8.1237 25 type tap
将Linux对等接口e8.1237地址设置为50.0.1.1。
# ip address add 50.0.1.1/24 dev e8.1237
#
# ip -d address show type vlan
24: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:60:e0:6f:5a:f1 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535
vlan protocol 802.1ad id 2345 <REORDER_HDR> numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
inet 40.0.1.1/30 scope global e8.2345
25: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:60:e0:6f:5a:f1 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535
vlan protocol 802.1Q id 1000 <REORDER_HDR> numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
inet 50.0.1.1/24 scope global e8.1237
外部主机QinQ配置
外部Ubuntu主机配置。创建内层802.1Q子接口,配置IP地址50.0.1.2。
# ip link add link ens33.2345 name ens33.2347 type vlan id 1000 proto 802.1q
#
# ip address add 50.0.1.2/24 dev ens33.2347
# ip link set ens33.2347 up
#
# ip address show type vlan
46: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:60:e0:68:9f:ee brd ff:ff:ff:ff:ff:ff
inet 40.0.1.2/30 scope global ens33.2345
47: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:60:e0:68:9f:ee brd ff:ff:ff:ff:ff:ff
inet 50.0.1.2/24 scope global ens33.2347
QinQ连通性测试
报文外层QinQ类型0x88a8,vlan id为2345;报文内层802.1Q类型0x8100,vlan id为1000。在外部主机抓取报文如下:
# tcpdump -i ens33 -env
tcpdump: listening on ens33, link-type EN10MB (Ethernet), capture size 262144 bytes
10:36:56.991886 00:60:e0:68:9f:ee > 00:60:e0:6f:5a:f1,
ethertype 802.1Q-QinQ (0x88a8), length 106: vlan 2345, p 0, ethertype 802.1Q, vlan 1000, p 0,
ethertype IPv4, (tos 0x0, ttl 64, id 17581, offset 0, flags [none], proto ICMP (1), length 84)
50.0.1.2 > 50.0.1.1: ICMP echo request, id 5632, seq 0, length 64
10:36:56.991968 00:60:e0:6f:5a:f1 > 00:60:e0:68:9f:ee,
ethertype 802.1Q (0x8100), length 106: vlan 2345, p 0, ethertype 802.1Q, vlan 1000, p 0,
ethertype IPv4, (tos 0x0, ttl 64, id 61447, offset 0, flags [none], proto ICMP (1), length 84)
50.0.1.1 > 50.0.1.2: ICMP echo reply, id 5632, seq 0, length 64
如下为外部主机50.0.1.2回复的ICMP报文。
vpp# trace add dpdk-input 100
vpp#
vpp#
vpp# show trace
------------------- Start of thread 1 vpp_wk_0 -------------------
Packet 1
07:19:50:500241: dpdk-input
GigabitEthernet8/0/0 rx queue 0
buffer 0x87aa6: current data 0, length 106, buffer-pool 0, ref-count 1, trace handle 0x1000000
ext-hdr-valid
PKT MBUF: port 10, nb_segs 1, pkt_len 106
buf_len 2176, data_len 106, ol_flags 0x180, data_off 128, phys_addr 0x8efeaa00
packet_type 0x0 l2_len 0 l3_len 0 outer_l2_len 0 outer_l3_len 0
rss 0x0 fdir.hi 0x0 fdir.lo 0x0
Packet Offload Flags
PKT_RX_IP_CKSUM_GOOD (0x0080) IP cksum of RX pkt. is valid
PKT_RX_IP_CKSUM_NONE (0x0090) no IP cksum of RX pkt.
PKT_RX_L4_CKSUM_GOOD (0x0100) L4 cksum of RX pkt. is valid
PKT_RX_L4_CKSUM_NONE (0x0108) no L4 cksum of RX pkt.
IP4: 00:60:e0:68:9f:ee -> 00:60:e0:6f:5a:f1 802.1ad vlan 2345 802.1ad vlan 1000
ICMP: 50.0.1.2 -> 50.0.1.1
tos 0x00, ttl 64, length 84, checksum 0x9eff dscp CS0 ecn NON_ECN
fragment id 0x75a7
ICMP echo_request checksum 0xa766 id 5888
07:19:50:500247: ethernet-input
frame: flags 0x3, hw-if-index 11, sw-if-index 11
IP4: 00:60:e0:68:9f:ee -> 00:60:e0:6f:5a:f1 802.1ad vlan 2345 802.1ad vlan 1000
07:19:50:500252: ip4-input
ICMP: 50.0.1.2 -> 50.0.1.1
tos 0x00, ttl 64, length 84, checksum 0x9eff dscp CS0 ecn NON_ECN
fragment id 0x75a7
ICMP echo_request checksum 0xa766 id 5888
07:19:50:500253: ip4-lookup
fib 0 dpo-idx 8 flow hash: 0x00000000
ICMP: 50.0.1.2 -> 50.0.1.1
tos 0x00, ttl 64, length 84, checksum 0x9eff dscp CS0 ecn NON_ECN
fragment id 0x75a7
ICMP echo_request checksum 0xa766 id 5888
07:19:50:500255: ip4-receive
ICMP: 50.0.1.2 -> 50.0.1.1
tos 0x00, ttl 64, length 84, checksum 0x9eff dscp CS0 ecn NON_ECN
fragment id 0x75a7
ICMP echo_request checksum 0xa766 id 5888
07:19:50:500256: ip4-icmp-input
ICMP: 50.0.1.2 -> 50.0.1.1
tos 0x00, ttl 64, length 84, checksum 0x9eff dscp CS0 ecn NON_ECN
fragment id 0x75a7
ICMP echo_request checksum 0xa766 id 5888
07:19:50:500256: ip4-icmp-echo-request
ICMP: 50.0.1.2 -> 50.0.1.1
tos 0x00, ttl 64, length 84, checksum 0x9eff dscp CS0 ecn NON_ECN
fragment id 0x75a7
ICMP echo_request checksum 0xa766 id 5888
07:19:50:500257: ip4-load-balance
fib 0 dpo-idx 14 flow hash: 0x00000000
ICMP: 50.0.1.1 -> 50.0.1.2
tos 0x00, ttl 64, length 84, checksum 0x1523 dscp CS0 ecn NON_ECN
fragment id 0xff83
ICMP echo_reply checksum 0xaf66 id 5888
07:19:50:500258: ip4-rewrite
tx_sw_if_index 21 dpo-idx 14 : ipv4 via 50.0.1.2 GigabitEthernet8/0/0.1237: mtu:9000 next:6 flags:[] 0060e0689fee0060e06f5af188a80929810003e80800 flow hash: 0x00000000
00000000: 0060e0689fee0060e06f5af188a80929810003e8080045000054ff8300004001
00000020: 152332000101320001020000af6617000000b1b96649000000001496
07:19:50:500260: GigabitEthernet8/0/0-output
GigabitEthernet8/0/0.1237
IP4: 00:60:e0:6f:5a:f1 -> 00:60:e0:68:9f:ee 802.1ad vlan 2345 802.1ad vlan 1000
ICMP: 50.0.1.1 -> 50.0.1.2
tos 0x00, ttl 64, length 84, checksum 0x1523 dscp CS0 ecn NON_ECN
fragment id 0xff83
ICMP echo_reply checksum 0xaf66 id 5888
07:19:50:500261: GigabitEthernet8/0/0-tx
GigabitEthernet8/0/0 tx queue 1
buffer 0x87aa6: current data 0, length 106, buffer-pool 0, ref-count 1, trace handle 0x1000000
ext-hdr-valid
vlan-2-deep local l2-hdr-offset 0 l3-hdr-offset 22
PKT MBUF: port 10, nb_segs 1, pkt_len 106
buf_len 2176, data_len 106, ol_flags 0x180, data_off 128, phys_addr 0x8efeaa00
packet_type 0x0 l2_len 0 l3_len 0 outer_l2_len 0 outer_l3_len 0
rss 0x0 fdir.hi 0x0 fdir.lo 0x0
Packet Offload Flags
PKT_RX_IP_CKSUM_GOOD (0x0080) IP cksum of RX pkt. is valid
PKT_RX_IP_CKSUM_NONE (0x0090) no IP cksum of RX pkt.
PKT_RX_L4_CKSUM_GOOD (0x0100) L4 cksum of RX pkt. is valid
PKT_RX_L4_CKSUM_NONE (0x0108) no L4 cksum of RX pkt.
IP4: 00:60:e0:6f:5a:f1 -> 00:60:e0:68:9f:ee 802.1ad vlan 2345 802.1ad vlan 1000
ICMP: 50.0.1.1 -> 50.0.1.2
tos 0x00, ttl 64, length 84, checksum 0x1523 dscp CS0 ecn NON_ECN
fragment id 0xff83
ICMP echo_reply checksum 0xaf66 id 5888
边栏推荐
- 学习记录[email protected]研发效能度量指标
- Render Optimization: repaint and reflow
- STM32 Development Notes 119: what macros are required to enable FPU?
- DOM processing in ahooks
- Openworm project compilation
- Valley p2420 let's XOR solution
- ping命令
- [wechat applet] design and interactive implementation of auction product details page (including countdown and real-time update of bids)
- Androd releases jitpack open source project (gradle7.2)
- 基环树入门
猜你喜欢
![2022-07-24:以下go语言代码输出什么?A:[]int{};B:[]int(nil);C:panic;D:编译错误。 package main import ( “fmt“ ) f](/img/bf/e38a8fd813f88a83f61a1abfa3b95d.png)
2022-07-24:以下go语言代码输出什么?A:[]int{};B:[]int(nil);C:panic;D:编译错误。 package main import ( “fmt“ ) f

85 distributed project construction

Gradle test and idea test

This low code reporting tool is needed for data analysis

Introduction to kubernetes

推荐系统-协同过滤在Spark中的实现

epoll的实现原理

"Niuke | daily question" inverse Polish expression

Summary and Prospect of aut, the transport layer protocol of sound network -- dev for dev column
Set up private CA server
随机推荐
I have seven schemes to realize web real-time message push, seven!
deep报错
项目管理工具——项目开发者工具
Add transition layer to JS page
Luogu p4281 [ahoi2008] emergency gathering / gathering solution
STM32 Development Notes 119: what macros are required to enable FPU?
Blog Description & message board
Compile ue5.0
Valley p2420 let's XOR solution
When we talk about immutable infrastructure, what are we talking about
Luogu p2391 snow covered problem solution
Small case of data analysis: visualize recruitment data and view the most needed technologies in the field~
自己实现is_convertible
Interviewer: explain the core principle of ThreadLocal
Unity LOD
rhce第一天
STL notes (VIII): container - List
小红书携手HMS Core,畅玩高清视界,种草美好生活
STL notes (IV): String
After watching the latest interview with big manufacturers, these six JVM interview questions were asked