1、拓扑图
lsw2和ar1采用ospf实现局域网互通,ar1通过PAT将局域网内数据包转发到公网,可以访问模拟公网路由AR2的IP:10.10.1.2
局域网配置vlan和ip
LSW2
interface Vlanif1
ip address 192.168.1.2 255.255.255.0
#
interface Vlanif10
ip address 192.168.10.1 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
#
AR1
interface GigabitEthernet0/0/0
ip address 192.168.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.10.1.1 255.255.255.0
AR2
interface GigabitEthernet0/0/0
ip address 10.10.1.2 255.255.255.0
宣告局域网被ospf路由
LSW2
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.10.0 0.0.0.255
AR1
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
分别在LSW2和AR1添加默认路由
LSW2
ip route-static 0.0.0.0 0.0.0.0 192.168.1.1
AR1
ip route-static 0.0.0.0 0.0.0.0 10.10.1.2
在AR1配置PAT
acl number 2000
rule 5 permit source 192.168.10.0 0.0.0.255
interface GigabitEthernet0/0/1
nat outbound 2000
测试结果:
转载于:https://blog.51cto.com/dragon123/1680113