具有多个 VLAN 的 PAT

网络工程 思科 局域网 纳特 数据包跟踪器
2022-02-06 01:08:25

我已经建立了一个具有 4 个 VLAN、3 个 VLAN 配置的 PAT 和 1 个 VLAN 配置的 STATIC NAT 的网络。路由器充当 DHCP 服务器。在我的路由器之外,我有另一个路由器充当“互联网”,IP 地址为 172.16.10.1 /24。

一切正常,我可以在 VLAN1 上成功进行 STATIC NAT,但是当我尝试在 VLAN2、VLAN3 和上进行 PAT 配置时它不起作用。下面是我的路由器配置:

Building configuration...

Current configuration : 1578 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R1
!
!
!
!
!
!
!
!
no ip cef
no ipv6 cef
!
!
!
username admin password 0 123
!
!
license udi pid CISCO1941/K9 sn FTX1524C1YC-
!
!
!
!
!
!
!
!
!
ip ssh version 1
ip domain-name test.com
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface GigabitEthernet0/0
 ip address 192.168.0.1 255.255.255.0
 ip nat inside
 duplex auto
 speed auto
!
interface GigabitEthernet0/0.2
 encapsulation dot1Q 2
 ip address 192.168.2.1 255.255.255.0
 ip nat inside
!
interface GigabitEthernet0/0.10
 encapsulation dot1Q 10
 ip address 192.168.10.1 255.255.255.0
 ip access-group 1 in
 ip nat inside
!
interface GigabitEthernet0/0.20
 encapsulation dot1Q 20
 ip address 192.168.20.1 255.255.255.0
 ip nat inside
!
interface GigabitEthernet0/0.30
 encapsulation dot1Q 30
 ip address 192.168.30.1 255.255.255.0
 ip nat inside
!
interface GigabitEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Serial0/1/0
 ip address 100.10.10.1 255.255.255.240
 ip nat outside
!
interface Serial0/1/1
 no ip address
 clock rate 2000000
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
router rip
!
ip nat pool route 100.10.10.100 100.10.10.100 netmask 255.255.255.240
ip nat inside source list 1 pool route overload
ip nat inside source static 192.168.2.254 100.10.10.3 
ip classless
ip route 0.0.0.0 0.0.0.0 100.10.10.2 
!
ip flow-export version 9
!
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login local
 transport input ssh
!
!
!
end

谢谢

1个回答

假设您想要使用 VLAN 3 和 VLAN 4 作为您的 LAN 网络并想要配置 pat natting 以访问互联网,并假设 VLAN 1 用于 DMZ 网络以托管需要静态 NAT 的应用程序。

路由器中子接口的配置。例如在路由器子接口配置中:

Int g0/0.3
Encapsulation dot1Q 3
Ip address 192.168.2.1 255.255.255.0
Ip nat inside
No shutdown

Int g0/0.4
Encapsulation dot1Q 4
Ip address 192.168.10.1 255.255.25&.0
Ip nat inside 
No shutdown

PAT(端口地址转换)

端口地址转换始终是出站流量

Router(config) access-list 1 permit ip 192.168.2 .0 0.255.255.255
Router(config) access-list 1 permit ip 192.168.10.0 0.255.255.255
Router(config) ip nat inside source list 1 interfàce serial 0/1/0 overload 

PAT 是来源 natting。当流量从内部流向外部(出站流量)时,源私有 IP 被转换为接口 S0/1/0 的地址。

用于从 Internet 访问 DMZ 托管服务器应用程序的静态 NAT 配置:

假设内部服务器在 VLAN1 上并且假设 IP 是 192.168.0.5:

来自 ISP 的公共 IP 为:100.10.10.5

Router(config)# ip nat inside source static 192.168.0.5 100.10.10.5 

静态 NAT 主要被认为是目标 NAT。