日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

VPP靜態映射實現DNAT

作者:redwingz 更新時間: 2022-08-15 編程語言

接口基本配置:

DBGvpp# set interface state port7 up
DBGvpp# set interface state port8 up
DBGvpp# set interface ip address port7 50.1.1.1/24
DBGvpp# set interface ip address port8 192.168.1.203/24

網絡拓撲:

|-----------|         |------------|           |---------------|
| 50.1.1.2  |---------|    vpp     |------|----| 192.168.1.103 |
|-----------|         |------------|      |    |---------------|
   Host-A           port7        port8    |         Host-B
                                          |
                                          |    |---------------|
                                          |----| 192.168.1.114 |
                                               |---------------|
                                                Host-C(FTP-Server)

啟用NAT44配置:

DBGvpp# nat44 enable 

如下192.168.1.203為接口port8的真實IP地址,執行DNAT。配置與以上的SNAT一致,都是使用VPP的靜態地址映射。

# nat44 add address 192.168.1.203
# set interface nat44 in port7 out port8
# nat44 add static mapping local 50.1.1.2 external 192.168.1.203
#
# show nat44 static mappings
NAT44 static mappings:
 local 50.1.1.2 external 192.168.1.203 vrf 0
#
# show nat44 interfaces
NAT44 interfaces:
 port8 out
#
# show nat44 addresses
NAT44 pool addresses:
192.168.1.203
  tenant VRF independent

執行192.168.1.103 -> ping -> 192.168.1.203:

  1. 在主機50.1.1.2抓包,可見報文: 192.168.1.103->50.1.1.2,執行了目的地址的替換。
    2)在主機192.168.1.103抓包,可見報文: 192.168.1.203->192.168.1.103,執行了源地址的替換。

如下NAT會話所示:

# show nat44 sessions
NAT44 ED sessions:
-------- thread 0 vpp_main: 2 sessions --------
    i2o 50.1.1.2 proto ICMP port 41039 fib 0
    o2i 192.168.1.203 proto ICMP port 41039 fib 0
       external host 192.168.1.103:0
       i2o flow: match: saddr 50.1.1.2 sport 41039 daddr 192.168.1.103 dport 41039 proto ICMP fib_idx 0 rewrite: saddr 192.168.1.203 icmp-id 41039
       o2i flow: match: saddr 192.168.1.103 sport 41039 daddr 192.168.1.203 dport 41039 proto ICMP fib_idx 0 rewrite: daddr 50.1.1.2 icmp-id 41039 txfib 0
       index 0
       last heard 254.15
       total pkts 5, total bytes 420
       static translation

原文鏈接:https://blog.csdn.net/sinat_20184565/article/details/126217548

欄目分類
最近更新