发新话题
打印

[网络转载] OE2路由选路

OE2路由选路


R1
hostname r1
interface Loopback0

ip address 1.1.1.1 255.255.255.0


ip ospf network point-to-point

!
nterface Serial1/0

ip address 12.1.1.1 255.255.255.0

!
interface Serial2/0

ip address 13.1.1.1 255.255.255.0

!
router ospf 10

router-id 1.1.1.1


log-adjacency-changes


network 12.1.1.0 0.0.0.255 area 0


network 13.1.1.0 0.0.0.255 area 0

!
R2
hostname r2
interface Loopback0

ip address 2.2.2.2 255.255.255.0

ip ospf network point-to-point!
interface Ethernet0/0

no ip address

!
interface Ethernet0/0.1

encapsulation dot1Q 24


ip address 24.1.1.2 255.255.255.0


ip ospf network point-to-point

interface Serial2/0

ip address 12.1.1.2 255.255.255.0

!
router ospf 10

router-id 2.2.2.2


log-adjacency-changes


network 12.1.1.0 0.0.0.255 area 0


network 24.1.1.0 0.0.0.255 area 0

R3
hostname r3
interface Loopback0

ip address 3.3.3.3 255.255.255.0


ip ospf network point-to-point

!
interface Ethernet0/0

no ip address

!
interface Ethernet0/0.2

encapsulation dot1Q 34


ip address 34.1.1.3 255.255.255.0


ip ospf network point-to-point

!
interface Serial1/0

ip address 13.1.1.3 255.255.255.0

!

router ospf 10


router-id 3.3.3.3


log-adjacency-changes


network 13.1.1.0 0.0.0.255 area 0


network 34.1.1.0 0.0.0.255 area 0

R4
hostname r4
interface Loopback0

ip address 4.4.4.4 255.255.255.0


ip ospf network point-to-point

!
interface Ethernet0/0.1

encapsulation dot1Q 24


ip address 24.1.1.4 255.255.255.0


ip ospf network point-to-point

!
interface Ethernet0/0.2

encapsulation dot1Q 34


ip address 34.1.1.4 255.255.255.0


ip ospf network point-to-point

router ospf 10

router-id 4.4.4.4


log-adjacency-changes


redistribute connected subnets
R4上将外部路由重发布进OSPF


network 24.1.1.0 0.0.0.255 area 0


network 34.1.1.0 0.0.0.255 area 0

!
R1上红字部分显示通过via 12.1.1.2 via 13.1.1.3
同时学到了R4的外部路由因为都是OE2COST值都为20

r1#show ip route
34.0.0.0/24 is subnetted, 1 subnets
O
34.1.1.0 [110/74] via 13.1.1.3, 00:08:30, Serial2/0


1.0.0.0/24 is subnetted, 1 subnets

C
1.1.1.0 is directly connected, Loopback0


4.0.0.0/24 is subnetted, 1 subnets

O E2
4.4.4.0 [110/20] via 12.1.1.2, 00:08:30, Serial1/0


[110/20] via 13.1.1.3, 00:08:30, Serial2/0


24.0.0.0/24 is subnetted, 1 subnets

O
24.1.1.0 [110/74] via 12.1.1.2, 00:08:30, Serial1/0


12.0.0.0/24 is subnetted, 1 subnets

C
12.1.1.0 is directly connected, Serial1/0


13.0.0.0/24 is subnetted, 1 subnets

C
13.1.1.0 is directly connected, Serial2/0

现在我从R14.4.4.4时如果是基于数据包的时候那么它会一边走一个数据包:
r1#show ip route 4.4.4.0
Routing entry for 4.4.4.0/24

Known via "ospf 10", distance 110, metric 20, type extern 2, forward metric 74


Last update from 13.1.1.3 on Serial2/0, 00:17:41 ago


Routing Descriptor Blocks:


* 12.1.1.2, from 4.4.4.4, 00:17:41 ago, via Serial1/0


Route metric is 20, traffic share count is 1


13.1.1.3, from 4.4.4.4, 00:17:41 ago, via Serial2/0


Route metric is 20, traffic share count is 1

可以看到下一跳的路径为* 12.1.1.2
r1#ping 4.4.4.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/56/80 ms
r1#show ip route 4.4.4.0
Routing entry for 4.4.4.0/24

Known via "ospf 10", distance 110, metric 20, type extern 2, forward metric 74


Last update from 13.1.1.3 on Serial2/0, 00:17:54 ago


Routing Descriptor Blocks:


12.1.1.2, from 4.4.4.4, 00:17:54 ago, via Serial1/0


Route metric is 20, traffic share count is 1


* 13.1.1.3, from 4.4.4.4, 00:17:54 ago, via Serial2/0


Route metric is 20, traffic share count is 1

可以看到下一跳的路径为* 13.1.1.3
现在我在R2的以太网E0/0.1口将其COST值该为5
interface Ethernet0/0.1

ip ospf cost 5

那么它会优先选择Ethernet0/0.1这个口出去到达4.4.4.4 验证:
r1#sh ip route


34.0.0.0/24 is subnetted, 1 subnets

O
34.1.1.0 [110/74] via 13.1.1.3, 00:00:07, Serial2/0


1.0.0.0/24 is subnetted, 1 subnets

C
1.1.1.0 is directly connected, Loopback0


4.0.0.0/24 is subnetted, 1 subnets

O E2
4.4.4.0 [110/20] via 12.1.1.2, 00:00:07, Serial1/0


24.0.0.0/24 is subnetted, 1 subnets

O
24.1.1.0 [110/69] via 12.1.1.2, 00:00:07, Serial1/0


12.0.0.0/24 is subnetted, 1 subnets

C
12.1.1.0 is directly connected, Serial1/0


13.0.0.0/24 is subnetted, 1 subnets

C
13.1.1.0 is directly connected, Serial2/0

可见到4.4.4.4只有一条路由了,O E2 4.4.4.0 [110/20] via 12.1.1.2
通过12.1.1.2口出去,不会再进行负载均衡。
r1#show ip route 4.4.4.4
Routing entry for 4.4.4.0/24

Known via "ospf 10", distance 110, metric 20, type extern 2, forward metric 69


Last update from 12.1.1.2 on Serial1/0, 00:02:40 ago


Routing Descriptor Blocks:


* 12.1.1.2, from 4.4.4.4, 00:02:40 ago, via Serial1/0


Route metric is 20, traffic share count is 1

TOP

恩,看了很多数句,都是讲路由的,好好研究

TOP

发新话题