H3CSE路由实验手册

更新时间:2024-07-02 18:20:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

H3CSE路由实验配置 1. OSPF单区域配置:

从模拟器当中打开RT2和RT3两台路由器,按照如图所示配置接口IP地址,配置单区域的OSPF。

首先在RT2上进行配置: [H3C]sysname RT2

[RT2]interface Serial 0/2/2

[RT2-Serial0/2/2]ip address 10.1.1.1 24 [RT2-Serial0/2/2]quit [RT2]interface LoopBack 1

[RT2-LoopBack1]ip address 2.2.2.2 32 [RT2-LoopBack1]quit [RT2]ospf router-id 2.2.2.2

[RT2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 [RT2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0

[RT2-ospf-1-area-0.0.0.0]quit [RT2-ospf-1]quit [RT2]

在RT3上的配置: [H3C]sysname RT3

[RT3]interface LoopBack 1

[RT3-LoopBack1]ip address 3.3.3.3 32 [RT3-LoopBack1]quit [RT3]interface Serial 0/2/0

[RT3-Serial0/2/0]ip address 10.1.1.2 24 [RT3-Serial0/2/0]quit [RT3]ospf router-id 3.3.3.3 [RT3-ospf-1]area 0

[RT3-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 [RT3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0 [RT3-ospf-1-area-0.0.0.0]quit [RT3-ospf-1]quit [RT3]

配置好之后在RT2上ping RT3发现可以ping通,那么实验配置就是正确的了。

[RT2]ping -a 2.2.2.2 3.3.3.3

PING 3.3.3.3: 56 data bytes, press CTRL_C to break

Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=255 time=24 ms

Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=14 ms

Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time=25 ms

Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=10 ms

--- 3.3.3.3 ping statistics --- 5 packet(s) transmitted 4 packet(s) received 20.00% packet loss

round-trip min/avg/max = 10/18/25 ms 使用查看OSPF邻居状态的命令 [RT2]display ospf peer

OSPF Process 1 with Router ID 2.2.2.2 Neighbor Brief Information

Area: 0.0.0.0

Router ID Address Pri Dead-Time Interface

State

3.3.3.3 10.1.1.2 1 36 S0/2/2 Full/ -

发现对端邻居3.3.3.3的状态已经是full状态了。

2. OSPF多区域实验:

打开模拟器的RT2、RT3和RT4,其中RT2和RT3在区域0,RT3和RT4在区域1,配置多区域的OSPF。

[H3C]sysname RT2

[RT2]interface Serial 0/2/2

[RT2-Serial0/2/2]ip address 10.1.1.1 24 [RT2-Serial0/2/2]quit [RT2]interface LoopBack 1

[RT2-LoopBack1]ip address 2.2.2.2 32 [RT2-LoopBack1]quit [RT2]ospf router-id 2.2.2.2

[RT2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 [RT2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0

[RT2-ospf-1-area-0.0.0.0]quit [RT2-ospf-1]quit [RT2]

在RT3上的配置: [H3C]sysname RT3

[RT3]interface LoopBack 1

[RT3-LoopBack1]ip address 3.3.3.3 32 [RT3-LoopBack1]quit [RT3]interface Serial 0/2/0

[RT3-Serial0/2/0]ip address 10.1.1.2 24 [RT3-Serial0/2/0]quit [RT3]interface Serial 0/2/2

[RT3-Serial0/2/2]ip address 20.1.1.1 24 [RT3-Serial0/2/2]quit [RT3]ospf router-id 3.3.3.3 [RT3-ospf-1]area 0

[RT3-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 [RT3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0 [RT3-ospf-1-area-0.0.0.0]quit [RT3-ospf-1]area 1

[RT3-ospf-1-area-0.0.0.1]network 20.1.1.0 0.0.0.255 [RT3-ospf-1-area-0.0.0.1]quit

[RT3-ospf-1]quit [RT3]

在RT4上的配置: [H3C]sysname RT4

[RT4]interface LoopBack 1

[RT4-LoopBack1]ip address 4.4.4.4 32 [RT4-LoopBack1]quit [RT4]interface Serial 0/2/0

[RT4-Serial0/2/0]ip address 20.1.1.2 24 [RT4]ospf router-id 4.4.4.4 [RT4-ospf-1]area 1

[RT4-ospf-1-area-0.0.0.1]network 20.1.1.0 0.0.0.255 [RT4-ospf-1-area-0.0.0.1]network 4.4.4.4 0.0.0.0 [RT4-ospf-1-area-0.0.0.1]quit [RT4-ospf-1]quit [RT4]

配置好之后在RT2上分别ping RT3和RT4的loopback接口ip地址,看是否可以ping通。

[RT2]ping -a 2.2.2.2 4.4.4.4

PING 4.4.4.4: 56 data bytes, press CTRL_C to break Request time out

Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=254 time=4 ms

Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=254 time=1 ms Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=254 time=10 ms Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=254 time=16 ms

--- 4.4.4.4 ping statistics --- 5 packet(s) transmitted 4 packet(s) received 20.00% packet loss

round-trip min/avg/max = 1/7/16 ms [RT2]ping -a 2.2.2.2 3.3.3.3

PING 3.3.3.3: 56 data bytes, press CTRL_C to break Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=255 time=20 ms

Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=30 ms

Request time out

Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time=10 ms

Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=5 ms

--- 3.3.3.3 ping statistics ---

5 packet(s) transmitted 4 packet(s) received 20.00% packet loss

round-trip min/avg/max = 5/16/30 ms 在RT3上查看OSPF的邻居: [RT3]display ospf peer

OSPF Process 1 with Router ID 3.3.3.3 Neighbor Brief Information

Area: 0.0.0.0

Router ID Address Pri Dead-Time Interface State

2.2.2.2 10.1.1.1 1 39 S0/2/0 Full/ -

Area: 0.0.0.1

Router ID Address Pri Dead-Time Interface State

4.4.4.4 20.1.1.2 1 38 S0/2/2 Full/ -

发现两个对端邻居都是full的状态,那么配置就成功了。

3. OSPF虚链接的配置:

如图所示,RT2和RT3在区域0,RT3和RT4在区域1,RT4和RT5在区域2当中,这是发现区域2没有和区域0互连,通过我们学到的理论,区域1和区域2不能通信,这样相互之间不能进行网段的学习。通过在区域1配置虚链接,保证通信。 [H3C]sysname RT2

[RT2]interface Serial 0/2/2

[RT2-Serial0/2/2]ip address 10.1.1.1 24 [RT2-Serial0/2/2]quit [RT2]interface LoopBack 1

[RT2-LoopBack1]ip address 2.2.2.2 32 [RT2-LoopBack1]quit [RT2]ospf router-id 2.2.2.2

[RT2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 [RT2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0 [RT2-ospf-1-area-0.0.0.0]quit [RT2-ospf-1]quit [RT2]

在RT3上的配置: [H3C]sysname RT3

[RT3]interface LoopBack 1

[RT3-LoopBack1]ip address 3.3.3.3 32 [RT3-LoopBack1]quit [RT3]interface Serial 0/2/0

[RT3-Serial0/2/0]ip address 10.1.1.2 24 [RT3-Serial0/2/0]quit [RT3]interface Serial 0/2/2

[RT3-Serial0/2/2]ip address 20.1.1.1 24 [RT3-Serial0/2/2]quit [RT3]ospf router-id 3.3.3.3 [RT3-ospf-1]area 0

[RT3-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 [RT3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0 [RT3-ospf-1-area-0.0.0.0]quit [RT3-ospf-1]area 1

[RT3-ospf-1-area-0.0.0.1]network 20.1.1.0 0.0.0.255 [RT3-ospf-1-area-0.0.0.1]quit [RT3-ospf-1]quit [RT3]

在RT4上的配置:

[H3C]sysname RT4

[RT4]interface LoopBack 1

[RT4-LoopBack1]ip address 4.4.4.4 32 [RT4-LoopBack1]quit [RT4]interface Serial 0/2/0

[RT4-Serial0/2/0]ip address 20.1.1.2 24 [RT4-Serial0/2/2]ip address 30.1.1.1 24 [RT4]ospf router-id 4.4.4.4 [RT4-ospf-1]area 1

[RT4-ospf-1-area-0.0.0.1]network 20.1.1.0 0.0.0.255 [RT4-ospf-1-area-0.0.0.1]network 4.4.4.4 0.0.0.0 [RT4-ospf-1-area-0.0.0.1]quit [RT4-ospf-1]area 2

[RT4-ospf-1-area-0.0.0.2]network 30.1.1.0 0.0.0.255 [RT4-ospf-1]quit [RT4]

RT5上的配置: [H3C]sysname RT5

[RT5]interface LoopBack 1

[RT5-LoopBack1]ip address 5.5.5.5 32 [RT5-LoopBack1]quit [RT5]interface Serial 0/2/2

[RT5-Serial0/2/2]ip address 30.1.1.2 24 [RT5]ospf router-id 5.5.5.5 [RT5-ospf-1]area 2

[RT5-ospf-1-area-0.0.0.2]network 30.1.1.0 0.0.0.255 [RT5-ospf-1-area-0.0.0.2]network 5.5.5.5 0.0.0.0 [RT5-ospf-1-area-0.0.0.2]quit [RT5-ospf-1]quit [RT5]

配置好了之后查看RT5的路由表会发现只有直连路由: [RT5]display ip routing-table Routing Tables: Public

Destinations : 6 Routes : 6

Destination/Mask Proto Pre Cost Interface

5.5.5.5/32 Direct 0 0 127.0.0.1 InLoop0

30.1.1.0/24 Direct 0 0 30.1.1.2 S0/2/2

30.1.1.1/32 Direct 0 0 30.1.1.1 S0/2/2

NextHop 30.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

这时分别在RT3和RT4上配置虚链接: [RT3]ospf

[RT3-ospf-1]area 1

[RT3-ospf-1-area-0.0.0.1]vlink-peer 4.4.4.4 [RT4]ospf

[RT4-ospf-1]area 1

[RT4-ospf-1-area-0.0.0.1]vlink-peer 3.3.3.3 配置好了之后再从RT5上查看路由表: [RT5]display ip routing-table Routing Tables: Public

Destinations : 11 Routes : 11

Destination/Mask Proto Pre Cost Interface

2.2.2.2/32 OSPF 10 4686 NextHop 30.1.1.1

S0/2/2

3.3.3.3/32 OSPF 10 3124 30.1.1.1 S0/2/2

4.4.4.4/32 OSPF 10 1562 30.1.1.1 S0/2/2

5.5.5.5/32 Direct 0 0 127.0.0.1 InLoop0

10.1.1.0/24 OSPF 10 4686 S0/2/2

20.1.1.0/24 OSPF 10 3124 S0/2/2

30.1.1.0/24 Direct 0 0 S0/2/2

30.1.1.1/32 Direct 0 0 S0/2/2

30.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

会发现路由已经正确学习到,说明虚链接生效了。

30.1.1.1 30.1.1.1 30.1.1.2 30.1.1.1 4. OSPF路由聚合:

OSPF的路由聚合分为两种,一个是3类LSA的聚合,还有一个五类LSA的聚合。 3类LSA的聚合配置: RT2的配置如下: [H3C]sysname RT2

[RT2]interface Serial 0/2/2

[RT2-Serial0/2/2]ip address 10.1.1.1 24 [RT2-Serial0/2/2]quit [RT2]interface LoopBack 1

[RT2-LoopBack1]ip address 2.2.2.2 32 [RT2-LoopBack1]quit [RT2]interface LoopBack 2

[RT2-LoopBack2]ip address 192.168.0.1 32 [RT2-LoopBack2]quit [RT2]interface LoopBack 3

[RT2-LoopBack3]ip address 192.168.1.1 32 [RT2-LoopBack3]quit

[RT2]ospf router-id 2.2.2.2 [RT2-ospf-1]area 0

[RT2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0 [RT2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 [RT2-ospf-1-area-0.0.0.0]network 192.168.0.1 0.0.0.0 [RT2-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0 [RT2-ospf-1-area-0.0.0.0]quit [RT2-ospf-1]quit [RT2]

RT3的配置如下: [H3C]sysname RT3

[RT3]interface Serial 0/2/0

[RT3-Serial0/2/0]ip address 10.1.1.2 24 [RT3-Serial0/2/0]quit [RT3]interface LoopBack 1

[RT3-LoopBack1]ip address 3.3.3.3 32 [RT3-LoopBack1]quit [RT3]interface Serial 0/2/2

[RT3-Serial0/2/2]ip address 20.1.1.1 24 [RT3-Serial0/2/2]quit [RT3]ospf router-id 3.3.3.3 [RT3-ospf-1]area 0

[RT3-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 [RT3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0 [RT3-ospf-1-area-0.0.0.0]quit [RT3-ospf-1]area 1

[RT3-ospf-1-area-0.0.0.1]network 20.1.1.0 0.0.0.255 [RT3-ospf-1-area-0.0.0.1]quit RT4的配置如下: [H3C]sysname R4

[R4]interface Serial 0/2/0

[R4-Serial0/2/0]ip address 20.1.1.2 24 [R4-Serial0/2/0]quit [R4]interface LoopBack 1

[R4-LoopBack1]ip address 4.4.4.4 32 [R4-LoopBack1]quit

[R4]ospf router-id 4.4.4.4 [R4-ospf-1]area 1

[R4-ospf-1-area-0.0.0.1]network 20.1.1.0 0.0.0.255 [R4-ospf-1-area-0.0.0.1]network 4.4.4.4 0.0.0.0 [R4-ospf-1-area-0.0.0.1]quit [R4-ospf-1]quit [R4]

在RT3上配置3类LSA的聚合:

[RT3]ospf

[RT3-ospf-1]area 0

[RT3-ospf-1-area-0.0.0.0]abr-summary 192.168.0.0 23 配置好了之后在RT4上查看一下路由表: [R4]display ip routing-table Routing Tables: Public

Destinations : 10 Routes : 10

Destination/Mask Proto Pre Cost Interface

2.2.2.2/32 OSPF 10 3124 S0/2/0

3.3.3.3/32 OSPF 10 1562 S0/2/0

4.4.4.4/32 Direct 0 0 127.0.0.1 InLoop0

10.1.1.0/24 OSPF 10 3124 S0/2/0

20.1.1.0/24 Direct 0 0 S0/2/0

20.1.1.1/32 Direct 0 0 NextHop 20.1.1.1 20.1.1.1 20.1.1.1 20.1.1.2 20.1.1.1

S0/2/0

20.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.0.0/23 OSPF 10 3124 20.1.1.1 S0/2/0

如上标识除了学到的路由信息,查看路由表发现网段已经进行了聚合。

配置5类LSA的聚合:

之前RT2上对网段进行了network宣告,现在undo掉: [RT2]ospf

[RT2-ospf-1]area 0

[RT2-ospf-1-area-0.0.0.0]undo network 192.168.0.1 0.0.0.0 [RT2-ospf-1-area-0.0.0.0]undo network 192.168.1.1 0.0.0.0 [RT2-ospf-1-area-0.0.0.0]quit [RT2-ospf-1]quit [RT2]

[RT2-ospf-1]import-route direct

[RT2-ospf-1]asbr-summary 192.168.0.0 23

配置好了之后在RT4路由器上查看路由表发现已经把5类LSA进行了聚合,聚合成了一个大的网段,如下图所示: [RT4]display ip routing-table Routing Tables: Public

Destinations : 11 Routes : 11

Destination/Mask Proto Pre Cost Interface

2.2.2.2/32 OSPF 10 3124 S0/2/0

3.3.3.3/32 OSPF 10 1562 S0/2/0

4.4.4.4/32 Direct 0 0 127.0.0.1 InLoop0

10.1.1.0/24 OSPF 10 3124 S0/2/0

10.1.1.2/32 O_ASE 150 1 S0/2/0

20.1.1.0/24 Direct 0 0 S0/2/0

NextHop 20.1.1.1 20.1.1.1 20.1.1.1 20.1.1.1 20.1.1.2

20.1.1.1/32 Direct 0 0 20.1.1.1 S0/2/0

20.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.0.0/23 O_ASE 150 2 20.1.1.1 S0/2/0

5.OSPF安全特性: OSPF区域和接口验证:

使用上面路由聚合的拓扑图,配置也如上图所示: RT2的配置如下: [RT2]ospf

[RT2-ospf-1]area 0

[RT2-ospf-1-area-0.0.0.0]authentication-mode simple %Oct 31 15:51:45:378 2013 RT2 RM/3/RMLOG:OSPF-NBRCHANGE: Process 1, Neighbor 10.1.1.2(Serial0/2/2) from Full to Down [RT2-ospf-1-area-0.0.0.0]quit

[RT2-ospf-1]quit

[RT2]interface Serial 0/2/2

[RT2-Serial0/2/2]ospf authentication-mode simple 123 [RT2-Serial0/2/2]quit [RT2]

RT3的配置如下: [RT3]ospf

[RT3-ospf-1]area 0

[RT3-ospf-1-area-0.0.0.0]authentication-mode simple %Oct 31 15:51:57:800 2013 RT3 RM/3/RMLOG:OSPF-NBRCHANGE: [RT3-ospf-1-area-0.0.0.0]quit [RT3-ospf-1]quit

[RT3]interface Serial 0/2/0

[RT3-Serial0/2/0]ospf authentication-mode simple 123 [RT3-Serial0/2/0]quit [RT3]ospf

[RT3-ospf-1]area 1

[RT3-ospf-1-area-0.0.0.1]authentication-mode simple [RT3-ospf-1-area-0.0.0.1]quit [RT3-ospf-1]quit

[RT3]interface Serial 0/2/2

[RT3-Serial0/2/2]ospf authentication-mode simple 456

RT4路由器配置如下: [RT4]ospf

[RT4-ospf-1]area 1

[RT4-ospf-1-area-0.0.0.1]authentication-mode simple [RT4-ospf-1-area-0.0.0.1]quit [RT4-ospf-1]quit

[RT4]interface Serial 0/2/0

[RT4-Serial0/2/0]ospf authentication-mode simple 456 [RT4-Serial0/2/0]quit [RT4]

5. OSPF路由过滤实验

OSPF路由过滤分为两种:过滤计算出来的路由和过滤3类LSA,先配置过滤计算出来的路由

在路由器RT2上network宣告192.168.0.1/32和192.168.1.1/32,正常情况下路由器RT3和RT4可以学习到这两个网段。下面在RT3上配置路由过滤,让路由器RT3上只学习到192.168.0.1,学不到192.168.1.1。RT4路由器上路由学习正常。

RT2的配置如下: [H3C]sysname RT2

[RT2]interface Serial 0/2/2

[RT2-Serial0/2/2]ip address 10.1.1.1 24 [RT2-Serial0/2/2]quit [RT2]interface LoopBack 1

[RT2-LoopBack1]ip address 2.2.2.2 32 [RT2-LoopBack1]quit [RT2]interface LoopBack 2

[RT2-LoopBack2]ip address 192.168.0.1 32 [RT2-LoopBack2]quit [RT2]interface LoopBack 3

[RT2-LoopBack3]ip address 192.168.1.1 32 [RT2-LoopBack3]quit

[RT2]ospf router-id 2.2.2.2 [RT2-ospf-1]area 0

[RT2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0 [RT2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 [RT2-ospf-1-area-0.0.0.0]network 192.168.0.1 0.0.0.0 [RT2-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0 [RT2-ospf-1-area-0.0.0.0]quit [RT2-ospf-1]quit

[RT2]

RT3的配置如下: [H3C]sysname RT3

[RT3]interface Serial 0/2/0

[RT3-Serial0/2/0]ip address 10.1.1.2 24 [RT3-Serial0/2/0]quit [RT3]interface LoopBack 1

[RT3-LoopBack1]ip address 3.3.3.3 32 [RT3-LoopBack1]quit [RT3]interface Serial 0/2/2

[RT3-Serial0/2/2]ip address 20.1.1.1 24 [RT3-Serial0/2/2]quit [RT3]ospf router-id 3.3.3.3 [RT3-ospf-1]area 0

[RT3-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 [RT3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0 [RT3-ospf-1-area-0.0.0.0]quit [RT3-ospf-1]area 1

[RT3-ospf-1-area-0.0.0.1]network 20.1.1.0 0.0.0.255 [RT3-ospf-1-area-0.0.0.1]quit RT4的配置如下: [H3C]sysname R4

[R4]interface Serial 0/2/0

[R4-Serial0/2/0]ip address 20.1.1.2 24 [R4-Serial0/2/0]quit [R4]interface LoopBack 1

[R4-LoopBack1]ip address 4.4.4.4 32 [R4-LoopBack1]quit

[R4]ospf router-id 4.4.4.4 [R4-ospf-1]area 1

[R4-ospf-1-area-0.0.0.1]network 20.1.1.0 0.0.0.255 [R4-ospf-1-area-0.0.0.1]network 4.4.4.4 0.0.0.0 [R4-ospf-1-area-0.0.0.1]quit [R4-ospf-1]quit [R4]

配置好之后在RT3上配置过滤计算出来的路由,让路由器RT3的路由表中只有192.168.0.1/32这个路由信息。

[RT3]ip ip-prefix h3c index 10 deny 192.168.1.1 32

[RT3]ip ip-prefix h3c index 20 permit 0.0.0.0 0 less-equal 32 [RT3]ospf

[RT3-ospf-1]filter-policy ip-prefix h3c import [RT3-ospf-1]quit 配置好之后查看路由表: [RT3]display ip routing-table

Routing Tables: Public

Destinations : 12 Routes : 12

Destination/Mask Proto Pre Cost NextHop Interface

2.2.2.2/32 S0/2/0

3.3.3.3/32 Direct 0 0 127.0.0.1 InLoop0

4.4.4.4/32 S0/2/2

10.1.1.0/24 Direct 0 S0/2/0

10.1.1.1/32 Direct 0 S0/2/0

10.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0

20.1.1.0/24 Direct 0 S0/2/2

20.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0

OSPF 10 OSPF 10 1562 1562 0 10.1.1.2 0 10.1.1.1 0 20.1.1.1 10.1.1.1 20.1.1.2 20.1.1.2/32 Direct 0 0 20.1.1.2 S0/2/2

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.0.1/32 OSPF 10 1562 10.1.1.1 S0/2/0

会发现路由器RT3的路由表当中只有192.168.0.1/32这个网段了。

在RT3上配置过滤3类LSA,让路由器RT4上只能学习到192.168.0.1/32这个网段。

[RT3]ip ip-prefix h3c index 10 deny 192.168.1.1 32

[RT3]ip ip-prefix h3c index 20 permit 0.0.0.0 0 less-equal 32 [RT3]ospf

[RT3-ospf-1]area 0

[RT3-ospf-1-area-0.0.0.0]filter ip-prefix h3c export [RT3-ospf-1-area-0.0.0.0]quit [RT3-ospf-1]quit [RT3]

配置好之后在RT4上查看路由表,会发现只有192.168.0.1/32这个路由信息了。

[RT4]display ip routing-table Routing Tables: Public

Destinations : 10 Routes : 10

Destination/Mask Proto Pre Cost NextHop Interface

2.2.2.2/32 S0/2/0

3.3.3.3/32 S0/2/0

4.4.4.4/32 Direct 0 0 127.0.0.1 InLoop0

10.1.1.0/24 S0/2/0

20.1.1.0/24 Direct 0 S0/2/0

20.1.1.1/32 Direct 0 S0/2/0

20.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0

127.0.0.0/8 Direct 0 0 127.0.0.1

OSPF 10 OSPF 10 OSPF 10 3124 1562 3124 0 20.1.1.2 0 20.1.1.1 20.1.1.1 20.1.1.1 20.1.1.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.0.1/32 OSPF 10 3124 20.1.1.1 S0/2/0

6. ISIS实验配置:

三台路由器,其中R2和R3位于区域10,R4位于区域20。配置ISIS路由协议,让三台路由器两两之间可以进行路由的学习。 R2路由器配置: [H3C]sysname RT2

[RT2]interface LoopBack 1

[RT2-LoopBack1]IP address 2.2.2.2 32 [RT2-LoopBack1]quit [RT2]interface Serial 0/2/2

[RT2-Serial0/2/2]ip address 10.1.1.1 24 [RT2-Serial0/2/2]quit [RT2]isis

[RT2-isis-1]network-entity 10.0001.0001.0001.00 [RT2-isis-1]is-level level-1 [RT2-isis-1]quit

[RT2]interface LoopBack 1 [RT2-LoopBack1]isis enable

[RT2-LoopBack1]isis circuit-level level-1 [RT2-LoopBack1]quit [RT2]interface Serial 0/2/2 [RT2-Serial0/2/2]isis enable

[RT2-Serial0/2/2]isis circuit-level level-1 [RT2-Serial0/2/2]quit RT3路由器配置: [H3C]sysname RT3 [RT3]interface s0/2/0

[RT3-Serial0/2/0]ip address 10.1.1.2 24 [RT3-Serial0/2/0]quit [RT3]interface Serial 0/2/2

[RT3-Serial0/2/2]ip address 20.1.1.1 24 [RT3-Serial0/2/2]quit [RT3]isis

[RT3-isis-1]network-entity [RT3-isis-1]is-level level-1-2

10.0002.0002.0002.00

[RT3-isis-1]quit [RT3]

[RT3]interface Serial 0/2/0 [RT3-Serial0/2/0]isis enable

[RT3-Serial0/2/0]isis circuit-level level-1 [RT3-Serial0/2/0]quit [RT3]interface Serial 0/2/2 [RT3-Serial0/2/2]isis enable

[RT3-Serial0/2/2]isis circuit-level level-2 [RT3-Serial0/2/2]quit RT4路由器配置如下: [H3C]sysname RT4

[RT4]interface Serial 0/2/0

[RT4-Serial0/2/0]ip address 20.1.1.2 24 [RT4-Serial0/2/0]quit [RT4]interface LoopBack 1

[RT4-LoopBack1]ip address 4.4.4.4 32 [RT4-LoopBack1]quit [RT4]isis

[RT4-isis-1]network-entity 20.0003.0003.0003.0003.00 [RT4-isis-1]is-level level-2 [RT4-isis-1]quit

[RT4]interface Serial 0/2/0 [RT4-Serial0/2/0]

[RT4-Serial0/2/0]isis enable

[RT4-Serial0/2/0]isis circuit-level level-2 [RT4-Serial0/2/0]quit [RT4]interface LoopBack 1 [RT4-LoopBack1]isis enable

[RT4-LoopBack1]isis circuit-level level-2 [RT4-LoopBack1]quit [RT4]

配置好了之后查看RT4的路由表,发现可以学到RT2和RT3上的路由: [RT4]display ip routing-table Routing Tables: Public

Destinations : 8 Routes : 8

Destination/Mask Proto Pre Cost NextHop Interface

2.2.2.2/32 ISIS 15 20 20.1.1.1 S0/2/0

4.4.4.4/32 Direct 0 0 127.0.0.1 InLoop0

10.1.1.0/24 ISIS 15 20 20.1.1.1 S0/2/0

20.1.1.0/24 Direct 0 0 20.1.1.2 S0/2/0

20.1.1.1/32 Direct 0 0 20.1.1.1 S0/2/0

20.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

7. 路由策略和路由引入:

如图所示,三台路由器,RT2和RT3上配置了OSPF,RT3和RT4上配置了ISIS。在ISIS的RT4上宣告192.168.0.1和192.168.1.1。这时路由器RT3上可以学习到这两个网段,RT2因为配置的是

OSPF,所以学习不到这个网段,配置路由引入,把OSPF网段引入给ISIS,把ISIS网段引入给OSPF。在把ISIS引入到OSPF的时候更改引入的两个路由信息的cost值,改成20。 路由引入的配置如下: RT2的配置: [H3C]sysname RT2

[RT2]interface LoopBack 1

[RT2-LoopBack1]ip address 2.2.2.2 32 [RT2-LoopBack1]quit [RT2]interface Serial 0/2/2

[RT2-Serial0/2/2]ip address 10.1.1.1 24 [RT2-Serial0/2/2]quit [RT2]ospf router-id 2.2.2.2 [RT2-ospf-1]area 0

[RT2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0 [RT2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 [RT2-ospf-1-area-0.0.0.0]quit [RT2-ospf-1]quit [RT2]

RT3路由器配置如下: [H3C]sysname RT3

[RT3]interface Serial 0/2/0

[RT3-Serial0/2/0]ip address 10.1.1.2 24 [RT3-Serial0/2/0]quit [RT3]interface Serial 0/2/2

[RT3-Serial0/2/2]ip address 20.1.1.1 24 [RT3-Serial0/2/2]quit [RT3]interface LoopBack 1

[RT3-LoopBack1]ip address 3.3.3.3 32 [RT3-LoopBack1]quit

[RT3]ospf router-id 3.3.3.3 [RT3-ospf-1]area 0

[RT3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0 [RT3-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255 [RT3-ospf-1]quit [RT3]isis

[RT3-isis-1]network-entity 20.0003.0003.0003.00 [RT3-isis-1]quit

[RT3]interface Serial 0/2/2 [RT3-Serial0/2/2]isis enable [RT3-Serial0/2/2]quit [RT3]

RT4的配置如下: [H3C]sysname RT4

[RT4]interface Serial 0/2/0

[RT4-Serial0/2/0]ip address 20.1.1.2 24 [RT4-Serial0/2/0]quit [RT4]interface LoopBack 1

[RT4-LoopBack1]ip address 4.4.4.4 32 [RT4-LoopBack1]quit [RT4]interface LoopBack 2

[RT4-LoopBack2]ip address 192.168.0.1 32 [RT4-LoopBack2]quit [RT4]interface LoopBack 3

[RT4-LoopBack3]ip address 192.168.1.1 32 [RT4-LoopBack3]quit [RT4]isis

[RT4-isis-1]network-entity 20.0004.0004.0004.00 [RT4-isis-1]quit

[RT4]interface Serial 0/2/0 [RT4-Serial0/2/0]isis enable [RT4-Serial0/2/0]quit [RT4]interface LoopBack 1 [RT4-LoopBack1]isis enable [RT4-LoopBack1]quit [RT4]interface LoopBack 2

[RT4-LoopBack2]isis enable [RT4-LoopBack2]quit [RT4]interface LoopBack 3 [RT4-LoopBack3]isis enable [RT4-LoopBack3]quit [RT4]

配置好了查看路由表会发现ISIS和OSPF只能发现各自宣告的网段。下面配置路由引入,把OSPF引入ISIS,再把ISIS引入OSPF。 [RT3]ospf

[RT3-ospf-1]import-route direct [RT3-ospf-1]import-route isis [RT3-ospf-1]quit [RT3]isis

[RT3-isis-1]import-route ospf [RT3-isis-1]import-route direct [RT3-isis-1]

配置好了之后查看路由表: [RT2]display ip routing-table Routing Tables: Public

Destinations : 12 Routes : 12

Destination/Mask Proto Pre Cost NextHop

Interface

2.2.2.2/32 Direct 0 0 127.0.0.1 InLoop0

3.3.3.3/32 OSPF 10 1562 10.1.1.2 S0/2/2

4.4.4.4/32 O_ASE 150 1 10.1.1.2 S0/2/2

10.1.1.0/24 Direct 0 0 10.1.1.1 S0/2/2

10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0

10.1.1.2/32 Direct 0 0 10.1.1.2 S0/2/2

20.1.1.0/24 O_ASE 150 1 10.1.1.2 S0/2/2

20.1.1.2/32 O_ASE 150 1 10.1.1.2 S0/2/2

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.0.1/32 O_ASE 150 1 10.1.1.2 S0/2/2

192.168.1.1/32 O_ASE 150 1 10.1.1.2 S0/2/2

这时发现RT2上已经学习到了ISIS的路由。 在RT4上查看路由表也会发现,已经发现了 路由策略的设置:

[RT2]display ip routing-table Routing Tables: Public

Destinations : 12 Routes : 12

Destination/Mask Proto Pre Cost Interface

2.2.2.2/32 Direct 0 0 127.0.0.1 InLoop0

3.3.3.3/32 OSPF 10 1562 10.1.1.2 S0/2/2

4.4.4.4/32 O_ASE 150 1 10.1.1.2 S0/2/2

10.1.1.0/24 Direct 0 0 10.1.1.1 S0/2/2

NextHop

本文来源:https://www.bwwdw.com/article/ke0.html

Top