簡介
本文檔介紹如何通過示例配置在Cisco IOS®裝置上實施靜態NAT-PT。在本示例中,IPv6網路節點通過IPv6字首和IPv4地址之間的靜態對映與IPv4網路節點通訊。此靜態對映在網路地址轉換 — 協定轉換(NAT-PT)路由器上配置。
NAT-PT功能是IPv6到IPv4的轉換機制,允許僅支援IPv6的裝置與僅支援IPv4的裝置通訊,反之亦然。與傳統IPv4 NAT類似,NAT-PT允許靜態、動態和埠地址轉換(PAT)操作,以促進僅IPv6網路和僅IPv4網路之間的直接通訊。
必要條件
需求
思科建議您瞭解以下主題:
-
NAT概念和操作的基本知識。
-
IPv6編址方案基礎知識
-
IPv6靜態路由基礎知識
附註:NAT-PT被IETF視為已棄用,因為它與域名系統(DNS)緊密耦合,並且在轉換方面普遍存在限制,而且已被證明為技術過於複雜,無法維護可擴展的轉換服務。隨著NAT-PT的棄用以及使用者之間的IPv6過渡的不斷增加,NAT64開始出現。有關NAT64的詳細資訊,請參閱以下文檔:
- NAT64技術:連線IPv6和IPv4網路
- NAT64 — 無狀態與有狀態比較
- IPv6有狀態NAT64配置示例
採用元件
本檔案中的組態是根據Cisco IOS軟體版本12.4(15)T 13上的Cisco 3700系列路由器。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
設定
在本示例中,三台路由器(R1、R2和R3)通過串列介面連線。R1充當NAT-PT路由器,它使用IPv4地址連線到R2,使用IPv6地址連線到R3。
附註:思科快速轉發(CEF)不支援NAT-PT。必須禁用CEF才能使NAT-PT按預期工作。
網路圖表
此範例使用網路設定,如下圖所示:
組態
此示例使用以下配置:
R1配置 |
hostname R1
ipv6 unicast-routing
!
interface Serial0/0
ip address 192.168.30.10 255.255.255.0
duplex auto
speed auto
ipv6 nat
!
interface Serial0/1
no ip address
duplex auto
speed auto
ipv6 address 2001:DB8:3002::9/64
ipv6 enable ipv6 nat
!
ipv6 route ::/0 2001:DB8:3002::10
ipv6 nat v4v6 source 192.168.30.9 2000::960B:202
!--- Translates the ipv4 add of R2 fa0/0 to ipv6 address.
ipv6 nat v6v4 source 3001:11:0:1::1 150.11.3.1
!--- Translates the ipv6 add of loop0 of R3 to ipv4 address.
ipv6 nat prefix 2000::/96
!--- The destination prefixes that matches 2000::/96 !--- are translated by NAT-PT.
!
end |
R2配置 |
hostname R2
!
interface Serial0/0
ip address 192.168.30.9 255.255.255.0
duplex auto
speed auto
!
ip route 0.0.0.0 0.0.0.0 192.168.30.10
!
!
end |
R3配置 |
hostname R3
ipv6 unicast-routing
!
interface Loopback0
no ip address
ipv6 address 3001:11:0:1::1/64
!
interface Serial0/0
no ip address
duplex auto
speed auto
ipv6 address 2001:DB8:3002::10/64
!
ipv6 route ::/0 2001:DB8:3002::9
! |
驗證
使用本節內容,確認您的組態是否正常運作。
路由器R3中
R3生成的ICMP回應請求資料包源自R3的Loopback0介面(3001:11:0:1::1)的IPv6地址,應使用IPv6地址2000::960B:202到達R2的Serial0/0介面(192.168.30.9)的IPv4地址。此處提供了一個工作示例:
Ping |
R3#ping 2000::960b:202 source Loopback0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2000::960B:202, timeout is 2 seconds:
Packet sent with a source address of 3001:11:0:1::1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/60/124 ms
!--- This shows that the router R3 is able to reach !--- the router R2 through lo address 3001:11:0:1::1.
|
路由器R2中
R2生成的ICMP回應請求資料包(自動源自192.168.30.9,這是R2的Serial0/0介面的IPv4地址)應使用IPv4地址150.11.3.1到達R3的Loopback0介面(3001:11:0:1::1)的IPv6地址。此處顯示了一個工作示例:
Ping |
R2#ping 150.11.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.11.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/68/120 ms
!--- The successful ping response shows that the router R2 !--- is able to reach the IPv6 network.
|
在路由器R1中
在R1上,可以通過show ipv6 nat translations命令的輸出觀察R2和R3之間的活動NAT-PT轉換。
show ipv6 nat translations |
R1#show ipv6 nat translations
Prot IPv4 source IPv6 source
IPv4 destination IPv6 destination
--- --- ---
192.168.30.9 2000::960B:202
--- 150.11.3.1 3001:11:0:1::1
--- ---
R1#show ipv6 nat translations
Prot IPv4 source IPv6 source
IPv4 destination IPv6 destination
--- --- ---
192.168.30.9 2000::960B:202
--- 150.11.3.1 3001:11:0:1::1
--- ---
!--- This command displays the active NAT-PT translations in the router.
|
使用debug ipv6 nat detailed命令啟用詳細的IPv6 NAT調試,而R2和R3之間的ICMP ping顯示R1按照預期轉換流量。
debug ipv6 nat detailed |
R1#debug ipv6 nat detailed
R1#
*Mar 1 09:12:41.877: IPv6 NAT: Found prefix 2000::/96
*Mar 1 09:12:41.881: IPv6 NAT: IPv4->IPv6:
src (192.168.30.9 -> 2000::960B:202)
dst (0.0.0.0 -> ::)
ref_count = 1, usecount = 0, flags = 513,
rt_flags = 0, more_flags = 0
*Mar 1 09:12:41.881: IPv6 NAT: IPv4->IPv6:
src (0.0.0.0 -> ::)
dst (150.11.3.1 -> 3001:11:0:1::1)
ref_count = 1, usecount = 0, flags = 257,
rt_flags = 0, more_flags = 0
*Mar 1 09:12:41.925: IPv6 NAT: IPv6->IPv4:
src (3001:11:0:1::1 -> 150.11.3.1)
dst (2000::960B:202 -> 192.168.30.9)
ref_count = 1, usecount = 0, flags = 2,
rt_flags = 0, more_flags = 0
*Mar 1 09:12:41.925: IPv6 NAT: icmp src (3001:11:0:1::1) -> (150.11.3.1),
dst (2000::960B:202) -> (192.168.30.9)
*Mar 1 09:12:41.965: IPv6 NAT: Found prefix 2000::/96
*Mar 1 09:12:41.965: IPv6 NAT: IPv4->IPv6:
src (192.168.30.9 -> 2000::960B:202)
dst (150.11.3.1 -> 3001:11:0:1::1)
ref_count = 1, usecount = 0, flags = 2,
rt_flags = 0,
!--- This command displays detailed information about NAT-PT events.
|
|
疑難排解
目前尚無適用於此組態的具體疑難排解資訊。
相關資訊