静态路由配置

路由器通过串行线连接,激活相应的端口,设置好静态路由表,并对PC机进行基本的设置,最后进行连接测试验证。

实验拓扑结构图如下

静态路由配置_第1张图片

给所有路由器添加物理设备WIC-2T,如图

静态路由配置_第2张图片

首先配置R0
Continue with configuration dialog? [yes/no]: no
Press RETURN to get started!
Router>en
Router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f0/1                            //给所有R0端口设置ip
Router(config-if)#ip add 10.1.1.1 255.255.255.0
Router(config-if)#no shut
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)#int f0/0
Router(config-if)#ip add 10.1.5.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

Router(config-if)#int s0/0/0
Router(config-if)#ip add 10.1.2.1 255.255.255.0
Router(config-if)#no shut

%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
Router(config-if)#int s0/0/1
Router(config-if)#ip add 10.1.3.1 255.255.255.0
Router(config-if)#no shut

%LINK-5-CHANGED: Interface Serial0/0/1, changed state to down
Router(config-if)#int s0/1/0
Router(config-if)#ip add 10.1.4.1 255.255.255.0
Router(config-if)#no shut

%LINK-5-CHANGED: Interface Serial0/1/0, changed state to down
Router(config-if)#ip route 192.168.10.0 255.255.255.0 s0/0/0   //配置静态路由
Router(config)#ip route 192.168.20.0 255.255.255.0 s0/0/1
Router(config)#ip route 192.168.30.0 255.255.255.0 s0/1/0
Router(config)#ip route 192.168.40.0 255.255.255.0 s0/1/0
Router(config)#ip route 172.16.10.0 255.255.255.0 f0/0
Router(config)#end
Router#
%SYS-5-CONFIG_I: Configured from console by console

Router#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, FastEthernet0/1


配置R1
Router>en
Router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#ip add 192.168.10.1 255.255.255.0
Router(config-if)#no shut

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)#int f0/1
Router(config-if)#ip add 192.168.20.1 255.255.255.0
Router(config-if)#no shut

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)#int s0/0/0
Router(config-if)#ip add 10.1.2.1 255.255.255.0
Router(config-if)#no shut

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

Router(config-if)#int s0/0/1
Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to up

Router(config-if)#int s0/0/1
Router(config-if)#ip add 10.1.3.1 255.255.255.0
Router(config-if)#no shut

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

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/1, changed state to up
Router(config-if)#ip route 192.168.30.0 255.255.255.0 s0/0/0
Router(config)#ip route 192.168.40.0 255.255.255.0 s0/0/0
Router(config)#ip route 172.16.10.0 255.255.255.0 s0/0/0
Router(config)#ip route 10.1.1.0 255.255.255.0 s0/0/0

配置R2
Router>en
Router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#ip add 192.168.30.1 255.255.255.0
Router(config-if)#no shut

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)#int f0/1
Router(config-if)#ip add 192.168.40.1 255.255.255.0
Router(config-if)#no shut

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)#int s0/0/0
Router(config-if)#ip add 10.1.4.1 255.255.255.0
Router(config-if)#no shut

Router(config-if)#
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
	
Router(config-if)#ip route 192.168.10.0 255.255.255.0 s0/0/0	
Router(config)#ip route 192.168.20.0 255.255.255.0 s0/0/0
Router(config)#ip route 10.1.1.0 255.255.255.0 s0/0/0
Router(config)#ip route 172.16.10.0 255.255.255.0 s0/0/0


配置R3
Router>en
Router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#ip add 10.1.5.1 255.255.255.0
Router(config-if)#no shut

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
%IP-4-DUPADDR: Duplicate address 10.1.5.1 on FastEthernet0/0, sourced by 0001.C976.A401
%IP-4-DUPADDR: Duplicate address 10.1.5.1 on FastEthernet0/0, sourced by 0001.C976.A401

Router(config-if)#int f0/1
Router(config-if)#ip add 172.16.10.1 255.255.255.0
Router(config-if)#no shut

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)#ip route 192.168.10.0 255.255.255.0 f0/0
Router(config)#ip route 192.168.20.0 255.255.255.0 f0/0
Router(config)#ip route 192.168.30.0 255.255.255.0 f0/0
Router(config)#ip route 192.168.40.0 255.255.255.0 f0/0
Router(config)#


给各个主机设置ip、掩码、网关
PC0:   192.168.10.2   255.255.255.0  192.168.10.1
PC1:   192.168.20.2   255.255.255.0  192.168.20.1
PC2:   192.168.30.2   255.255.255.0  192.168.30.1
PC3:   192.168.40.2   255.255.255.0  192.168.40.1
PC4:   172.16.10.2   255.255.255.0  172.16.10.1
Server0:10.1.1.2      255.255.255.0  10.1.1.1

对PC0

静态路由配置_第3张图片
静态路由配置_第4张图片


对PC1

静态路由配置_第5张图片

静态路由配置_第6张图片


对PC2

静态路由配置_第7张图片

静态路由配置_第8张图片


对PC3

静态路由配置_第9张图片静态路由配置_第10张图片


对PC4

静态路由配置_第11张图片

静态路由配置_第12张图片

静态路由配置_第13张图片



对server0

静态路由配置_第14张图片

静态路由配置_第15张图片

静态路由配置_第16张图片





你可能感兴趣的:(网络,交换机,思科,CCNA)