DPDK-l 3 fwdサンプルIPv 6テスト

4454 ワード

テスト環境
オペレーティングシステム:Ubuntu 20.04 LTS;プロセッサー:Intel® Core™ i7-4790K CPU @ 4.00GHz. NICはIntelのX 710万メガNICを使用しています.DPDKバージョン19.02.
トポロジのテスト:
                      |----------------|
                      |  Ubuntu(DPDK)  |
                      |                |
                      |  eth0   eth1   |
           2001:11::1 |----|------|----|  2001:22::1
    00:60:E0:6F:C8:7D      |      |       00:60:E0:6F:C8:7E
                          /        \
                         /          \
                        /            \
                       /              \
  00:60:E0:7A:6C:78   /                \   00:60:E0:7A:6C:79
     2001:11::2/64   |                  |  2001:22::2/64
            |--------|------|   |-------|-------|
            |      eth0     |   |     eth0      |
            |               |   |               |
            |    Ubuntu0    |   |    Ubuntu1    |
            |---------------|   |---------------|

環境設定
以下のl 3 fwd_lpm.cファイルのデフォルトルーティングテーブル項目(変更済み)、port 0のセグメントは:2001:11:0/64、port 1のセグメントは:2001:22::0/64である.以上のトポロジーは、port 0のIPアドレスが:2001:11:1:1、port 1のIPアドレスが:2001:22::1であると仮定し、もちろん、同じセグメントであれば他のアドレスを使用することもできる.
 53 static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
 54     {{0x20, 1, 0, 0x11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 0},
 55     {{0x20, 1, 0, 0x22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 1},

以下はUbuntu 0の構成で、インタフェースeth 0のIPアドレスは2001:11:2、デフォルトゲートウェイはUbuntu(DPDK)のeth 0(DPDKのport 0)に設定されています.
/ # ip -6 r add default via 2001:11::1
/ #
/ # ip -6 r
2001:11::/64 dev eth0 proto kernel metric 256 
fe80::/64 dev eth0 proto kernel metric 256 
default via 2001:11::1 dev eth0 metric 1024 

DPDKのl 3 fwdはARPを処理できないため、Ubuntu 0上でUbuntu(DPDK)のeth 0インタフェースIPアドレスに対応するMACアドレスを静的に指定する必要がある.
/ # ip -6 n add 2001:11::1 lladdr 00:60:E0:6F:C8:7D dev eth0
/ # 
/ # ip ne
2001:11::1 dev eth0 lladdr 00:60:e0:6f:c8:7d PERMANENT

以下にUbuntu 1の構成を示します.構成はUbuntu 0と似ています.そのインタフェースeth 0のIPアドレスは2001:22::2であり、デフォルトゲートウェイはUbuntu(DPDK)のeth 1(DPDKのport 1)に設定されている.
/ # ip -6 route add default via 2001:22::1
/ #
/ # ip -6 r
2001:22::/64 dev eth0 proto kernel metric 256 
fe80::/64 dev eth0 proto kernel metric 256 
default via 2001:22::1 dev eth0 metric 1024 
/ # 

DPDKのl 3 fwdはARPを処理できないため、Ubuntu 1上でUbuntu(DPDK)のeth 1インタフェースIPアドレスに対応するMACアドレスを静的に指定する必要がある.
/ # ip -6 n add 2001:22::1 lladdr 00:60:E0:6F:C8:7E dev eth0
/ #
/ # ip nei
2001:22::1 dev eth0 lladdr 00:60:e0:6f:c8:7e PERMANENT

l 3 fwdの起動
以下のコマンドでl 3 fwdルーチンを起動し、eth-destパラメータはUbuntu 0とUbuntu 1のeth 0インタフェースのMACアドレスをそれぞれ指定します.
./l3fwd -c 0x6 -- -p 0x3 -P --eth-dest=0,00:60:E0:7A:6C:78 --eth-dest=1,00:60:E0:7A:6C:79

以下の起動情報は、port 0がメッセージを送信する際に、ソースMACアドレス:00:60:E 0:6 F:C 8:7 D、宛先MACアドレス:00:60:E 0:7 A:6 C:78を使用する.port 1でメッセージを送信する場合は、ソースMACアドレス00:60:E 0:6 F:C 8:7 E、宛先MACアドレス00:60:E 0:7 A:6 C:79を使用します.
また、LPMに追加されたIPv 6ルーティング項目も見られ、元のl 3 fwdはLPM 6ルーティングテーブル項目を印刷せず、以下は自己追加と表示される.
LPM or EM none selected, default LPM on
Initializing port 0 ... Creating queues: nb_rxq=1 nb_txq=2... 
Port 0 modified RSS hash function based on hardware support,requested:0xa38c configured:0x2288
Address:00:60:E0:6F:C8:7D, Destination:00:60:E0:6D:90:76, Allocated mbuf pool on socket 0
LPM: Adding route 0x01010100 / 24 (0)
LPM: Adding route 0x02010100 / 24 (1)
LPM6: Adding route 2001:0011:0000:0000:0000:0000:0000:0000 / 64 (0)
LPM6: Adding route 2001:0022:0000:0000:0000:0000:0000:0000 / 64 (1)
txq=1,0,0 (lcoreid, queueid, socketid)txq=2,1,0 (lcoreid, queueid, socketid)
Initializing port 1 ... Creating queues: nb_rxq=1 nb_txq=2... 
Port 1 modified RSS hash function based on hardware support,requested:0xa38c configured:0x2288
Address:00:60:E0:6F:C8:7E, Destination:00:60:E0:6D:90:77, 
txq=1,0,0 (lcoreid, queueid, socketid)txq=2,1,0 (lcoreid, queueid, socketid)

Initializing rx queues on lcore 1 ... rxq=0,0,0 
Initializing rx queues on lcore 2 ... rxq=1,0,0 

Checking link statusdone
Port0 Link Up. Speed 10000 Mbps -full-duplex
Port1 Link Up. Speed 10000 Mbps -full-duplex
L3FWD: entering main loop on lcore 2
L3FWD:  -- lcoreid=2 portid=1 rxqueueid=0
L3FWD: entering main loop on lcore 1
L3FWD:  -- lcoreid=1 portid=0 rxqueueid=0

Ubuntu 0でpingホストUbuntu 1のIPアドレス:2001:22::2、返信を受け取り、リンクは通じている.