vpp系列8-常用命令

不问归期 提交于 2020-08-10 16:18:01

VPP常用命令

all see here

set interface

set interface ip address

set interface ip address [del] <interface> <ip-addr>/<mask> | [all]

example usage

# 设置接口ipv4地址
vpp# set interface ip address eth0 172.16.2.12/24  # 简写 vpp# set int ip addr eth0 172.16.2.12/24
# 删除接口ipv4地址
vpp# set interface ip address del eth0 172.16.2.12/24
# 删除接口ipv4 and ipv6
vpp# set interface ip address del eth0 all

set interface l2 bridge

set interface l2 bridge <interface> <bridge-domain-id> [bvi|uu-fwd] [shg]

example usage

vpp# set interface l2 bridge GigabitEthernet0/8/0.200 200
vpp# set interface l2 bridge GigabitEthernet0/9/0.200 200 bvi  # only one can set bvi
vpp# set interface l2 bridge GigabitEthernet0/a/0.200 200 1
vpp# set interface l3 GigabitEthernet0/a/0.200  # set l3 == del l2

set interface mtu

set interface mtu [packet|ip4|ip6|mpls] <value> <interface>

set interface promiscuous

set interface promiscuous [on|off] <interface>.

set interface state

set interface state <interface> [up|down|punt|enable].

IP Route

ip route [add|del] [count <*n*>] <*dst-ip-addr*>/<*width*> [table <*table-id*>] via [next-hop-address[next-hop-interface] [next-hop-table <*value*>] [weight <*value*>] [preference <*value*>] [udp-encap-id <*value*>] [ip4-lookup-in-table <*value*>] [ip6-lookup-in-table <*value*>] [mpls-lookup-in-table <*value*>] [resolve-via-host] [resolve-via-connected] [rx-ip4 <*interface*>] [out-labels <*value value value*>]

uasge

vpp# ip route add 6.0.1.2/32 via 6.0.0.1 GigabitEthernet2/0/0
vpp# ip route del 6.0.1.2/32 via 6.0.0.1 GigabitEthernet2/0/0
# 批量添加路由,多用于测试性能
vpp# ip route add count 10 7.0.0.0/24 via 6.0.0.1 GigabitEthernet2/0/0
# 添加同一个目的地的多条路由以创建等价路径
vpp# ip route add 7.0.0.1/32 via 6.0.0.1 GigabitEthernet2/0/0
vpp# ip route add 7.0.0.1/32 via 6.0.0.2 GigabitEthernet2/0/0
# 非等价路径由后面的权重指定,下面一个走1/4的流量,一个走3/4的流量
vpp# ip route add 7.0.0.1/32 via 6.0.0.1 GigabitEthernet2/0/0 weight 1
vpp# ip route add 7.0.0.1/32 via 6.0.0.2 GigabitEthernet2/0/0 weight 3
# 添加到指定的FIB表(VRF)
vpp# ip route add 172.16.24.0/24 table 7 via GigabitEthernet2/0/0

Ping

ping {<ip-addr> | ipv4 <ip4-addr> | ipv6 <ip6-addr>} [ipv4 <ip4-addr> | ipv6 <ip6-addr>] [source <interface>] [size <pktsize>] [interval <sec>] [repeat <cnt>] [table-id <id>] [verbose]

uasge

vpp# ping 172.16.1.2 source GigabitEthernet2/0/0 repeat 2

64 bytes from 172.16.1.2: icmp_seq=1 ttl=64 time=.1090 ms
64 bytes from 172.16.1.2: icmp_seq=2 ttl=64 time=.0914 ms

Statistics: 2 sent, 2 received, 0% packet loss

Example of how ping both an IPv4 address and IPv6 address at the same time:

vpp# ping 172.16.1.2 ipv6 fe80::24a5:f6ff:fe9c:3a36 source GigabitEthernet2/0/0 repeat 2 verbose

Adjacency index: 10, sw_if_index: 1
Adj: ip6-discover-neighbor
Adj Interface: 0
Forced set interface: 1
Adjacency index: 0, sw_if_index: 4294967295
Adj: ip4-miss
Adj Interface: 0
Forced set interface: 1
Source address: 172.16.1.1
64 bytes from 172.16.1.2: icmp_seq=1 ttl=64 time=.1899 ms
Adjacency index: 10, sw_if_index: 1
Adj: ip6-discover-neighbor
Adj Interface: 0
Forced set interface: 1
Adjacency index: 0, sw_if_index: 4294967295
Adj: ip4-miss
Adj Interface: 0
Forced set interface: 1
Source address: 172.16.1.1
64 bytes from 172.16.1.2: icmp_seq=2 ttl=64 time=.0910 ms

Statistics: 4 sent, 2 received, 50% packet loss

Show

show interface

show interface [address|addr|features|feat] [<interface> [<interface> [..]]]

usage

vpp# show int
vpp# show interface rx-placement

show bridge-domain

show bridge-domain [bridge-domain-id [detail|int|arp| bd-tag ]]

show hardware-interface

show hardware-interfaces [brief|verbose|detail] [bond] [<interface> [<interface> [..]]] [<sw_idx> [<sw_idx> [..]]].

uasge

vpp# show hardware-interfaces GigabitEthernet7/0/0 2 verbose
               Name                Idx   Link  Hardware
GigabitEthernet7/0/0               1     up   GigabitEthernet7/0/0
  Ethernet address ec:f4:bb:c0:bc:fc
  Intel e1000
    carrier up full duplex speed 1000 mtu 9216
    rx queues 1, rx desc 1024, tx queues 3, tx desc 1024
    cpu socket 0
GigabitEthernet7/0/1               2    down  GigabitEthernet7/0/1
  Ethernet address ec:f4:bb:c0:bc:fd
  Intel e1000
    carrier up full duplex speed 1000 mtu 9216
    rx queues 1, rx desc 1024, tx queues 3, tx desc 1024
    cpu socket 0

show ip fib

显示IPv4 FIB表(VRF表)和每个表的路由条目。注意:表非常大时,可能会很慢,请指定查询

show ip fib [summary] [table <table-id>] [index <fib-id>] [<ip4-addr>[/<mask>]] [mtrie] [detail]

uasge

vpp# show ip fib
vpp# show ip fib summary
vpp# show ip fib table 7

show l2fib

显示L2 FIB表的MAC地址条目

show l2fib [all] | [bd_id <nn> | bd_index <nn>] [learn | add] | [raw]

usage

vpp# **show l2fib**

3 l2fib entries

Example of how to display all the MAC Address entries in the L2 FIB table:

vpp# **show l2fib all**

    Mac Address     BD Idx           Interface           Index  static  filter  bvi  refresh  timestamp
 52:54:00:53:18:33    1      GigabitEthernet0/8/0.200      3       0       0     0      0         0
 52:54:00:53:18:55    1      GigabitEthernet0/8/0.200      3       1       0     0      0         0
 52:54:00:53:18:77    1                 N/A                -1      1       1     0      0         0
3 l2fib entries

show vhost-user

show vhost-user [<interface> [<interface> [..]]] [descriptors].

usage

vpp# show vhost-user VirtualEthernet0/0/0
vpp# show vhost-user VirtualEthernet0/0/0 descriptors

clear

clear hardware

清除硬件接口统计信息

clear hardware-interfaces [<interface> [<interface> [..]]] [<sw_idx> [<sw_idx> [..]]].

uasge

vpp# clear hardware-interfaces
vpp# clear hardware-interfaces GigabitEthernet7/0/0 2

clear interface

vpp# clear interfaces

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!