1. 程式人生 > >8.CCNA第八天-路由決策二層資料轉發/資料封裝/二層封裝三層不變/ARP請求

8.CCNA第八天-路由決策二層資料轉發/資料封裝/二層封裝三層不變/ARP請求

路由器 做路徑決策
從自身的路由表中選取最優路徑為主機提供資料轉發服務

乙太網當中,靜態路由後面書寫 出介面和下一跳的問題

如果書寫下一跳  路由器將執行遞迴查詢,以查找出介面

如果書寫出介面,路由器將直接將資料轉發出去,但是存在路由器會對去往該網路的所有主機,都做ARP請求

一般情況下,在乙太網的靜態路由書寫中,我們會同時寫上出介面和下一跳
S        172.16.1.0 [1/0] via 192.168.1.2, Ethernet0/1
  1
S
       172.16.1.0 [1/0] via 192.168.1.2, Ethernet0/1
去往目的網路,資料從e0/1介面轉發,下一跳地址為192.168.1.2 靜態路由的管理距離,預設為 1

一旦靜態路由指定的出介面故障(比如網線斷掉),那麼靜態路由也會從路由表中消失

Branch#sh run | section ip route
ip route 172.16.1.0 255.255.255.0 Ethernet0/1 192.168.1.2
ip route 172.16.1.0 255.255.255.0 Serial1/0 3
  1
Branch#sh run | section ip route
2
ip
route 172.16.1.0 255.255.255.0 Ethernet0/1 192.168.1.2
3
ip route 172.16.1.0 255.255.255.0 Serial1/0 3
4
管理距離處於劣勢的路由,不會出現在路由表中,對資料轉發不產生影響
S        172.16.1.0 [6/0] via 202.100.1.2, Serial1/0
當主要鏈路失效,處於備份狀態的靜態路由條目會自動上浮到路由表中,我們通常術語稱為《浮動靜態路由》


=============================================

基於廣播域的一種管理方案  VLAN (虛擬區域網)
交換機邏輯上的管理,將不同的埠,劃分到不同的廣播域中
常用方法是基於介面的劃分
一個VLAN 就是一個廣播域
原則上講,應該將一個VLAN中的主機劃分到同一IP子網

trunk  跨越交換機的VLAN資料傳遞

需要一種機制,讓交換機之間互相能夠識別轉發過來的資料應該屬於哪個VLAN

802.1Q  cisco的二層交換機,僅僅支援802.1q一種trunk封裝格式

通過在來自不同VLAN的資料幀上打上不同的標記,用以識別不同VLAN的流量;這樣的話,在交換機之間只需要一條鏈路即可

native VLAN  預設不會被打上標記的一個VLAN

建立一個VLAN  可用範圍 1-4094  (1為預設VLAN)
1002-1005 是被保留的VLAN  我們不能用

12bit欄位標識

SW1#show vlan id 10

VLAN Name                            Status    Ports
---- -------------------------------- --------- -------------------------------
10  VLAN0010                        active    Et0/2, Et0/3

VLAN Type  SAID      MTU  Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
10  enet  100010    1500  -      -      -        -    -        0      0  

Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------
12   1
SW1#show vlan id 10
2
3
VLAN Name                            Status    Ports
4
---- -------------------------------- --------- -------------------------------
5
10  VLAN0010                        active    Et0/2, Et0/3
6
7
VLAN Type  SAID      MTU  Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
8
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
9
10  enet  100010    1500  -      -      -        -    -        0      0  
10
11
Primary Secondary Type              Ports
12
------- --------- ----------------- ------------------------------------------


SW1#show vlan brief

VLAN Name                            Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Et0/0, Et0/1, Et1/0, Et1/1
                                                Et1/2, Et1/3, Et2/0, Et2/1
                                                Et2/2, Et2/3
10  VLAN0010                        active   
100  VLAN0100                        active   
200  VLAN0200                        active   
1002 fddi-default                    act/unsup
1003 token-ring-default              act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

指派介面到vlan
interface Ethernet0/1
switchport access vlan 10

SW1#show interfaces e0/1 switchport
Name: Et0/1
Switchport: Enabled
Administrative Mode: dynamic desirable
Operational Mode: static access
Administrative Trunking Encapsulation: negotiate
Operational Trunking Encapsulation: native
Negotiation of Trunking: On
Access Mode VLAN: 10 (qytang)
Trunking Native Mode VLAN: 1 (default)
Administrative Native VLAN tagging: enabled
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk Native VLAN tagging: enabled
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk associations: none
Administrative private-vlan trunk mappings: none
Operational private-vlan: none
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL

Appliance trust: none

access工作模式的埠  只轉發一個被指派的vlan的流量

ISL  802.1q
在cisco多層交換機上的trunk介面配置方式
interface Ethernet0/2
switchport trunk encapsulation dot1q
switchport mode trunk

SW2#show interfaces trunk

Port        Mode            Encapsulation  Status        Native vlan
Et0/2      on              802.1q        trunking      1
Et0/3      on              802.1q        trunking      1

Port        Vlans allowed on trunk
Et0/2      1-4094
Et0/3      1-4094

Port        Vlans allowed and active in management domain
Et0/2      1,10,100,200
Et0/3      1,10,100,200

Port        Vlans in spanning tree forwarding state and not pruned
Et0/2      1,10,100,200
Et0/3      none

DTP  協商交換機之間的trunk鏈路的

作業:
1、
實施浮動靜態路由
在Branch裝置上,當e0/1介面正常工作時,去往172.16.1.0/24網路的資料,通過乙太網介面轉發
當e0/1介面故障時,通過s1/0介面轉發

2、在SW1、SW2上建立VLAN 666  命名為 qytang
兩臺交換機之間的介面指定trunk封裝格式為 802.1q
兩臺交換機的e0/1介面劃入 VLAN 666
在兩臺PC上配置IP地址,要求在同一網段
PC1能 ping 通 PC2




來自為知筆記(Wiz)