1、R4所在部分为公网,R1-3建立全网连网状拓扑,使用ospf所有私有网段互通
此时公网互通
R1
[r1-Tunnel0/0/0]dis th [V200R003C00] # interface Tunnel0/0/0 ip address 10.1.1.1 255.255.255.0 tunnel-protocol gre p2mp source 14.1.1.2 ospf network-type broadcast nhrp entry multicast dynamic nhrp network-id 100 #R2
[r2-Tunnel0/0/0]dis th [V200R003C00] # interface Tunnel0/0/0 ip address 10.1.1.2 255.255.255.0 tunnel-protocol gre p2mp source 24.1.1.2 ospf network-type broadcast nhrp entry multicast dynamic nhrp network-id 100 nhrp entry 10.1.1.1 14.1.1.2 register nhrp entry 10.1.1.3 34.1.1.2 register # returnR3
[r3-Tunnel0/0/0]dis th [V200R003C00] # interface Tunnel0/0/0 ip address 10.1.1.3 255.255.255.0 tunnel-protocol gre p2mp source 34.1.1.2 ospf network-type broadcast nhrp entry multicast dynamic nhrp network-id 100 nhrp entry 10.1.1.1 14.1.1.2 register # returnR1:
[r1-ospf-1]dis th [V200R003C00] # ospf 1 router-id 1.1.1.1 area 0.0.0.0 network 10.1.1.0 0.0.0.255 network 192.168.1.0 0.0.0.255 # returnR2:
[r2-ospf-1]dis th [V200R003C00] # ospf 1 router-id 2.2.2.2 area 0.0.0.0 network 10.1.1.0 0.0.0.255 network 192.168.2.0 0.0.0.255 # returnR3:
[r3-ospf-1]dis th [V200R003C00] # ospf 1 router-id 3.3.3.3 area 0.0.0.0 network 10.1.1.0 0.0.0.255 network 192.168.3.0 0.0.0.255 # return修改tunnel接口方式为broadcast
[r1]int t0/0/0 [r1-Tunnel0/0/0]ospf network-type broadcast [r2]int t0/0/0 [r2-Tunnel0/0/0]ospf network-type broadcast [r3]int t0/0/0 [r3-Tunnel0/0/0]ospf network-type broadcast此时内网互通
R1:
[r1]acl 2000 [r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255 [r1-acl-basic-2000]int s4/0/0 [r1-Serial4/0/0]nat outbound 2000R2:
[r2]acl 2000 [r2-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255 [r2-acl-basic-2000]int s4/0/0 [r2-Serial4/0/0]nat outbound 2000R3:
[r3]acl 2000 [r3-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255 [r3-acl-basic-2000]int s4/0/0 [r3-Serial4/0/0]nat outbound 2000