![动态 NAT 配置](https://linux22.com/image/661783/%E5%8A%A8%E6%80%81%20NAT%20%E9%85%8D%E7%BD%AE.png)
我使用两个路由器和一台主机(计算机),我将路由器 A 的快速以太网 0/1 与主机连接,将路由器 A 的 fa0/0 与路由器 B 连接。我在两个路由器上都配置了网关作为最后的手段,我尝试使用路由器 B ping 主机,并且成功了,因此路径没有问题。我在路由器 A 上配置了 NAT 转换,我再次使用路由器 ping 主机,并且成功了,之后我输入了“show ip nat conversion”,但没有任何输出。这是为什么?
这是路由器 A 的“show ip nat statistics”的输出
Router#sh ip nat stat
Router#sh ip nat statistics
Total translations: 0 (0 static, 0 dynamic, 0 extended)
Outside Interfaces: FastEthernet0/0
Inside Interfaces: FastEthernet0/1
Hits: 0 Misses: 22
Expired translations: 0
Dynamic mappings:
-- Inside Source
access-list 10 pool todd refCount 0
pool todd: netmask 255.0.0.0
start 50.0.0.1 end 50.0.0.1
type generic, total addresses 1 , allocated 0 (0%), misses 0
在路由器 A 上显示运行的输出 路由器#sh run 正在构建配置...
Current configuration : 822 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface FastEthernet0/0
ip address 10.1.1.1 255.255.255.0
ip nat outside
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 10.1.2.1 255.255.255.0
ip nat inside
duplex auto
speed auto
!
interface Vlan1
no ip address
shutdown
!
ip nat pool todd 50.0.0.1 50.0.0.1 netmask 255.0.0.0
ip nat inside source list 10 pool todd overload
ip classless
ip default-network 10.0.0.0
ip route 10.0.0.0 255.0.0.0 10.1.1.2
!
ip flow-export version 9
!
!
access-list 10 permit 0.0.0.0 255.255.255.0
!
no cdp run
!
!
!
路由器B的show run输出
Router#sh run
Building configuration...
Current configuration : 651 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface Loopback0
ip address 5.5.5.5 255.0.0.0
!
interface FastEthernet0/0
ip address 10.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 0.0.0.0 0.0.0.0 FastEthernet0/0
!
ip flow-export version 9
!
!
!
!
!
答案1
在路由器 A 上,你的访问列表 10 似乎是错误的
访问列表 10 允许 0.0.0.0 255.255.255.0
做这个
配置 t
没有访问列表 10
访问列表 10 允许 10.1.2.0 0.0.0.255