计算机网络实验 配置IPv4静态路由和缺省路由

计算机网络实验 配置IPv4静态路由和缺省路由

一、要求文档

二、命令实现

Part 2 基础设置配置

Step 2 路由器基础配置

  不再赘述,详情可以参见计算机网络实验 配置RIPv2动态网络

Step 3 路由器IP配置

根据要求内容配置路由器的IP地址,以R3为例,执行以下命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
R3#configure t
Enter configuration commands, one per line. End with CNTL/Z.

R3(config-if)#interface s0/0/0
R3(config-if)#ip address 10.1.1.2 255.255.255.252
R3(config-if)#clock rate 128000
R3(config-if)#no shutdown

R3(config-if)#
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up

R3(config-if)#exit
R3(config)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to up

R3(config)#interface g0/1
R3(config-if)#ip address 192.168.1.1 255.255.255.0
R3(config-if)#no shutdown

R3(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up

R3(config-if)#exit

<!-- 配置两个回环端口 -->
R3(config)#interface loopback 0

R3(config-if)#
%LINK-5-CHANGED: Interface Loopback0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up

R3(config-if)#ip address 209.165.200.225 255.255.255.224
R3(config-if)#no shutdown
R3(config-if)#interface loopback 1

R3(config-if)#
%LINK-5-CHANGED: Interface Loopback1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up

R3(config-if)#ip address 198.133.219.1 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#end
R3#
%SYS-5-CONFIG_I: Configured from console by console

R3#wr
Building configuration...
[OK]

Part 3 配置静态路由

Step 1 配置递归静态路由

以R1为例,执行以下命令:

1
2
3
4
5
R1#configure t
Enter configuration commands, one per line. End with CNTL/Z.

<!-- IP地址 子网掩码 下一跳IP地址 -->
R1(config)#ip route 192.168.1.0 255.255.255.0 10.1.1.2

Step 2 配置直连静态路由

以R3为例,执行以下命令:

1
2
3
4
5
6
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.

<!-- IP地址 子网掩码 出口端口名 -->
R3(config)#ip route 192.168.0.0 255.255.255.0 s0/0/0
%Default route without gateway, if not a point-to-point interface, may impact performance

此命令只在一个路由器执行即可,因为在简单的点对点连接中,单边配置静态路由即可实现双向通信,这是利用了路由器的直连路由特性和IP通信的对称性原理。

Part 4 配置缺省路由

以R1为例,执行以下命令

1
2
<!-- 缺省状态下前两个参数都是0.0.0.0 最后一个参数仍是下一跳地址 -->
R1(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.2

计算机网络实验 配置IPv4静态路由和缺省路由
http://example.com/2025/05/15/note43/
作者
谢斐
发布于
2025年5月15日
许可协议