本文主要记录一些基本配置与基础命令.
unix {
nodaemon
log /var/log/vpp/vpp.log
full-coredump
cli-listen /run/vpp/cli.sock
}
socksvr {
default
}
api-trace {
on
}
cpu {
main-core 0
corelist-workers 1-16,24-39
scheduler-policy fifo
scheduler-priority 50
}
buffers {
buffers-per-numa 204800
}
plugins {
path /usr/lib/vpp_plugins/:/usr/lib/vpp_api_test_plugins/
plugin default { enable }
}
dpdk {
dev default {
num-rx-queues 16
num-tx-queues 16
num-rx-desc 2048
num-tx-desc 2048
devargs mprq_en=1,rxqs_min_mprq=1,txqs_min_inline=1
}
num-mem-channels 4
log-level debug
socket-mem 32768
dev 0000:19:00.1 {
name 100GE1/0/1
}
dev 0000:54:00.1 {
name 100GE1/0/2
}
no-multi-seg
no-tx-checksum-offload
}
l2 xconnect
模式为高性能转发模式, 必须使用2个接口配置此模式, 类似网线直连, 配置后在一个接口上接收到的所有数据包将被直接发送到另一个接口.
set interface state 100GE1/0/1 up
set interface state 100GE1/0/2 up
set interface l2 xconnect 100GE1/0/1 100GE1/0/2
set interface l2 xconnect 100GE1/0/2 100GE1/0/1
show mode 100GE1/0/1 100GE1/0/2
如需取消l2 xconnect
模式, 将接口配置为l3模式即可:
set interface l3 100GE1/0/1
set interface l3 100GE1/0/2
show mode 100GE1/0/1 100GE1/0/2
set interface state 100GE1/0/1 up
set interface state 100GE1/0/2 up
set interface l2 bridge 100GE1/0/1 200
set interface l2 bridge 100GE1/0/2 200
show mode 100GE1/0/1 100GE1/0/2
show bridge-domain 200 detail
如需取消l2 bridge
模式, 将接口配置为l3模式即可:
set interface l3 100GE1/0/1
set interface l3 100GE1/0/2
show mode 100GE1/0/1 100GE1/0/2
set int mtu packet 1500 100GE1/0/1
set int mtu packet 1500 100GE1/0/2
set int state 100GE1/0/1 up
set int state 100GE1/0/2 up
create bond mode lacp load-balance l23
set int mtu packet 1500 BondEthernet0
bond add BondEthernet0 100GE1/0/1
bond add BondEthernet0 100GE1/0/2
set int ip address BondEthernet0 40.0.167.68/24
set int state BondEthernet0 up
show bond details
show ip neighbors
bond del 100GE1/0/1
bond del 100GE1/0/2
delete bond BondEthernet0
注: vpp 20.05.1 按照此配置 BondEthernet0 与交换机互联不通, 暂不知问题原因.
set int mtu packet 1500 100GE1/0/1
set int mtu packet 1500 100GE1/0/2
set int ip address 100GE1/0/1 40.0.148.68/24
set int ip address 100GE1/0/2 40.0.147.68/24
set int state 100GE1/0/1 up
set int state 100GE1/0/2 up
添加多路径路由:
ip route add 40.0.40.2/32 via 40.0.147.66 weight 1
ip route add 40.0.40.2/32 via 40.0.148.66 weight 3
show ip fib
添加多路径等价路由:
ip route add 40.0.40.2/32 via 40.0.147.66
ip route add 40.0.40.2/32 via 40.0.148.66
show ip fib
添加 VRF 路由:
ip route add 40.0.40.2/32 table 7 via 100GE1/0/1
show ip fib
删除路由:
ip route del 40.0.40.2/32 via 40.0.147.66
ip route del 40.0.40.2/32 via 40.0.148.66
show ip fib
IPv6 地址配置:
enable ip6 interface 100GE1/0/1
disable ip6 interface 100GE1/0/1
添加接口路由表(VRF):
set interface ip table 100GE1/0/1 200
set interface ip6 table 100GE1/0/1 201
vpp# set acl-plugin acl ?
set acl-plugin acl set acl-plugin acl src dst proto X sport X-Y dport X-Y [tag FOO] {use comma separated list for multiple rules}
vpp#
添加ACL到接口:
set acl-plugin acl permit src 40.0.0.0/16
set acl-plugin acl deny dst 40.0.40.2/32
set acl-plugin int 100GE1/0/1 input acl 0
set acl-plugin int 100GE1/0/2 input acl 0
set acl-plugin int 100GE1/0/1 input acl 1
set acl-plugin int 100GE1/0/2 input acl 1
show acl-plugin acl 0
show acl-plugin acl 1
show acl-plugin memory
show acl-plugin sessions
show acl-plugin tables
移除ACL:
set acl-plugin int 100GE1/0/1 input acl 0 del
set acl-plugin int 100GE1/0/2 input acl 0 del
set acl-plugin int 100GE1/0/1 input acl 1 del
set acl-plugin int 100GE1/0/2 input acl 1 del
clear acl-plugin sessions.
Layer 2 CLI
Layer 3 IP CLI