华为设备GRE配置

实验拓扑:

华为设备GRE配置_第1张图片

 配置思路:

①写路由器各个接口的ip地址

②向ISP写缺省

③打开Tunnel隧道

④写隧道ip地址

⑤写隧道协议为gre

⑥写source和destination       

//配置过程中写入de然后按tab第一个弹出来的是description而不是destination,注意甄别

⑦向两边环回写静态,下一跳为Tunnel0/0/0

具体配置:

[r1]int l0
[r1-LoopBack0]ip add 192.168.1.1 24
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 10.0.12.1 24

[r1]ip route-static 0.0.0.0 0 10.0.12.2

[r1]int t 0/0/0
[r1-Tunnel0/0/0]ip add 20.1.1.1 24	
[r1-Tunnel0/0/0]tunnel-protocol gre 	
[r1-Tunnel0/0/0]source 10.0.12.1
[r1-Tunnel0/0/0]destination 10.0.23.3

[r1]ip route-static 192.168.2.0 24 Tunnel 0/0/0
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 10.0.12.2 24
[r2]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip add 10.0.23.2 24
[r3]int l0 
[r3-LoopBack0]ip add 192.168.2.1 24
[r3-LoopBack0]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip add 10.0.23.3 24

[r3]ip route-static 0.0.0.0 0 10.0.23.2 

[r3]int t 0/0/0
[r3-Tunnel0/0/0]ip add 20.1.1.2 24	
[r3-Tunnel0/0/0]tunnel-protocol gre 
[r3-Tunnel0/0/0]source 10.0.23.3
[r3-Tunnel0/0/0]destination 10.0.12.1

ip route-static 192.168.1.0 24 Tunnel 0/0/0

测试:

[r3]ping -a 192.168.2.1 192.168.1.1
  PING 192.168.1.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time=50 ms
    Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time=30 ms
    Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 192.168.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/34/50 ms

如何使用动态路由来配置呢?

[r1]undo ip route-static 192.168.2.0 24 Tunnel 0/0/0

[r1]ospf 1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255

//注意:宣告的是环回口网段和tunnel网段
[r3]undo ip route-static 192.168.1.0 24 Tunnel 0/0/0

[r3]ospf 1
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255

你可能感兴趣的:(华为设备GRE配置)