GRE实验

image-20230718211817249

实验步骤:

第一步:配置IP地址

R1配置:

[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[R1]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 12.1.1.1 24

R2配置

[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[R2]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip address 23.1.1.2 24

R3配置

[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip address 23.1.1.3 24
[R3]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip address 34.1.1.3 24

R4配置

[R4]interface g0/0/0    
[R4-GigabitEthernet0/0/0]ip address 34.1.1.4 24
[R4]interface g0/0/1
[R4-GigabitEthernet0/0/1]ip address 192.168.2.1 24
​

第二步:公网路由配置,此处采用OSPF

R2配置

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0   
[R2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255  
[R2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255

R3配置

[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255

第三步:配置内网缺省路由

R1配置

[R1]ip route-static 0.0.0.0 0 12.1.1.2

R4配置

[R4]ip route-static 0.0.0.0 0 34.1.1.3

第四步:配置NAT

R1配置

[R1]acl 2000
[R1-acl-basic-2000]rule 1 permit source any 
[R1-acl-basic-2000]q
[R1]interface g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000

R4配置

[R4]acl 2000
[R4-acl-basic-2000]rule 1 permit source any 
[R4-acl-basic-2000]q
[R4]interface g0/0/0
[R4-GigabitEthernet0/0/0]nat outbound 2000

第五步:配置GRE

R1配置

[R1]interface Tunnel 0/0/0                    //创建隧道口
[R1-Tunnel0/0/0]tunnel-protocol gre           //定义封装方式为GRE
[R1-Tunnel0/0/0]ip address 10.1.1.1 24        //配置隧道IP地址
[R1-Tunnel0/0/0]source 12.1.1.1               //定义封装内容源
[R1-Tunnel0/0/0]destination 34.1.1.4          //定义封装内容目标

R4配置

[R4]interface Tunnel 0/0/0
[R4-Tunnel0/0/0]tunnel-protocol gre
[R4-Tunnel0/0/0]ip address 10.1.1.2 24
[R4-Tunnel0/0/0]source 34.1.1.4
[R4-Tunnel0/0/0]destination 12.1.1.1

第六步:书写静态路由指向隧道

[R1]ip route-static 192.168.2.0 24 Tunnel 0/0/0
[R4]ip route-static 192.168.1.0 24 Tunnel 0/0/0

第七步:测试

PC>ping 192.168.2.2
​
Ping 192.168.2.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
From 192.168.2.2: bytes=32 seq=3 ttl=126 time=47 ms
From 192.168.2.2: bytes=32 seq=4 ttl=126 time=31 ms
From 192.168.2.2: bytes=32 seq=5 ttl=126 time=47 ms
​
--- 192.168.2.2 ping statistics ---
  5 packet(s) transmitted
  3 packet(s) received
  40.00% packet loss
  round-trip min/avg/max = 0/41/47 ms

第八步:抓包

猜你喜欢

转载自blog.csdn.net/m0_72210904/article/details/131827978
gre