zoukankan      html  css  js  c++  java
  • vpp cmd

    DBGvpp# sh inter addr
    UnknownEthernet5/0/0 (up):
      L3 192.168.1.229/24
    host-ns1_tap (up):
    local0 (dn):
    DBGvpp# nat44 add interface address  UnknownEthernet5/0/0
    DBGvpp# 
    DBGvpp# create bridge-domain 1
    bridge-domain 1
    
    DBGvpp# set interface l2 bridge host-ns1_tap 1
    DBGvpp# set interface l2 bridge UnknownEthernet5/0/0 1
    DBGvpp# 
    DBGvpp# ip route add 192.168.1.0/24 via UnknownEthernet5/0/0
    DBGvpp# 
    [root@localhost vpp2]# ./extras/vpp_config/scripts/dpdk-devbind.py --status
    
    Network devices using DPDK-compatible driver
    ============================================
    <none>
    
    Network devices using kernel driver
    ===================================
    0000:05:00.0 'Hi1822 Family (2*25GE)' if= drv=vfio-pci unused=hinic 
    0000:06:00.0 'Hi1822 Family (2*25GE)' if= drv=vfio-pci unused=hinic 
    0000:7d:00.0 'HNS GE/10GE/25GE RDMA Network Controller' if=enp125s0f0 drv=hns3 unused=hns_roce_hw_v2 
    0000:7d:00.1 'HNS GE/10GE/25GE Network Controller' if=enp125s0f1 drv=hns3 unused= 
    0000:7d:00.2 'HNS GE/10GE/25GE RDMA Network Controller' if=enp125s0f2 drv=hns3 unused=hns_roce_hw_v2 
    0000:7d:00.3 'HNS GE/10GE/25GE Network Controller' if=enp125s0f3 drv=hns3 unused= 
    
    Other network devices
    =====================
    <none>
    
    Crypto devices using DPDK-compatible driver
    ===========================================
    <none>
    
    Crypto devices using kernel driver
    ==================================
    <none>
    
    Other crypto devices
    ====================
    <none>
    delete loopback interface intfc <interface>.

    Example Usage
    Example of how to configure a Layer 2 bridge-domain with three interfaces (where 200 is the bridge-domain-id):
    
    vpp# set interface l2 bridge GigabitEthernet0/8/0.200 200
    This interface is added a BVI interface:
    
    vpp# set interface l2 bridge GigabitEthernet0/9/0.200 200 bvi
    This interface also has a split-horizon group of 1 specified:
    
    vpp# set interface l2 bridge GigabitEthernet0/a/0.200 200 1
    Example of how to remove an interface from a Layer2 bridge-domain:
    
    vpp# set interface l3 GigabitEthernet0/a/0.200
    DBGvpp# set int ip address del  loop0 192.168.1.229/24
    DBGvpp# set int ip address   UnknownEthernet5/0/0 192.168.1.229/24
    DBGvpp#
    DBGvpp# show nat44 int address
    show nat44: unknown input `int address'
    DBGvpp# show nat44            
    show nat44: unknown input `'
    DBGvpp# show nat44 interfaces            
    NAT44 interfaces:
    DBGvpp# nat44 add address
    DBGvpp# 
    set interface proxy-arp host-ns1_tap
    DBGvpp# show ip neighbor
        Time                       IP                    Flags      Ethernet              Interface       
      62356.3346              192.168.1.82                 D    48:57:02:64:e7:ae UnknownEthernet5/0/0
    DBGvpp# show plugin                                                  
     Plugin path is: /root/vpp/vpp2/build-root/install-vpp_debug-native/vpp/lib/aarch64-linux-gnu/vpp_plugins:/root/vpp/vpp2/build-root/install-vpp_debug-native/vpp/lib/vpp_plugins
    
         Plugin                                   Version                          Description
      1. ioam_plugin.so                           20.01-34~g844ec17-dirty          Inbound Operations, Administration, and Maintenance (OAM)
      2. tlspicotls_plugin.so                     20.01-34~g844ec17-dirty          Transport Layer Security (TLS) Engine, Picotls Based
      3. mdata_plugin.so                          20.01-34~g844ec17-dirty          Buffer metadata change tracker.
      4. l3xc_plugin.so                           20.01-34~g844ec17-dirty          L3 Cross-Connect (L3XC)
      5. ping_plugin.so                           20.01-34~g844ec17-dirty          Ping (ping)
    set int ip address TenGigabitEthernet19/0/1 10.10.10.2/24
    set int ip address TenGigabitEthernet19/0/3 10.10.11.2/24
    set int state TenGigabitEthernet19/0/1 up
    set int state TenGigabitEthernet19/0/3 up
    set ip neighbor TenGigabitEthernet19/0/1 10.10.10.3 e4:43:4b:2e:b1:d1
    set ip neighbor TenGigabitEthernet19/0/3 10.10.11.3 e4:43:4b:2e:b1:d3 
    o enable NAT on VPP, I used the following commands:
    
    nat44 add interface address TenGigabitEthernet19/0/3
    nat addr-port-assignment-alg default
    set interface nat44 in TenGigabitEthernet19/0/1 out
    TenGigabitEthernet19/0/3 output-feature 
    DBGvpp#  show hardware-interfaces host-ns1_tap verbose 
                  Name                Idx   Link  Hardware
    host-ns1_tap                       2     up   host-ns1_tap
      Link speed: unknown
      Ethernet address 02:fe:2a:ef:ec:4f
      Linux PACKET socket interface
    DBGvpp# 

    DBGvpp# set ip neighbor host-ns1_tap 192.168.2.229 44:a1:91:a4:9b:eb
    DBGvpp# set ip neighbor host-ns1_tap 192.168.2.331 5a:48:af:ec:0b:0f
    set ip neighbor: specify interface, IP address and MAC: `host-ns1_tap 192.168.2.331 5...'
    DBGvpp# show ip neighbor
    Time IP Flags Ethernet Interface
    64199.9835 192.168.1.82 D 48:57:02:64:e7:ae UnknownEthernet5/0/0
    67048.1874 192.168.2.229 D 44:a1:91:a4:9b:eb host-ns1_tap
    DBGvpp# set ip neighbor de l host-ns1_tap 192.168.2.229 44:a1:91:a4:9b:eb
    set ip neighbor: specify interface, IP address and MAC: `de l host-ns1_tap 192.168.2.2...'
    DBGvpp# set ip neighbor del host-ns1_tap 192.168.2.229 44:a1:91:a4:9b:eb
    DBGvpp# show ip neighbor
    Time IP Flags Ethernet Interface
    64199.9835 192.168.1.82 D 48:57:02:64:e7:ae UnknownEthernet5/0/0
    DBGvpp#

     
    DBGvpp# show int        
                  Name               Idx    State  MTU (L3/IP4/IP6/MPLS)     Counter          Count     
    UnknownEthernet5/0/0              1      up          9000/0/0/0     rx packets               3826797
                                                                        rx bytes               566893073
                                                                        tx packets                   113
                                                                        tx bytes                    6086
                                                                        drops                    3535309
                                                                        punt                       10564
                                                                        ip4                        18736
                                                                        ip6                        32810
                                                                        rx-miss                  2473683
    host-ns1_tap                      2      up          9000/0/0/0     rx packets                  2432
                                                                        rx bytes                  119112
                                                                        tx packets                143988
                                                                        tx bytes                47915840
                                                                        drops                       2066
                                                                        ip4                          286
                                                                        ip6                           16
    local0                            0     down          0/0/0/0       drops                          2
    loop0                             3     down         9000/0/0/0     
    DBGvpp#  trace add af-packet-input 2
    DBGvpp# show trace
    ------------------- Start of thread 0 vpp_main -------------------
    Packet 1
    
    18:45:42:007434: af-packet-input
      af_packet: hw_if_index 2 next-index 4
        tpacket2_hdr:
          status 0x20000001 len 42 snaplen 42 mac 66 net 80
          sec 0x5ea109fa nsec 0x3337d1fe vlan 0 vlan_tpid 0
    18:45:42:007443: ethernet-input
      ARP: 5a:48:af:ec:0b:0f -> ff:ff:ff:ff:ff:ff
    18:45:42:007448: l2-input
      l2-input: sw_if_index 2 dst ff:ff:ff:ff:ff:ff src 5a:48:af:ec:0b:0f
    18:45:42:007453: l2-learn
      l2-learn: sw_if_index 2 dst ff:ff:ff:ff:ff:ff src 5a:48:af:ec:0b:0f bd_index 1
    18:45:42:007458: error-drop
      rx:host-ns1_tap
    18:45:42:007462: drop
      l2-flood: L2 replication complete
    
    Packet 2
    
    18:45:43:047072: af-packet-input
      af_packet: hw_if_index 2 next-index 4
        tpacket2_hdr:
          status 0x20000001 len 42 snaplen 42 mac 66 net 80
          sec 0x5ea109fb nsec 0x359a24a8 vlan 0 vlan_tpid 0
    18:45:43:047077: ethernet-input
      ARP: 5a:48:af:ec:0b:0f -> ff:ff:ff:ff:ff:ff
    18:45:43:047081: l2-input
      l2-input: sw_if_index 2 dst ff:ff:ff:ff:ff:ff src 5a:48:af:ec:0b:0f
    DBGvpp# clear trace                                                                                              
    DBGvpp# 
    DBGvpp# ping 192.168.1.82 source UnknownEthernet5/0/0 
    116 bytes from 192.168.1.82: icmp_seq=1 ttl=64 time=.1125 ms
    116 bytes from 192.168.1.82: icmp_seq=2 ttl=64 time=.0599 ms
    116 bytes from 192.168.1.82: icmp_seq=3 ttl=64 time=.0571 ms
    
    [root@localhost vpp2]# 

    set int state wan0 up
    set int state wan1 up

    set int ip address wan0 172.78.10.155/29
    set dhcp client intfc wan1 hostname test-wans

    ip route add 0.0.0.0/0 via 172.78.10.158 wan0

    vpp# ping 8.8.8.8 source wan0
    vpp# ping 8.8.8.8 source wan1
    DBGvpp# 
    DBGvpp# ip table  add 1      
    DBGvpp# ip table  del 1
    DBGvpp# 
    DBGvpp# show nat44 sessions detail
    NAT44 sessions:
    -------- thread 0 vpp_main: 0 sessions --------
    DBGvpp# 
    DBGvpp# ping 192.168.117.82 source   host-ns7_tap repeat 2
    Failed: no source address for egress interface
    Failed: no source address for egress interface
    
    Statistics: 0 sent, 0 received, 0% packet loss
    DBGvpp# 

     set interface ip table host-ns1_tap 0

    DBGvpp# show l2fib verbose                                
        Mac-Address     BD-Idx If-Idx BSN-ISN Age(min) static filter bvi         Interface-Name        
     fa:16:3e:78:00:62    1      1      0/1      -       -      -     -       UnknownEthernet5/0/0     
     fa:16:3e:29:06:df    1      1      0/1      -       -      -     -       UnknownEthernet5/0/0     
     a4:bf:01:68:49:aa    1      1      0/1      -       -      -     -       UnknownEthernet5/0/0     
     fa:16:3e:44:a6:12    1      1      0/1      -       -      -     -       UnknownEthernet5/0/0     
     10:81:84:00:34:23    1      1      0/1      -       -      -     -       UnknownEthernet5/0/0     
     fa:16:3e:c3:a4:b6    1      1      0/1      -       -      -     -       UnknownEthernet5/0/0     
     30:e9:8e:7d:57:7a    1      1      0/1      -       -      -     -       UnknownEthernet5/0/0     
     9c:52:f8:67:c4:d3    1      1      0/1      -       -      -     -       UnknownEthernet5/0/0     
     30:e9:8e:90:18:f9    1      1      0/1      -       -      -     -       UnknownEthernet5/0/0     
     fa:16:3e:22:fe:e7    1      1      0/1      -       -      -     -       UnknownEthernet5/0/0     
     f4:79:60:82:1e:29    1      1      0/1      -       -      -     -       UnknownEthernet5/0/0     
     f4:79:60:fe:45:b6    1      1      0/1      -       -      -     -       UnknownEthernet5/0/0   

     查看设备属于哪个vrf

    DBGvpp# show int addr
    UnknownEthernet5/0/0 (up):
      L2 bridge bd-id 1 idx 1 shg 0  
    host-ns1_tap (up):
      L2 bridge bd-id 1 idx 1 shg 0  
    host-ns7_tap (up):
      L2 bridge bd-id 1 idx 1 shg 0  
      L3 192.168.1.2/24 ip4 table-id 100 fib-idx 1
    local0 (dn):
    loop0 (up):
      L2 bridge bd-id 1 idx 1 shg 0 bvi
      L3 192.168.1.1/24
    DBGvpp#
    show int addr         
     
    DBGvpp# nat44 add  address 192.168.1.211 tenant-vrf 200                                                          
    DBGvpp# ip table add 300
    DBGvpp# set interface ip table  host-ns1_tap 300
    DBGvpp# nat44 add  address 192.168.1.213 tenant-vrf 200
    DBGvpp# show nat44 addresses
    NAT44 pool addresses:
    192.168.1.210
      tenant VRF: 100
      0 busy udp ports
      0 busy tcp ports
      0 busy icmp ports
    192.168.1.211
      tenant VRF: 200
      0 busy udp ports
      0 busy tcp ports
      0 busy icmp ports
    192.168.1.213
      tenant VRF: 200
      0 busy udp ports
      0 busy tcp ports
      0 busy icmp ports
    NAT44 twice-nat pool addresses:
    DBGvpp# nat44 add  address 192.168.1.213 tenant-vrf 200
    nat44 add address: NAT address already in use.
    DBGvpp# nat44 del  address 192.168.1.213 tenant-vrf 200
    nat44 del: unknown input ` address 192.168.1.213 tenant-...'
    DBGvpp# nat44 add static mapping                       
    DBGvpp# 

    DBGvpp# nat44 add interface address UnknownEthernet5/0/0
    DBGvpp# set interface nat44 in loop0 out UnknownEthernet5/0/0   
    DBGvpp# nat44 forwarding enable
    DBGvpp# nat44 add static mapping local 192.168.1.xxx <REDACTED-inside-port> external GigabitEthernet3/0/0 <REDACTE tcp                                                                            
    tcp: unknown input `'
    DBGvpp# set int nat44 in UnknownEthernet5/0/0  out UnknownEthernet5/0/0 
    DBGvpp# 
    DBGvpp# delete host-interface name ns8_tap
    DBGvpp#
    create host-interface name ns8_tap
    
    
    nat44 add static mapping external 192.168.1.231   external UnknownEthernet5/0/0 del
    nat44 add interface address  loop0 del 
    DBGvpp# ip route del 0.0.0.0/0 table 100 via 10.10.16.229  loop0  
    DBGvpp# ip route add 0.0.0.0/0 table 100 via 10.10.16.229  host-ns1_tap
    DBGvpp# show ip fib  summary                                                                                     
    ipv4-VRF:0, fib_index:0, flow hash:[src dst sport dport proto ] epoch:0 flags:none locks:[adjacency:1, default-route:1, nat-hi:2, ]
        Prefix length         Count     
                       0               1
                       4               2
                      24               1
                      32               6
    DBGvpp# 

    https://haryachyy.wordpress.com/2018/08/16/learning-vpp-traffic-emulation/

     https://gist.github.com/garyachy/887ce40231a05379f31bf6eb84ef3d86

    https://peiyake.com.cn/part1/vpp/l2_bridge

    https://wiki.fd.io/view/VPP/Progressive_VPP_Tutorial

  • 相关阅读:
    .NetCore 导出Execl
    10块钱可以喝几瓶?
    menuStrip鼠标滑过自动弹出
    静态变量
    DataTable.SELECT日期类型筛选处理
    Java中accept()阻塞是如何实现的
    L1正则在0处不可导怎么办?
    L1和L2正则化原理推导.md
    5局3胜和3局2胜哪个更容易赢.md
    Java集合(一): 集合框架Collection和Map
  • 原文地址:https://www.cnblogs.com/dream397/p/12758808.html
Copyright © 2011-2022 走看看