我已经使用以下命令在 Dublin 和 Carlow 路由器之间配置了 GRE 隧道:
//Carlow
int tunnel 0
ip address 172.16.12.1 255.255.255.252
tunnel source s0/0/0
tunnel destination 87.44.50.6
//Dublin
int tunnel 0
ip address 172.16.12.2 255.255.255.252
tunnel source s0/0/0
tunnel destination 87.44.50.2
隧道的网络地址为 172.16.12.0/30(都柏林 = 172.16.12.2,卡洛 = 172.16.12.1)。
Ping 通过隧道成功,因此我尝试配置 OSPF 以允许 LAN 之间的路由。
我使用以下命令来配置 OSPF:
//Carlow
router ospf 2
network 172.16.12.0 0.0.0.3 area 0
network 87.44.50.24 0.0.0.7 area 0
//Dublin
router ospf 2
network 172.16.12.0 0.0.0.3 area 0
network 87.44.50.16 0.0.0.7 area 0
到目前为止,此配置的结果是:
在 Carlow 路由器上,通过 172.16.12.1(都柏林路由器上的隧道接口)添加了到 87.44.50.16 的 OSPF 路由
在 Dublin 路由器上,没有添加任何 OSPF 路由。
我将在每个路由器的运行配置下方添加 OSPf
卡洛:
router ospf 2
log-adjacency-changes
network 172.16.12.0 0.0.0.3 area 0
network 84.44.50.24 0.0.0.7 area 0
!
router ospf 1
log-adjacency-changes
network 87.44.50.4 0.0.0.3 area 0
都柏林:
router ospf 2
log-adjacency-changes
network 172.16.12.0 0.0.0.3 area 0
network 87.44.50.16 0.0.0.7 area 0
!
router ospf 1
log-adjacency-changes
network 87.44.50.0 0.0.0.3 area 0
根据要求,我将为每个路由器添加完整的配置和路由表。
卡洛配置
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
no ip cef
no ipv6 cef
!
license udi pid CISCO2901/K9 sn FTX1524Z6TY-
!
spanning-tree mode pvst
!
interface Tunnel0
ip address 172.16.12.2 255.255.255.252
mtu 1476
tunnel source Serial0/0/0
tunnel destination 87.44.50.2
!
interface GigabitEthernet0/0
ip address 87.44.50.25 255.255.255.252
duplex auto
speed auto
!
interface GigabitEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0/0
ip address 87.44.50.6 255.255.255.252
clock rate 2000000
!
interface Serial0/0/1
no ip address
clock rate 2000000
shutdown
!
interface Vlan1
no ip address
shutdown
!
router ospf 2
log-adjacency-changes
network 172.16.12.0 0.0.0.3 area 0
network 84.44.50.24 0.0.0.7 area 0
!
router ospf 1
log-adjacency-changes
network 87.44.50.4 0.0.0.3 area 0
!
ip classless
ip route 0.0.0.0 0.0.0.0 87.44.50.5
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
end
Carlow - 路由表
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 87.44.50.5 to network 0.0.0.0
87.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C 87.44.50.4/30 is directly connected, Serial0/0/0
L 87.44.50.6/32 is directly connected, Serial0/0/0
O 87.44.50.16/30 [110/1001] via 172.16.12.1, 00:04:36, Tunnel0
C 87.44.50.24/30 is directly connected, GigabitEthernet0/0
L 87.44.50.25/32 is directly connected, GigabitEthernet0/0
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.12.0/30 is directly connected, Tunnel0
L 172.16.12.2/32 is directly connected, Tunnel0
S* 0.0.0.0/0 [1/0] via 87.44.50.5
都柏林 - 配置
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
no ip cef
no ipv6 cef
!
license udi pid CISCO2901/K9 sn FTX152479Q8-
license boot module c2900 technology-package securityk9
!
spanning-tree mode pvst
!
interface Tunnel0
ip address 172.16.12.1 255.255.255.252
mtu 1476
tunnel source Serial0/0/0
tunnel destination 87.44.50.6
!
interface GigabitEthernet0/0
ip address 87.44.50.17 255.255.255.252
duplex auto
speed auto
!
interface GigabitEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0/0
ip address 87.44.50.2 255.255.255.252
clock rate 2000000
!
interface Serial0/0/1
no ip address
clock rate 2000000
shutdown
!
interface Vlan1
no ip address
shutdown
!
router ospf 2
log-adjacency-changes
network 172.16.12.0 0.0.0.3 area 0
network 87.44.50.16 0.0.0.7 area 0
!
router ospf 1
log-adjacency-changes
network 87.44.50.0 0.0.0.3 area 0
!
ip classless
ip route 0.0.0.0 0.0.0.0 87.44.50.1
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
end
都柏林 - 路由表
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 87.44.50.1 to network 0.0.0.0
87.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 87.44.50.0/30 is directly connected, Serial0/0/0
L 87.44.50.2/32 is directly connected, Serial0/0/0
C 87.44.50.16/30 is directly connected, GigabitEthernet0/0
L 87.44.50.17/32 is directly connected, GigabitEthernet0/0
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.12.0/30 is directly connected, Tunnel0
L 172.16.12.1/32 is directly connected, Tunnel0
S* 0.0.0.0/0 [1/0] via 87.44.50.1