一:建立拓扑图并对路由接口进行配置。
- 建立拓扑图:
- 对R1路由进行配置
Router>enable
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
R1(config)#interface GigabitEthernet 0/0
R1(config-if)#ip address 192.168.1.254 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
R1(config-if)#exit
R1(config)#interface Gigab
R1(config)#interface GigabitEthernet 0/1
R1(config-if)#ip address 12.12.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
- 对R2路由进行配置
R2(config)#interface GigabitEthernet 0/0
R2(config-if)#ip address 76.12.16.133 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface GigabitEthernet0/0
R2(config-if)#exit
R2(config)#interface GigabitEthernet0/1
R2(config-if)#ip address 12.12.12.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
- 对R2路由进行配置
Router>enable
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R3
R3(config)#interface GigabitEthernet 0/0
R3(config-if)#ip address 76.12.16.134 255.255.255.252
R3(config-if)#no shutdown
R3(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
R3(config-if)#exit
R3(config)#interface GI
R3(config)#interface GIgabitEthernet 0/1
R3(config-if)#ip address 76.12.32.254 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 GIgabitEthernet 0/2
R3(config-if)#ip address 76.12.96.254 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/2, changed state to up
可观察得拓扑线路已连通:
二.验证pc与路由间的通信。
①首先为PC0 PC1 PC2 配置IP地址、子网掩码和默认网关。
验证PC0到R3互连接口的通信,验证PC0到R3互连接口的通信
验证PC0到R3互连接口的通信,验证PC0到R3互连接口的通信,验证PC0到R3互连接口的通信。
②pc之间的通信:
PC0: | PC1: |
PC2: |
②路由器间的通信:
在R1上:
Ping R2
在R2上:
PingR3
③pc与路由器之间的通信:
PC2去ping PC1和PC0,结果如图所示
- 在R1上配置路由汇总,R3上配置缺省路由
R1上配置:
R1>enable
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip route 76.12.0.0 255.255.0.0 12.12.12.2
R3上配置:
R3>enable
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#ip route 0.0.0.0 0.0.0.0 76.12.16.133
- 在R2上配置静态路由
R2上配置:
R2>
R2>enable
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip route 76.12.32.0 255.255.255.0 76.12.16.134
R2(config)#ip route 76.12.96.0 255.255.255.0 76.12.16.134
R2(config)#ip route 192.168.1.0 255.255.255.0 12.12.12.1
- 查看三台路由器上的路由信息:
R1:
R2:
R3:
- PC2与PC1、PC0互相ping测试
PC2:
PC1:
PC0:
和R3可用。