静态路由实验
# 什么是路由器
路由器的主要功能是路由寻址和转发数据,是一个三层设备,工作在网络层。路由技术研究的是 发送数据时寻找最佳的路径的过程
.需要注意的是,路由不是基于 IP 地址来转发,而是基于网络地址转发的。
# 静态路由配置命令
# 路由配置命令
Router(config) ip route 192.168.0.0 255.255.255.0 172.16.10.1
Router(config) ip route 192.168.0.0 255.255.0.0 172.16.10.1
# 端口 ip 配置命令
Router(config) interface f0/0
Router(config-if) ip add 192.168.31.2 255.255.255.0
Router(config-if) no shutdown
Router(config-if) exit
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
# 实验目标
# 实现过程
R1:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface f0/0
Router(config-if)#ip add 192.168.0.1 255.255.255.0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#interface f0/1
Router(config-if)#ip add 172.16.0.1 255.255.255.0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#ip route 172.16.1.0 255.255.255.0 172.16.0.2
Router(config)#ip route 192.168.1.0 255.255.255.0 172.16.0.2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
R2:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface f0/0
Router(config-if)#ip add 172.16.0.2 255.255.255.0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#interface f0/1
Router(config-if)#ip add 172.16.1.1 255.255.255.0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#ip route 192.168.1.0 255.255.255.0 172.16.1.2
Router(config)#ip route 192.168.0.0 255.255.255.0 172.16.0.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
R3:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface f0/0
Router(config-if)#ip add 172.16.1.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#interface f0/1
Router(config-if)#ip add 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#ip route 172.16.0.0 255.255.255.0 172.16.1.1
Router(config)#ip route 192.168.0.0 255.255.255.0 172.16.1.1
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
PC1:
PC2:
# 查看配置的命令
Router#show ip route //查看路由表
Router#ip int brief //查看接口IP地址
Router#ip route static //查看静态路由
Router(config)#no ip routing //先关闭路由功能
Router(config)#ip routing //然后再打开路由表
1
2
3
4
5
2
3
4
5
上次更新: 2022/12/30, 16:48:05