地址表
设备 | 接口 | IP地址 | 子网掩码 | 默认网关 |
RA | G0 / 0 | 192.168.1.1 | 255.255.255.0 | 不适用 |
S0 / 0/0 | 64.103.211.2 | 255.255.255.252 | 不适用 | |
隧道0 | 10.10.10.1 | 255.255.255.252 | 不适用 | |
RB | G0 / 0 | 192.168.2.1 | 255.255.255.0 | 不适用 |
S0 / 0/0 | 209.165.122.2 | 255.255.255.252 | 不适用 | |
隧道0 | 10.10.10.2 | 255.255.255.252 | 不适用 | |
个人电脑 | 网卡 | 192.168.1.2 | 255.255.255.0 | 192.168.1.1 |
电脑 | 网卡 | 192.168.2.2 | 255.255.255.0 | 192.168.2.1 |
目标
第1部分:验证路由器连接性
第2部分:配置GRE隧道
第3部分:验证PC连接
情境
您是一家公司的网络管理员,该公司希望建立到远程办公室的GRE隧道。这两个网络都是本地配置的,只需要配置隧道即可。
第1部分:验证路由器连接性
步骤1:从RB ping RA。
- 在RA上使用show ip interface brief命令,确定S0 / 0/0端口的IP地址。
- 从RB ping到RA的IP S0 / 0/0地址。
步骤2:从PCB ping PCA。
尝试从PCB ping PCA的IP地址。配置GRE隧道后,我们将重复此测试。ping结果是什么?为什么?
ping操作失败,因为没有到目的地的路由。
第2部分:配置GRE隧道
步骤1:配置RA的Tunnel 0接口。
a.进入 RA 隧道 0 的配置模式。
RA(config)# interface tunnel 0
b.按照地址分配表设置 IP 地址。
RA(config-if)# ip address 10.10.10.1 255.255.255.252
c.为隧道 0 的终端设置源和目标。
RA(config-if)# tunnel source s0/0/0
RA(config-if)# tunnel destination 209.165.122.2
d.将隧道 0 配置为通过 GRE 传递 IP 流量。
RA(config-if)# tunnel mode gre ip
e.隧道 0 接口应已处于活动状态。如果不是,则采用与其他任何接口相同的处理方式。
RA(config-if)# no shutdown
步骤2:配置RB的Tunnel 0接口。
用RB重复步骤1a – e 。确保适当更改IP地址。
RB(config)# interface tunnel 0
RB(config-if)# ip address 10.10.10.2 255.255.255.252
RB(config-if)# tunnel source s0/0/0
RB(config-if)# tunnel destination 64.103.211.2
RB(config-if)# tunnel mode gre ip
RB(config-if)# no shutdown
步骤3:配置专用IP流量的路由。
使用10.10.10.0/30网络作为目的地,在192.168.XX网络之间建立路由。
RA(config)# ip route 192.168.2.0 255.255.255.0 10.10.10.2
RB(config)# ip route 192.168.1.0 255.255.255.0 10.10.10.1
第3部分:验证路由器连接性
步骤1:从PCB ping PCA。
尝试从PCB ping PCA的IP地址。ping应该成功。
步骤2:追踪从PCA到PCB的路径。
尝试跟踪从PCA到PCB的路径。请注意,输出中缺少公共IP地址。
设备配置
路由器RA
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
hostname RA
license udi pid CISCO2911/K9 sn FTX15242579
spanning-tree mode pvst
interface Tunnel0
ip address 10.10.10.1 255.255.255.252
tunnel source Serial0/0/0
tunnel destination 209.165.122.2
tunnel mode gre ip
interface GigabitEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
interface GigabitEthernet0/1
no ip address
duplex auto
speed auto
shutdown
interface GigabitEthernet0/2
no ip address
duplex auto
speed auto
shutdown
interface Serial0/0/0
ip address 64.103.211.2 255.255.255.252
interface Serial0/0/1
no ip address
shutdown
interface Vlan1
no ip address
shutdown
ip classless
ip route 192.168.2.0 255.255.255.0 10.10.10.2
ip route 0.0.0.0 0.0.0.0 Serial0/0/0
line con 0
line aux 0
line vty 0 4
login
end
路由器RB
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
license udi pid CISCO2911/K9 sn FTX152497Z4
spanning-tree mode pvst
interface Tunnel0
ip address 10.10.10.2 255.255.255.252
tunnel source Serial0/0/0
tunnel destination 64.103.211.2
tunnel mode gre ip
interface GigabitEthernet0/0
ip address 192.168.2.1 255.255.255.0
duplex auto
speed auto
interface GigabitEthernet0/1
no ip address
duplex auto
speed auto
shutdown
interface GigabitEthernet0/2
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0/0
ip address 209.165.122.2 255.255.255.252
!
interface Serial0/0/1
no ip address
shutdown
interface Vlan1
no ip address
shutdown
ip classless
ip route 192.168.1.0 255.255.255.0 10.10.10.1
ip route 0.0.0.0 0.0.0.0 Serial0/0/0
line con 0
line aux 0
line vty 0 4
login
end