1. 程式人生 > >CCNA第五天(靜態路由,預設路由,時鐘頻率)

CCNA第五天(靜態路由,預設路由,時鐘頻率)

靜態路由,預設路由,時鐘頻率(模擬運營商)

運用口令

  1. IP route ip 掩碼 下一跳地址
  2. IP route 0.0.0.0 0.0.0.0 下一跳地址或者埠
  3. clock rate 64000

拓撲結構

這裡寫圖片描述

實驗思路

  1. 首先要3個私有的網路,分別是使用者端,DNS解析端和Web服務端
  2. 使用三層路由,將客戶端的電腦連入網路
  3. 在路由器上配置閘道器和時鐘頻率
  4. 在路由器上配置路由表
  5. 按需要配置預設路由,讓三層交換機時鐘將發出的資料從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
Switch#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/3, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24
2    vlan2                            active    Fa0/1
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
2    enet  100002     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------

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
Switch#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/3, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24
3    vlan3                            active    Fa0/1
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
3    enet  100003     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------

Switch#

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>