当前位置:文档之家› 实验八路由器的配置

实验八路由器的配置

实验八路由器的配置
实验八路由器的配置

实验八路由器路由协议配置

目录

一、实验目的1

二、静态路由配置1

三、RIP路由配置3

四、OSPF路由配置5

一、实验目的

1、掌握静态路由配置;

2、掌握RIP路由配置;

3、掌握RIP路由配置

4、掌握OSPF路由配置

二、静态路由配置

(一)基本知识

◆在配置静态路由之前,需完成以下任务:

1、配置相关接口的物理参数

2、配置相关接口的链路层属性

3、配置相关接口的IP地址

在配置静态路由时,如果先指定下一跳地址,然后将该地址配置为本地接口(如以太网接口、VLAN接口等)的IP地址,静态路由不会生效。

如果在配置静态路由时没有指定优先级,就会使用缺省优先级。重新设置缺省优先级后,新设置的缺省优先级仅对新增的静态路由有效。

设置静态路由的Tag值,可以在路由策略中根据Tag值对路由进行灵活的控制。

静态路由显示和维护

在完成上述配置后,在任意视图下执行display命令查看静态路由配置的运行情况并检验配置结果。

在系统视图下执行delete命令可以删除配置的所有静态路由。

操作命令

查看当前的配置文件信息display current-configuration

查看IP路由表摘要信息display ip routing-table

查看IP路由表详细信息display ip routing-table verbose

查看静态路由表信息display ip routing-table protocol static [ inactive | verbose ]

删除所有静态路由delete [ vpn-instance vpn-instance-name ] static-routes all

(二)组网需求

路由器各接口及主机的IP地址和掩码如下图所示。要求采用静态路由,使图中任意两台主机之间都能互通。

(三)组网图

静态路由配置组网图

(四)配置步骤

1、配置各接口的IP地址:自行配置(与交换机类似),例如

[H3C]interface e 0/0

[H3C-Ethernet0/0]ip address 192.168.1.1 24

[H3C]interface serial3/0

[H3C-serial3/0]ip address 192.168.2.1 24

2、配置静态路由

# 进入系统视图。

system-view

# 在RouterA上配置缺省路由。

[RouterA] ip route-static 0.0.0.0 0.0.0.0 1.1.4.2

# 在RouterB上配置两条静态路由。

[RouterB] ip route-static 1.1.1.0 255.255.255.0 1.1.4.1

[RouterB] ip route-static 1.1.3.0 255.255.255.0 1.1.4.6

# 在RouterC上配置缺省路由。

[RouterB] ip route-static 0.0.0.0 0.0.0.0 1.1.4.5

3、配置主机

配置主机PC1的缺省网关为1.1.1.1,主机PC2的缺省网关为1.1.2.1,主机PC3的缺省网关为1.1.3.1。

4、查看配置结果

# 显示RouterA的IP路由表。(注意:查看RouterB、C的配置结果类似)

[RouterA] display ip routing-table

Routing Tables: Public

Destinations : 8 Routes : 8

Destination/Mask Proto Pre Cost NextHop Interface

0.0.0.0/0 Static 60 0 1.1.4.2 Serial3/0

1.1.1.0/24 Direct 0 0 1.1.1.1 Ethernet1/0

1.1.1.1/32 Direct 0 0 127.0.0.1 InLoopBack0

1.1.4.0/30 Direct 0 0 1.1.4.1 Serial3/0

1.1.4.1/32 Direct 0 0 127.0.0.1 InLoopBack0

1.1.4.2/32 Direct 0 0 1.1.4.2 Serial3/0

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoopBack0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoopBack0

# 使用Ping命令验证连通性。

[RouterA] ping 1.1.3.1

PING 1.1.3.1: 56 data bytes, press CTRL_C to break

Reply from 1.1.3.1: bytes=56 Sequence=1 ttl=254 time=62 ms

Reply from 1.1.3.1: bytes=56 Sequence=2 ttl=254 time=63 ms

Reply from 1.1.3.1: bytes=56 Sequence=3 ttl=254 time=63 ms

Reply from 1.1.3.1: bytes=56 Sequence=4 ttl=254 time=62 ms

Reply from 1.1.3.1: bytes=56 Sequence=5 ttl=254 time=62 ms

--- 1.1.3.1 ping statistics ---

5 packet(s) transmitted

5 packet(s) received

0.00% packet loss

round-trip min/avg/max = 62/62/63 ms

# 使用tracert命令验证连通性。

[RouterA] tracert 1.1.3.1

traceroute to 1.1.3.1(1.1.3.1) 30 hops max,40 bytes packet

1 1.1.4.

2 31 ms 32 ms 31 ms

2 1.1.4.6 62 ms 6

3 ms 62 ms

三、RIP路由配置

(一)组网需求

如下图所示,要求在RouterA和RouterB的所有接口上使能RIP,并使用RIP-2进行网络互连。

(二)组网图

(三)配置步骤

1、配置各接口的IP地址(略)

2、配置RIP基本功能

# 配置RouterA。

system-view

[RouterA] rip

[RouterA-rip-1] network 192.168.1.0

[RouterA-rip-1] network 172.16.0.0

[RouterA-rip-1] network 172.17.0.0

# 配置RouterB。

system-view

[RouterB] rip

[RouterB-rip-1] network 192.168.1.0

[RouterB-rip-1] network 10.0.0.0

# 查看RouterA的RIP路由表。

[RouterA] display rip 1 route

Route Flags: R - RIP, T - TRIP

P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect

--------------------------------------------------------------------------

Peer 192.168.1.2 on Serial3/0

Destination/Mask Nexthop Cost Tag Flags Sec

10.0.0.0/8 192.168.1.2 1 0 RA 14

从路由表中可以看出,RIP-1发布的路由信息使用的是自然掩码。

配置RIP的版本

# 在RouterA上配置RIP-2。

[RouterA] rip

[RouterA-rip-1] version 2

# 在RouterB上配置RIP-2。

[RouterB] rip

[RouterB-rip-1] version 2

# 查看RouterA的RIP路由表。

[RouterA] display rip 1 route

Route Flags: R - RIP, T - TRIP

P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect

--------------------------------------------------------------------------

Peer 192.168.1.2 on S erial3/0

Destination/Mask Nexthop Cost Tag Flags Sec

10.2.1.0/24 192.168.1.2 1 0 RA 32

10.1.1.0/24 192.168.1.2 1 0 RA 32

从路由表中可以看出,RIP-2发布的路由中带有更为精确的子网掩码信息。

&说明:

由于RIP路由信息的老化时间较长,所以在配置RIP-2版本后的一段时间里,路由表中可能还会存在RIP-1的路由信息。

四、OSPF路由配置

(一)组网需求

◆所有的路由器都运行OSPF,并将整个自治系统划分为3个区域。

◆其中RouterA和RouterB作为ABR来转发区域之间的路由。

◆配置完成后,每台路由器都应学到AS的到所有网段的路由。

(二)组网图

(三)配置步骤

1、配置各接口的IP地址(略)

2、配置OSPF基本功能

# 配置RouterA。

system-view

[RouterA] ospf

[RouterA-ospf-1] area 0

[RouterA-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255

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

[RouterA-ospf-1] area 1

[RouterA-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255

[RouterA-ospf-1-area-0.0.0.1] quit

[RouterA-ospf-1] quit

# 配置RouterB。

system-view

[RouterB] ospf

[RouterB-ospf-1] area 0

[RouterB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255

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

[RouterB-ospf-1] area 2

[RouterB-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255

[RouterB-ospf-1-area-0.0.0.2] quit

[RouterB-ospf-1] quit

# 配置RouterC。

system-view

[RouterC] ospf

[RouterC-ospf-1] area 1

[RouterC-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255

[RouterC-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255

[RouterC-ospf-1-area-0.0.0.1] quit

[RouterC-ospf-1] quit

# 配置RouterD。

system-view

[RouterD] ospf

[RouterD-ospf-1] area 2

[RouterD-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255

[RouterD-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255

[RouterD-ospf-1-area-0.0.0.2] quit

[RouterD-ospf-1] quit

3、检验配置结果

# 查看RouterA的OSPF邻居。

[RouterA] display ospf peer

OSPF Process 1 with Router ID 192.168.1.1

Neighbors

Area 0.0.0.0 interface 192.168.0.1(Serial3/0)'s neighbors

Router ID: 192.168.2.1 Address: 192.168.0.2 GR State: Normal

State: Full Mode: Nbr is Master Priority: 1

DR: None BDR: None MTU: 0

Dead timer due in 32 sec

Neighbor is up for 00:04:09

Authentication Sequence: [ 0 ]

Neighbors

Area 0.0.0.1 interface 192.168.1.1(Serial4/0)'s neighbors

Router ID: 192.168.1.2 Address: 192.168.1.2 GR State: Normal

State: Full Mode: Nbr is Master Priority: 1

DR: None BDR: None MTU: 0

Dead timer due in 34 sec

Neighbor is up for 00:04:21

Authentication Sequence: [ 0 ]

# 显示RouterA的OSPF路由信息。

[RouterA] display ospf routing

OSPF Process 1 with Router ID 192.168.1.1

Routing Tables

Routing for Network

Destination Cost Type NextHop AdvRouter Area 172.16.1.0/24 1563 Stub 192.168.1.2 192.168.1.2 0.0.0.1 172.17.1.0/24 3125 Inter 192.168.0.2 192.168.2.1 0.0.0.0

192.168.0.0/24 1562 Stub 192.168.0.1 192.168.1.1 0.0.0.0 192.168.1.0/24 1562 Stub 192.168.1.1 192.168.1.1 0.0.0.1 192.168.2.0/24 3124 Inter 192.168.0.2 192.168.2.1 0.0.0.0 Total Nets: 5

Intra Area: 3 Inter Area: 2 ASE: 0 NSSA: 0

# 显示RouterA的LSDB。

[RouterA] display ospf lsdb

OSPF Process 1 with Router ID 192.168.1.1

Link State Database

Area: 0.0.0.0

Type LinkState ID AdvRouter Age Len Sequence Metric Router 192.168.1.1 192.168.1.1 478 48 80000007 0 Router 192.168.2.1 192.168.2.1 479 48 80000007 0 Sum-Net 192.168.1.0 192.168.1.1 489 28 80000001 1562 Sum-Net 172.17.1.0 192.168.2.1 492 28 80000001 1563 Sum-Net 192.168.2.0 192.168.2.1 492 28 80000001 1562 Sum-Net 172.16.1.0 192.168.1.1 467 28 80000001 1563

Area: 0.0.0.1

Type LinkState ID AdvRouter Age Len Sequence Metric Router 192.168.1.2 192.168.1.2 448 60 80000007 0 Router 192.168.1.1 192.168.1.1 472 48 80000004 0 Sum-Net 172.17.1.0 192.168.1.1 473 28 80000001 3125 Sum-Net 192.168.2.0 192.168.1.1 473 28 80000001 3124 Sum-Net 192.168.0.0 192.168.1.1 489 28 80000001 1562 # 查看RouterD的路由表,并使用Ping进行测试连通性。

[RouterD] display ospf routing

OSPF Process 1 with Router ID 192.168.2.2

Routing Tables

Routing for Network

Destination Cost Type NextHop AdvRouter Area 172.16.1.0/24 4687 Inter 192.168.2.1 192.168.2.1 0.0.0.2 172.17.1.0/24 1 Stub 172.17.1.1 192.168.2.2 0.0.0.2 192.168.0.0/24 3124 Inter 192.168.2.1 192.168.2.1 0.0.0.2 192.168.1.0/24 4686 Inter 192.168.2.1 192.168.2.1 0.0.0.2 192.168.2.0/24 1562 Stub 192.168.2.2 192.168.2.2 0.0.0.2 Total Nets: 5

Intra Area: 2 Inter Area: 3 ASE: 0 NSSA: 0

[RouterD] ping 172.16.1.1

PING 172.16.1.1: 56 data bytes, press CTRL_C to break

Reply from 172.16.1.1: bytes=56 Sequence=1 ttl=253 time=62 ms

Reply from 172.16.1.1: bytes=56 Sequence=2 ttl=253 time=16 ms

Reply from 172.16.1.1: bytes=56 Sequence=3 ttl=253 time=62 ms

Reply from 172.16.1.1: bytes=56 Sequence=4 ttl=253 time=94 ms Reply from 172.16.1.1: bytes=56 Sequence=5 ttl=253 time=63 ms --- 172.16.1.1 ping statistics ---

5 packet(s) transmitted

5 packet(s) received

0.00% packet loss

round-trip min/avg/max = 16/59/94 ms

相关主题
文本预览
相关文档 最新文档