通过单个接口进行 NAT?

网络工程 思科 路由 路由器 纳特 数据包跟踪器
2022-02-26 15:32:00

我想将静态 NAT 应用于 KLRTR 路由器上突出显示的服务器,但问题是接口 s0/0/0 上有帧中继的子接口 (S0/0/0.203)。所以我在 S0/0/0.203 的子接口上应用了 NAT,但是子接口 s0/0/0.203 已经分配了一个 IP(NAT IP 与 KL_ISP 和 KLRTR 之间的 IP 不同),所以它没有像 NAT 翻译一样工作,但发件人没有收到 ping 响应。

在模拟模式模式下,KL_ISP 的数据包失败,不知道为什么即使我在 KL_ISP 上设置了静态路由以进入网络并且其他设备能够 ping。

如果我从 Internet Web 服务器 ping 到其内部本地 IP 上的 DHCP 服务器,则 ping 成功但在外部全局 IP 上 ping 失败。

我将 IP 地址应用于 S0/0/0,然后在其上应用了 NAT,但这也不起作用。

有没有其他方法可以解决这个问题。

在此处输入图像描述

谢谢你

KLRTR 配置:

KLRTR#sh run
Building configuration...

Current configuration : 2077 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
service password-encryption
!
hostname KLRTR
!
enable secret 5 $1$mERr$hx5rVt7rPNoS4wqbXKX7m0
!
ip dhcp excluded-address 10.11.2.1 10.11.2.3
!
ip dhcp pool VLANSalesOnly
 network 10.11.2.0 255.255.255.0
 default-router 10.11.2.1
 dns-server 10.11.5.11
!
no ip cef
no ipv6 cef
!
username KLISP password 7 0822455D0A16
!
no ip domain-lookup
!
spanning-tree mode pvst
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface FastEthernet0/1
 no ip address
 duplex auto
 speed auto
!
interface FastEthernet0/1.19
 description Subinterface for VLAN 19 WLAN for security group
 encapsulation dot1Q 19
 ip address 10.11.4.225 255.255.255.248
!
interface FastEthernet0/1.188
 description Subinterface for VLAN 188 SalesOnly group
 encapsulation dot1Q 188
 ip address 10.11.2.1 255.255.255.0
!
interface FastEthernet0/1.199
 description Subinterface for VLAN 199 switch Management
 encapsulation dot1Q 199
 ip address 10.11.4.201 255.255.255.248
!
interface Serial0/0/0
 ip address 172.168.0.10 255.255.0.0 *ADDED FOR TESTING PURPOSE ONLY
 encapsulation frame-relay
 ip nat inside
!
interface Serial0/0/0.201 point-to-point
 ip address 10.11.4.250 255.255.255.252
 frame-relay interface-dlci 201
 clock rate 2000000
!
interface Serial0/0/0.203 point-to-point
 ip address 10.11.4.253 255.255.255.252
 frame-relay interface-dlci 203
 clock rate 2000000
!
interface Serial0/0/1
 ip address 195.9.16.18 255.255.255.252
 encapsulation ppp
 ppp authentication chap
 ip nat outside
!
interface Vlan1
 no ip address
 shutdown
!
router eigrp 1
 redistribute static 
 network 10.0.0.0
 network 195.9.16.0
 no auto-summary
!
ip nat inside source static 10.11.4.242 160.12.0.1 
ip nat inside source static 10.11.4.243 160.12.0.2 
ip classless
ip route 0.0.0.0 0.0.0.0 195.9.16.17 
!
ip flow-export version 9
!
line con 0
 password 7 0822455D0A16
 login
!
line aux 0
!
line vty 0 4
 password 7 0822455D0A16
 login
line vty 5 15
 password 7 0822455D0A16
 login
!
end

KL_ISP 配置:

KLISP#sh run
Building configuration...

Current configuration : 877 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname KLISP
!
no ip cef
no ipv6 cef
!
username KLRTR password 0 cisco
!
no ip domain-lookup
!
spanning-tree mode pvst
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface FastEthernet0/1
 ip address 154.10.12.49 255.255.255.240
 duplex auto
 speed auto
!
interface Serial0/0/0
 ip address 195.9.16.17 255.255.255.252
 encapsulation ppp
 ppp authentication chap
 clock rate 2000000
!
interface Serial0/0/1
 no ip address
 clock rate 2000000
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
ip classless
ip route 10.11.0.0 255.255.0.0 Serial0/0/0 
!
ip flow-export version 9
!
no cdp run
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
end
1个回答

您的内部接口被分配给没有 IP 寻址的接口。事实上,您的任何一个 NAT 语句的地址都没有地址,因此具有这些源地址的数据包必须从其他地方进入您的一个接口。您需要将ip nat inside语句放在流量进入路由器的接口上,并且这不可能是没有分配 IP 地址的接口。

编辑:

您现在已经为内部接口分配了一个 IP 地址,但是具有您的 NAT 语句中列出的源地址的数据包进入路由器的接口是该接口吗?

编辑:

根据您的评论,您的外部路由器 (KLISP) 没有到已转换地址的路由,因此它将丢弃发往这些地址的数据包。您必须通知 KLISP 将发往这些地址的数据包发送到195.9.16.18. 您可以使用静态配置的路由或使用路由协议动态地做到这一点。