R4为公网,R1-R3建立全网拓扑,使用ospf协议私网可达
拓扑如下
R1-R4为14.1.1.0/24网段,R2-R4为24.1.1.0/24网段,R3-R4为34.1.1.0/24网段
R1换回为1.1.1.1,R2换回为2.2.2.2,R3换回为3.3.3.3,R4换回为4.4.4.4
一、配置私公网IP
二、R1-R3构建MGRE网络,每个占点即使中心也是分支
R1:使用静态配置nhrp邻居
interface Tunnel0/0/0 ip address 10.1.1.1 255.255.255.0 tunnel-protocol gre p2mp source 14.1.1.1 ospf network-type broadcast nhrp network-id 10 nhrp entry 10.1.1.2 24.1.1.1 register nhrp entry 10.1.1.3 34.1.1.1 registerR2:使用静态配置nhrp邻居
interface Tunnel0/0/0 ip address 10.1.1.2 255.255.255.0 tunnel-protocol gre p2mp source 24.1.1.1 ospf network-type broadcast nhrp network-id 10 nhrp entry 10.1.1.3 34.1.1.1 register nhrp entry 10.1.1.1 14.1.1.1 registerR3:使用静态配置nhrp邻居
interface Tunnel0/0/0 ip address 10.1.1.3 255.255.255.0 tunnel-protocol gre p2mp source 34.1.1.1 ospf network-type broadcast nhrp network-id 10 nhrp entry 10.1.1.1 14.1.1.1 register nhrp entry 10.1.1.2 24.1.1.1 register三、所有路由器都向R4指缺省(R2\R3以此类推)
ip route-static 0.0.0.0 0.0.0.0 14.1.1.2四、使用ospf进行宣告(将tunnel也宣告进ospf)
R1
ospf 1 router-id 1.1.1.1 area 0.0.0.0 network 1.1.1.1 0.0.0.0 network 10.1.1.1 0.0.0.0R2
ospf 1 router-id 2.2.2.2 area 0.0.0.0 network 2.2.2.2 0.0.0.0 network 10.1.1.2 0.0.0.0R3
ospf 1 router-id 3.3.3.3 area 0.0.0.0 network 3.3.3.3 0.0.0.0 network 10.1.1.3 0.0.0.0内网全部可达