静态路由,默认路由,时钟频率(模拟运营商)
运用口令
- IP route ip 掩码 下一跳地址
- IP route 0.0.0.0 0.0.0.0 下一跳地址或者端口
- clock rate 64000
拓扑结构

实验思路
- 首先要3个私有的网络,分别是用户端,DNS解析端和Web服务端
- 使用三层路由,将客户端的电脑连入网络
- 在路由器上配置网关和时钟频率
- 在路由器上配置路由表
- 按需要配置默认路由,让三层交换机时钟将发出的数据从F0/3口发出。
IP及网段配置
电脑 |
IP |
掩码 |
网关 |
DNS |
PC0 |
192.168.1.1 |
255.255.255.0 |
192.168.1.254 |
192.168.10.1 |
PC1 |
192.168.2.1 |
255.255.255.0 |
192.168.2.254 |
192.168.10.1 |
server0 |
192.168.10.1 |
255.255.255.0 |
192.168.10.254 |
192.168.10.1 |
server1 |
192.168.20.1 |
255.255.255.0 |
192.168.20.254 |
192.168.10.1 |
路由器 |
F0/0 |
F0/1 |
F0/2 |
F0/3 |
Se0/0/0 |
Se0/0/1 |
Switch0 |
|
192.168.1.254/24 |
192.168.2.254/24 |
200.200.200.1/30 |
|
|
Router4 |
200.200.200.2/30 |
|
|
|
200.200.201.1/30 |
|
Router3 |
|
|
|
|
200.200.201.2/30 |
200.200.202.1/30 |
Router2 |
192.168.20.254/24 |
|
|
|
200.200.202.2/30 |
|
具体配置
三层交换机
Switch(config)#int range f0/1-2
Switch(config-if-range)#switchport mode trunk
Switch(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
Switch(config-if-range)#vlan 2
Switch(config-vlan)#name vlan2
Switch(config-vlan)#vlan 3
Switch(config-vlan)#name vlan3
Switch(config-vlan)#vlan 4
Switch(config-vlan)#name vlan4
Switch(config)#int f0/3
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 4
Switch(config-vlan)#int vlan 2
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to up
Switch(config-if)#ip add 192.168.1.254 255.255.255.0
Switch(config-if)#int vlan 3
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan3, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to up
Switch(config-if)#ip add 192.168.2.254 255.255.255.0
Switch(config-if)#int vlan 4
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan4, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan4, changed state to up
Switch(config-if)#ip add 200.200.200.1 255.255.255.252
Switch(config-if)#ex
Switch(config)#ip routing
Switch(config)#ip route 0.0.0.0 0.0.0.0 200.200.200.2
Switch>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 200.200.200.2 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, Vlan2
C 192.168.2.0/24 is directly connected, Vlan3
200.200.200.0/30 is subnetted, 1 subnets
C 200.200.200.0 is directly connected, Vlan4
S* 0.0.0.0/0 [1/0] via 200.200.200.2
Switch>ping 192.168.10.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/9 ms
switch0
Switch(config)#vlan 2
Switch(config-vlan)#name vlan2
Switch(config-vlan)#int f0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 2
Switch(config-if)#int f0/2
Switch(config-if)#switchport mode trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
---- -------------------------------- --------- -------------------------------
, , ,
, , ,
, , ,
, , ,
, , ,
,
-
--
-
-
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
- - - - -
- - - - -
- - - - -
- - - - -
- - - -
- - - -
------------------------------------------------------------------------------
------- --------- ----------------- ------------------------------------------
switch1
Switch(config)#vlan 3
Switch(config-vlan)#name vlan3
Switch(config-vlan)#int f0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 3
Switch(config-if)#int f0/2
Switch(config-if)#switchport mode trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
---- -------------------------------- --------- -------------------------------
, , ,
, , ,
, , ,
, , ,
, , ,
,
-
--
-
-
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
- - - - -
- - - - -
- - - - -
- - - - -
- - - -
- - - -
------------------------------------------------------------------------------
------- --------- ----------------- ------------------------------------------
Router4
Router(config)#int f0/0
Router(config-if)#ip add 200.200.200.2 255.255.255.252
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)#int s0/0/0
Router(config-if)#ip add 200.200.201.1 255.255.255.252
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
Router(config)#ip route 0.0.0.0 0.0.0.0 200.200.201.2
Router(config)#ip route 192.168.1.0 255.255.255.0 200.200.200.1
Router(config)#ip route 192.168.2.0 255.255.255.0 200.200.200.1
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 200.200.201.2 to network 0.0.0.0
S 192.168.1.0/24 [1/0] via 200.200.200.1
S 192.168.2.0/24 [1/0] via 200.200.200.1
200.200.200.0/30 is subnetted, 1 subnets
C 200.200.200.0 is directly connected, FastEthernet0/0
200.200.201.0/30 is subnetted, 1 subnets
C 200.200.201.0 is directly connected, Serial0/0/0
S* 0.0.0.0/0 [1/0] via 200.200.201.2
Router3
Router(config)#int s0/0/1
Router(config-if)#clock rate 64000
Router(config-if)#ip address 200.200.201.2 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface Serial0/0/1, changed state to up
Router(config-if)#int s0/0/0
Router(config-if)#clock rate 64000
Router(config-if)#ip address 200.200.202.1 255.255.255.252
Router(config-if)#no sh
Router(config-if)#
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
Router(config-if)#int f0/0
Router(config-if)#ip add 192.168.3.254 255.255.255.0
Router(config-if)#no shutdown
Router(config)#ip route 192.168.1.0 255.255.255.0 200.200.201.1
Router(config)#ip route 192.168.2.0 255.255.255.0 200.200.201.1
Router(config)#ip route 200.200.200.0 255.255.255.252 200.200.201.1
Router(config)#ip route 192.168.4.0 255.255.255.0 200.200.202.2
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
S 192.168.1.0/24 [1/0] via 200.200.201.1
S 192.168.2.0/24 [1/0] via 200.200.201.1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
S 192.168.4.0/24 [1/0] via 200.200.202.2
200.200.200.0/30 is subnetted, 1 subnets
S 200.200.200.0 [1/0] via 200.200.201.1
200.200.201.0/30 is subnetted, 1 subnets
C 200.200.201.0 is directly connected, Serial0/0/1
200.200.202.0/30 is subnetted, 1 subnets
C 200.200.202.0 is directly connected, Serial0/0/0
Router2
Router(config)#int f0/0
Router(config-if)#ip add 192.168.4.254 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)#int s0/0/0
Router(config-if)#ip add 200.200.202.2 255.255.255.252
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
Router(config)#ip route 0.0.0.0 0.0.0.0 200.200.202.1
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 200.200.202.1 to network 0.0.0.0
C 192.168.20.0/24 is directly connected, FastEthernet0/0
200.200.202.0/30 is subnetted, 1 subnets
C 200.200.202.0 is directly connected, Serial0/0/0
S* 0.0.0.0/0 [1/0] via 200.200.202.1
Router>