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_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">





原文地址:https://www.cnblogs.com/xuxaut-558/p/10036046.html