先来一段配置吧,很简单的
ASR1002-15#show running-config interface gigabitEthernet 0/0/0
Building configuration...
Current configuration : 130 bytes
!
interface GigabitEthernet0/0/0
ip address 5.1.0.1 255.255.255.0
ip nat inside
negotiation auto
ipv6 enable
cdp enable
end
ASR1002-15#show running-config interface gigabitEthernet 0/0/1
Building configuration...
Current configuration : 132 bytes
!
interface GigabitEthernet0/0/1
ip address 50.1.1.1 255.255.255.0
ip nat outside
negotiation auto
ipv6 enable
cdp enable
end
ASR1002-15#show run
ASR1002-15#show running-config | s ip nat
ip nat inside
ip nat outside
<strong>ip nat inside source static 5.1.0.10 50.1.1.22</strong>
因为使用了VOICE流量,SIP ALG自动触发, 因此,存在3个数据流,一个是5060端口的SIP数据包,一个是RTP, 一个是RTCP。
ASR1002-15#show ip nat translations
Pro Inside global Inside local Outside local Outside global
--- 50.1.1.22 5.1.0.10 --- ---
udp 50.1.1.22:6058 5.1.0.10:6058 50.1.1.11:6058 50.1.1.11:6058
udp 50.1.1.22:6059 5.1.0.10:6059 50.1.1.11:6059 50.1.1.11:6059
<strong>udp 50.1.1.22:5060 5.1.0.10:5060 50.1.1.11:5060 50.1.1.11:5060</strong>
Total number of translations: 4
ASR1002-15#
很明显,inside local地址翻译成了inside global地址
此外,因为是ALG流量,NAT特意为ALG开了door,方便RTP以及RTCP通过
ASR1002-15#show platform hardware qfp active feature nat datapath door
DOOR global stats: door_count 2 door_limit_fail_count 0
Door 0x89b9f220 IL:5.1.0.10 IG:50.1.1.22 OL:50.1.1.11 OG:50.1.1.11 ILP:0 IGP:0 OLP:5060 OGP:5060 proto 17 flags 0x200 vrf_id 0 idx 2140
Door 0x89b9f1c0 IL:5.1.0.10 IG:50.1.1.22 OL:50.1.1.11 OG:50.1.1.11 ILP:5060 IGP:5060 OLP:0 OGP:0 proto 17 flags 0x100 vrf_id 0 idx 2843
ASR1002-15#
由于是static NAT的缘故,在固定IP 地址基础上,还生产了一条新的记录。
这样,从outside那边可以直接ping到50.1.1.22了。这是static nat特有的
ASR1002-15#show ip alias
Load for five secs: 2%/0%; one minute: 2%; five minutes: 2%
Time source is NTP, *18:17:49.406 CST Fri Sep 12 2014
Address Type IP Address Port
Interface 5.1.0.1
Interface 10.74.30.172
Interface 50.1.1.1
<strong>Dynamic 50.1.1.22</strong>
Interface 192.168.1.2
ASR1002-15#