当前位置:网站首页>LCP插件创建对等VLAN接口
LCP插件创建对等VLAN接口
2022-07-25 05:15:00 【redwingz】
首先,在VPP中创建物理接口GigabitEthernet8/0/0的VLAN子接口,VLAN ID指定为1234。
# vppctl
vpp#
vpp# create sub GigabitEthernet8/0/0 1234
GigabitEthernet8/0/0.1234
将VLAN子接口设置为UP状态,MTU设置为9000,VLAN子接口默认MTU为零。
vpp# set interface state GigabitEthernet8/0/0.1234 up
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 517
GigabitEthernet8/0/0.1234 19 up 0/0/0/0
vpp#
vpp#
vpp# set interface mtu packet 9000 GigabitEthernet8/0/0.1234
设置VLAN子接口的IP地址为20.0.1.1/24。
vpp# set interface ip address GigabitEthernet8/0/0.1234 20.0.1.1/24
vpp#
vpp# show interface address
GigabitEthernet8/0/0 (up):
L3 10.0.1.1/24
GigabitEthernet8/0/0.1234 (up):
L3 20.0.1.1/24
LCP对等体接口
LCP创建VLAN子接口的对等接口。前提是已经创建了物理接口GigabitEthernet8/0/0的对等接口e8。
vpp# lcp create GigabitEthernet8/0/0.1234 host-if e8.1234
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.1234 tap11.1234 e8.1234 20 type tap
设置linux中对等体接口e8.1234的地址,与VPP接口GigabitEthernet8/0/0.1234地址相同。
# ip address add dev e8.1234 20.0.1.1/24
#
# ip -d addr show type vlan
20: [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 1234 <REORDER_HDR> numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
inet 20.0.1.1/24 scope global e8.1234
将接口GigabitEthernet8/0/0.1234设置为DOWN状态,linux接口e8.1234也同步为DOWN状态。
vpp# set interface state GigabitEthernet8/0/0.1234 down
vpp# quit
#
# ip link
19: e8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:60:e0:6f:5a:f1 brd ff:ff:ff:ff:ff:ff
20: [email protected]: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
link/ether 00:60:e0:6f:5a:f1 brd ff:ff:ff:ff:ff:ff
连通性测试
在linux中ping外部主机的vlan接口地址20.0.1.2。
# ping 20.0.1.2
PING 20.0.1.2 (20.0.1.2) 56(84) bytes of data.
64 bytes from 20.0.1.2: icmp_seq=1 ttl=64 time=0.280 ms
如下为主机20.0.1.2回复的ICMP报文。
vpp# trace add dpdk-input 100
vpp#
vpp# show trace
------------------- Start of thread 0 vpp_main -------------------
No packets in trace buffer
------------------- Start of thread 1 vpp_wk_0 -------------------
Packet 1
03:38:11:636773: dpdk-input
GigabitEthernet8/0/0 rx queue 0
buffer 0x960e7: 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 0x8eb83a40
packet_type 0x11 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.
Packet Types
RTE_PTYPE_L2_ETHER (0x0001) Ethernet packet
RTE_PTYPE_L3_IPV4 (0x0010) IPv4 packet without extension headers
IP4: 00:60:e0:68:9f:ee -> 00:60:e0:6f:5a:f1 802.1q vlan 1234
ICMP: 20.0.1.2 -> 20.0.1.1
tos 0x00, ttl 64, length 84, checksum 0xa514 dscp CS0 ecn NON_ECN
fragment id 0xab92
ICMP echo_reply checksum 0x9d68 id 5
03:38:11:636779: 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.1q vlan 1234
03:38:11:636781: ip4-input
ICMP: 20.0.1.2 -> 20.0.1.1
tos 0x00, ttl 64, length 84, checksum 0xa514 dscp CS0 ecn NON_ECN
fragment id 0xab92
ICMP echo_reply checksum 0x9d68 id 5
03:38:11:636782: ip4-lookup
fib 0 dpo-idx 8 flow hash: 0x00000000
ICMP: 20.0.1.2 -> 20.0.1.1
tos 0x00, ttl 64, length 84, checksum 0xa514 dscp CS0 ecn NON_ECN
fragment id 0xab92
ICMP echo_reply checksum 0x9d68 id 5
03:38:11:636783: ip4-receive
ICMP: 20.0.1.2 -> 20.0.1.1
tos 0x00, ttl 64, length 84, checksum 0xa514 dscp CS0 ecn NON_ECN
fragment id 0xab92
ICMP echo_reply checksum 0x9d68 id 5
03:38:11:636784: ip4-icmp-input
ICMP: 20.0.1.2 -> 20.0.1.1
tos 0x00, ttl 64, length 84, checksum 0xa514 dscp CS0 ecn NON_ECN
fragment id 0xab92
ICMP echo_reply checksum 0x9d68 id 5
03:38:11:636785: ip4-icmp-echo-reply
ICMP4 echo id 5 seq 1 (unknown)
03:38:11:636789: ip4-punt
ICMP: 20.0.1.2 -> 20.0.1.1
tos 0x00, ttl 64, length 84, checksum 0xa514 dscp CS0 ecn NON_ECN
fragment id 0xab92
ICMP echo_reply checksum 0x9d68 id 5
03:38:11:636790: ip4-punt-redirect
via redirect:4
03:38:11:636791: ip4-dvr-dpo
sw_if_index:20
03:38:11:636791: ip4-dvr-reinject
sw_if_index:20
03:38:11:636793: tap11-output
tap11.1234
IP4: 00:60:e0:68:9f:ee -> 00:60:e0:6f:5a:f1 802.1q vlan 1234
ICMP: 20.0.1.2 -> 20.0.1.1
tos 0x00, ttl 64, length 84, checksum 0xa514 dscp CS0 ecn NON_ECN
fragment id 0xab92
ICMP echo_reply checksum 0x9d68 id 5
03:38:11:636794: tap11-tx
buffer 0x960e7: current data 0, length 102, buffer-pool 0, ref-count 1, trace handle 0x1000000
ext-hdr-valid
vlan-1-deep local dvr l2-hdr-offset 0 l3-hdr-offset 18
hdr-sz 0 l2-hdr-offset 0 l3-hdr-offset 18 l4-hdr-offset 0 l4-hdr-sz 0
IP4: 00:60:e0:68:9f:ee -> 00:60:e0:6f:5a:f1 802.1q vlan 1234
ICMP: 20.0.1.2 -> 20.0.1.1
tos 0x00, ttl 64, length 84, checksum 0xa514 dscp CS0 ecn NON_ECN
fragment id 0xab92
ICMP echo_reply checksum 0x9d68 id 5
VPP在节点tap11-tx中将VLAN报文发送到linux中,在linux下抓取接口e8的ping报文,如下:
# tcpdump -i e8 -n -e -v
# tcpdump: listening on e8, link-type EN10MB (Ethernet), capture size 262144 bytes
#
15:06:20.770433 00:60:e0:6f:5a:f1 > 00:60:e0:68:9f:ee, ethertype 802.1Q (0x8100), length 102: vlan 1234, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 37355, offset 0, flags [DF], proto ICMP (1), length 84)
20.0.1.1 > 20.0.1.2: ICMP echo request, id 7, seq 1, length 64
15:06:20.770591 00:60:e0:68:9f:ee > 00:60:e0:6f:5a:f1, ethertype 802.1Q (0x8100), length 102: vlan 1234, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 26465, offset 0, flags [none], proto ICMP (1), length 84)
20.0.1.2 > 20.0.1.1: ICMP echo reply, id 7, seq 1, length 64
自动创建VLAN子接口
开启自动创建VLAN子接口开关。
vpp# lcp lcp-auto-subint on
vpp#
vpp# show lcp
lcp lcp-auto-subint on
创建VLAN子接口GigabitEthernet8/0/0.2310,如下,在linux中自动创建了VLAN子接口e8.2310。
vpp# create sub GigabitEthernet8/0/0 2310
GigabitEthernet8/0/0.2310
vpp#
vpp#
vpp# show lcp
lcp lcp-auto-subint on
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.1234 tap11.1234 e8.1234 20 type tap
itf-pair: [3] GigabitEthernet8/0/0.2310 tap11.2310 e8.2310 21 type tap
vpp#
vpp#
vpp# quit
#
# ip -d link show type vlan
21: [email protected]: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN 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.1Q id 2310 <REORDER_HDR> addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
边栏推荐
- Implement is by yourself_ convertible
- Forwarding and sharing function of wechat applet
- STM32 Development Notes 119: what macros are required to enable FPU?
- 【微信小程序】拍卖商品详情页设计与交互实现(包含倒计时、实时更新出价)
- DOM在Ahooks中的处理过程
- What about reinstalling win11 system?
- STL notes (II): template and operator overloading
- Document collaboration tool recommendation
- Nexttick principle analysis
- Introduction to CpG control network
猜你喜欢

Special analysis of data security construction in banking industry

教你如何定位不合理的SQL?并优化之
![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

How to publish your own NPM package

Ora-01460: conversion request cannot be implemented or unreasonable

Style transfer -- CCPL: contrast coherence preserving loss for versatile style transfer

Getting started with scratch

一篇文章带你读懂Redis的哨兵模式

85 distributed project construction

微信小程序相关操作示例
随机推荐
Your technical leader doesn't understand this? Without it, there is no complete thinking process of design
Basic knowledge of scratch crawler framework
Browser cache HTTP cache CDN cache localstorage / sessionstorage / cookies
Document collaboration tool recommendation
Logu p3398 hamsters find sugar solution
微信小程序相关操作示例
[c language] custom type (structure ~ enumeration ~ Union)
Redis的三个必知必会的问题
Project management tool - Introduction and practice of Alibaba cloud projex
HMS Core Discovery第16期直播预告|与虎墩一起,玩转AI新“声”态
Seven suggestions for Server Protection
[untitled]
Gradle test and idea test
"Niuke | daily question" inverse Polish expression
China trifluoroethanol industry research and investment forecast report (2022 Edition)
Teach you how to locate unreasonable SQL? And optimize it
Permanent magnet synchronous motor 36 question (1) -- what is the difference between salient pole motor and salient pole motor?
STL notes (V): iterator
Ownership in rust -- introduction of rust language Xiaobai 11
绕过 Web 应用程序中的 XSS 过滤器