
GRE隧道和eBGP实施
1.简介
GRE(通用路由封装)隧道
- 是众多隧道协议中的一个,IP协议47
- 它也是一种VPN,但默认不提供加密(可以和IPSEC合用)
- 允许路由协议在隧道上运行
2.GRE应用场景
企业分支---互联网(GRE隧道)---企业总部
- GRE支持将一种协议的报文封装在另一种协议报文中(GRE - IPSEC)
- GRE可以解决异种网络的传输问题
3.创建GRE隧道
R1和R2之间创建GRE隧道,并运行路由协议
点到点的架构,有固定的源IP和固定IP
前提:路由两端是通的都有静态默认路由
不要把目的写成描述[HW-R1]ip route-static 0.0.0.0 0.0.0.0 GigabitEthernet0/0/0 202.100.1.2 [HW-R3]ip route-static 0.0.0.0 0.0.0.0 g0/0/1 202.100.1.6 <R1>ping 202.100.1.5 PING 202.100.1.5: 56 data bytes, press CTRL_C to break Reply from 202.100.1.5: bytes=56 Sequence=1 ttl=254 time=30 ms Reply from 202.100.1.5: bytes=56 Sequence=2 ttl=254 time=30 ms [R1]interface Tunnel 0/0/0 [R1-Tunnel0/0/0]tunnel-protocol gre #隧道的协议是GRE协议 [R1-Tunnel0/0/0]source 202.100.1.1 [R1-Tunnel0/0/0]destination 202.100.1.5 //不要写成description [R1-Tunnel0/0/0]ip address 10.1.13.1 30 [HW-R3]interface Tunnel 0/0/0 [HW-R3-Tunnel0/0/0]tunnel-protocol gre #隧道的协议是GRE协议 [HW-R3-Tunnel0/0/0]source 202.100.1.5 #隧道的源 [HW-R3-Tunnel0/0/0]destination 202.100.1.1 #隧道的目的地址 [HW-R3-Tunnel0/0/0]ip address 10.1.13.2 30 //VPN的内网地址 <HW-R3>ping 10.1.13.1 Reply from 10.1.13.1: bytes=56 Sequence=1 ttl=255 time=30 m
4.配置保活机制
配置Keepalive检测
[RTA]interface Tunnel 0/0/1 [RTA-Tunnel0/0/0]keepalive period 3
5.配置OSPF通过PC访问GRE隧道
1.建立一个邻居关系
[ar1-Tunnel0/0/0]ospf enable area 0 [AR2]ospf router-id 10.3.3.3 #写路由器ID [AR2-ospf-1]area 0 #创建区域0 [AR2-ospf-1-area-0.0.0.0]q [AR2-ospf-1]int tun 0/0/1 #隧道接口区域0运行OSPF [AR2-Tunnel0/0/1] [AR2-Tunnel0/0/1]ospf enable area 0 AR2路由器上的接口运行OSPF [AR2-Tunnel0/0/1]int g0/0/0.20 [AR2-GigabitEthernet0/0/0.20]ospf enable area 0 [AR2-Tunnel0/0/1]int g0/0/0.30 [AR2-GigabitEthernet0/0/0.30]ospf enable area 0 在AR2上查看OSPF的路由表 [AR2]display ip routing-table protocol ospf 查到PC1的路由