C114门户论坛百科APPEN| 举报 切换到宽版

亚星游戏官网

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索

军衔等级:

亚星游戏官网-yaxin222  新兵

注册:2004-10-17
发表于 2004-12-10 00:25:00 |显示全部楼层
二三层转发流程  

二层转发:
假设Pc1,和Pc2发ping包,pc1的IP地址是1.1.1.3,网关掩码是255.255.0.0,
pc2的IP地址是1.1.1.5,网关掩码是255.255.0.0,

Pc1 发ping包时,先比较pc1的IP和pc1网关相与是否等于pc2的IP和pc1网关相与的值,若相等,则认为是二层转发。

若认为是二层转发则查本机的ARP表,看表中是否有这一项。

若有:

则可由pc2的IP得到pc2的mac,然后发ICMP requst报文给L3,L3收到后,先查pct(端口配置表)表,比较目的mac是否与L3的MAC相等,若相等,则认为是三层,在此情况下是不相等,则接着查vlan表,得到vlanid,然后以vlanid和目的mac为索引,查单播mac表,

若查得到,则可得到出端口号,然后,帧走到下行,在下行入队列之后,学习添加pc1的mac表项。

若在单播MAC表中查不到,则根据原来vlan表中查到的mid,查Mid up表,然后由此表可知有那些lpu 板上配有此vlan,(因为是广播,所以就不查单播mac表了),然后再上网板前,把此ICMP报文复制给每个lpu板一份,然后下网板的时候,查mid down表,得到本板上哪些端口是属于这个vlan的,对属于本vlan的各个端口(pc1所在的端口除外)都复制一份ICMP报文下发下去,当进行到本板的最后一个端口时,添加有关pc1的单播mac表项。
各端口的pc收到此ICMP报文后,比较目的mac是否与本机相同,若不同则丢弃,若相同,则接收,并回ICMP reply报文。此处,也就是pc2回ICMP reply报文。L3收到后,在下行的时候学习到pc2的mac表项。


若没有:

则发ARP广播,请求目的IP为pc2的MAC,此时目的MAC填的是全f,当L3收到这个ARP报文后,先查PCT表,比较报文中的目的MAC是否与L3的MAC相等,此处为不等,认为是二层转发,先查vlan表,得到vlanid,然后用vlanid查Mid up表,然后由此表可知有那些lpu 板上配有此vlan,(因为是广播,所以就不查单播mac表了),然后再上网板前,把此ARP报文复制给每个lpu板一份,然后下网板的时候,先抄送一份给CP,此时cp可以由此ARP 报文学习ARP表项和FIB表项。查mid down表,得到本板上那些端口是属于这个vlan的,对属于本vlan的各个端口(pc1所在的端口除外)都复制一份ARP报文下发下去,当进行到本板的最后一个端口时,添加有关pc1的单播mac表项。
这时,pc2将会收到此ARP报文,pc2收到后,发送ARP应答给L3,然后因为L3中已经有了pc1的mac表项,直接可以发到pc1所在的端口,此时学习pc2的mac信息。这样
当此ARP reply报文回到pc1后,pc1就可以直接发ICMP报文了。

三层转发:


假设Pc1 ,和Pc2 发ping包,pc1的IP地址是2.2.2.2,网关掩码是255.255.0.0,
pc2的IP地址是3.3.3.3,网关掩码是255.255.0.0,网关是3.3.3.1。


pc1发ping包时,先比较pc1的IP和网关相与是否等于pc2的IP和网关相与的值,不相等,认为是三层转发,然后查本机的fib表,查对应下一跳IP的Mac。

若查到了,则可直接发ICMP报文了。转 * 处继续处理。

若查不到,
则发ARP 报文请求下一跳IP 的mac(本例中也就是L3的mac),即目的mac为L3的mac,目的ip为L3的ip。
此ARP报文到了L3后,会在pc1所属的vlan内广播一下,同时给cp送一份,此时cp回一个ARP reply应答,同时学习pc1的fib和arp表项,下行的时候学习pc1的mac。


* pc1收到此ARP reply后,开始发ICMP报文,目的ip为pc2的ip,目的mac为L3的mac。
此ARP reply报文到了L3后,L3先查PCT表比较目的mac是否等于L3的mac,此处相等,则认为是三层转发。
再查fib表,得到下一跳的IP和目标板号,目标端口号,在查fib表的过程中:

若一项都不能匹配,则丢弃;

若能匹配,则匹配有两种情况:

1、能匹配到主机路由,则在下行的时候查ARP表项,从相应端口发出去;

2、只能匹配到网段路由,则产生fib miss消息,并把此ICMP报文 上送cp,当cp收到此ICMP报文后,则发一个ARP广播报文在pc2所属的vlan内进行广播,(此处是采用D201封装的,解封装后相当于二层报文),此报文进入下行,并通过wrap端口环回到上行,在上行的时候再查pct表,vlan表,和mid up表,给每个在pc2的vlan的各板复制一份,上网板,下网板,(此时因为判断原mac是L3的mac,所以就不上送给cp了),再查mid down表,给每个板上各所在pc2的vlan的各端口复制一份。
当pc2收到此ARP报文后,则回一个Arp reply给L3 ,然后L3就可以学到pc2的fib和arp表项,下行的时候学习到pc2的mac表项。
这样,pc1和pc2就可以ping通了。

  



二三层转发流程中的重要微码表
二层转发
首先报文从PC机发出时查找本机ARP表(arp -a),若存在相应的表项,就直接发出,报文下一跳MAC地址为目的MAC地址,IP地址为目的IP地址。若不存在相应表项则发出ARP请求报文,走ARP请求流程。等报文来到交换设备S,S首先查找自己的PCT表,比较报文的目的MAC地址和自己的MAC地址是否相同,若相同则为三层转发,二层转发则不相同。下面查找S设备的VLAN表(disp efu l3vlan)通过报文帧中所带的vlan id检查此报文做了哪些配置,不同配置要走不同的流程。此外大家还可以得到mid表项。然后通过vlan id查找单播MAC表(disp mac dy slotnum)从相应的出接口发出报文,在下行学习源MAC表项,最后到达目的地。如果这里查找单播MAC表失败的话,就根据刚才的mid值在上行查找mid_up_tbl,看哪些单板上有这个vlan,在每个含有此vlan的单板都复制一份广播报文,在下行查找mid down表得知在单板上此vlan包含哪些端口,最后就复制报文在这些端口进行广播。目的PC收到此报文后进行回应。S收到回应报文在下行学习该MAC地址。
PC S S S S
ARP--------->亚星游戏官网-yaxin222CT--------->VLAN--------->MAC---------->Mid_Up--------
S
-->Mid_Down

pct表
[121-diag]
PCT:
00 E0 FC 0F AB 57 EB 07 ***这就是设备的mac地址。报文中的mac地址与之。
00 00 6E 10 00 40 00 00 ***比较判断二三层转发
Detail:
MAC address: 00.E0.FC.0F.AB.57.
arp is enabled
ip multicast is enabled
broadcast is enabled
mpls multicast is disabled
ip is enabled
mpls unicast is disabled
clns is enabled
support_8021p is disabled
reserved ipmc is disabled
qinq enable is disabled
qinq internet access enable is disabled
Port is not isolated
vswtich is disabled
vswtich is inclusive
l2 bridge is enabled
port aggregation is disabled
STP Op is disabled
Blocking is disabled
Listening is disabled
Learning is disabled
Forwarding is enabled
Ingress filtering Op is enabled
Admit all frames is enabled
default priority is 0
default vlanid is 110
l4_skip is disabled
ba_flag is disabled
sa lookup is disabled
eth port type is ethernet_l2
ingress_context(hex) is 000

ac field is absent
physical port is ethernet
entry address is 0000
complete unit generate label is disabled
hard classifier is disabled
start pos of QW 0
prefetched QWs is 4
reserved ip mc address 00-15: [0x0]-[0x0]-[0x0]-[0x555555]
reserved ip mc address 16-31: [0x5502823c]-[0x90000000]-[0x0]-[0x0]
Done.
[121-diag]

Vlan表
[121-diag]disp efu l3vlan 3 110
Start query l3vlan of board 03...

completionCode = 0
vlan_id = 110
MID = 110
learningDisabled is enable
NotuseMid is disable
VlanDisable is disable
vpls is disable
multicast is disable
vrrp = 0
supervlanid = 0
MC reserved Flag = 0x0
vpnid = 1
counterindex =0x1130a3
mc_ttl =0
l3_enable =1
qos_behavior =3
trust 802.1p =0
igmp =0
memberSet = 0x0 0x8 0x0 0x0 0x0 0x0
untaggedSet = 0x0 0x8 0x0 0x0 0x0 0x0
groupFilter = 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x100 0x111ca7
[121-diag]

mac表
[121]display mac-address dy 3
MAC Address VLAN ID Port/Lsp Type
----------------------------------------------------------------
0005-5d0a-1b2d 110 gigabitethernet3/0/0 dynamic
00e0-fc11-2233 110 gigabitethernet3/0/0 dynamic

mid up表
[121-diag]disp efu mid_up_tbl 3 110
Start query mid_up_tbl of board 03...
Slot member of mid 110 = [3]
三层转发
首先PC机根据目的IP地址先查找自己的路由表(route print),查对应下一跳的IP地址,在根据此IP 地址查找ARP表对应下一跳的MAC地址(若查不到则发ARP请求,走ARP流程)。报文到达接入设备后,设备还是查找PCT表,判断二三层转发。然后查找FIB表,得到下一跳IP地址和目标板号和端口号(tb & tp),没有匹配的表项就丢弃报文。这里如果只能找到网段路由,则发fib_miss到主控板CP,CP走ARP流程进行学习。若存在主机表项,则从相应端口出。

fib表
[121-diag]disp efu fib 3 192.168.120.3 24 vrf1
Start display lpu fib on board 03...

Message sending success.

[121-diag]
IP address = 192.168.120.0
IP prefixLength = 24
VRF index = 1
Signature = 0
ecmpThr1 = 100
ecmpThr2 = 0
nextHop[0] lsptoken = 44
inner label = 1040
egressContext = 0
tb = 5 tp = 0x3 subIndex = 0
nextHop[0] is MPLS
nextHop[0] is WITH_BGP_LABEL
arp表
[121-diag]disp efu arp 3 0 0 192.168.110.3 110
Start display lpu arp on board 03...

Message sending success.

[121-diag]
IP address = 192.168.110.3
nextHopMac = 0.5.5d.a.1b.2d
vlanid = 110
encapsulation type is DIX
slot=3, card=0, port=0

需要注意的几个常用表项
1. 查报文的丢弃计数
[121-diag]disp efu counter 3 discard
Start show lpu efu ims information of board 03...

show lpu efu ims information message is sent successfully.

[121-diag]
Discard[ 47]= 27, reason:FIB lookup failed //说明有报文因为fib表查找失败而丢失。
2. 查报文的转发计数
[121-diag]disp efu counter 3 internal
Start show lpu efu ims information of board 03...

show lpu efu ims information message is sent successfully.

[121-diag]
Internal[ 4]= 3, reason:enqi unicast frame to LPU 15
Internal[ 16]= 564, reason亚星游戏官网-yaxin222201 frame //下送接口板的组播报文
Internal[ 18]= 7, reason亚星游戏官网-yaxin222205 frame //下送接口板的单播报文
Internal[ 20]= 21, reason亚星游戏官网-yaxin222204 frame //上送主控板的单播报文
Internal[ 22]= 3, reason:Wrap Copy frame
Internal[ 28]= 2390947859, reason:frame entering L3 //进入的3层报文
Internal[ 32]= 3, reason:RESERVED
Internal[ 46]= 2390945735, reason亚星游戏官网-yaxin2223 into L4 //上送主控板处理的上层协议报文(3层到4层)
Internal[ 48]= 2239430201, reason:SMT leaf hitted
Internal[ 55]= 5462, reason:frame entering L2 //进入的2层报文
Internal[ 64]= 6026, reason亚星游戏官网-yaxin2222 sent M1 frame
Internal[ 74]= 2390947820, reason:RESERVED
[121-diag]
3. 查nps接收和发送的控制报文,数据报文计数
[121-diag]disp msgcnt 3 ?
cmo To display CMO message counter information //cmo计数
control To display control message counter information //普通消息计数
egress To display egress data message counter information //NP上送协议报文计数
ingress To display ingress data message counter information //上层下发给NP的协议报文计数
[121-diag]disp msgcnt 3 con
[121-diag]disp msgcnt 3 control ?
INTEGER<0-8> Please seletct number 0:All; 1:Ip; 2:Mac; 3:Vlan; 4:Mpls;
5亚星游戏官网-yaxin222os; 6:Nat; 7:webswitch; 8:Reset

[121-diag]disp msgcnt 3 control 4

Start display message conuter on board 03...

OutSegment Add: RPS->NPS = 232, NPS->NP = 232
OutSegment Update: RPS->NPS = 0, NPS->NP = 0
OutSegment Delete: RPS->NPS = 27, NPS->NP = 27
InSegment Add: RPS->NPS = 325, NPS->NP = 325
InSegment Update: RPS->NPS = 0, NPS->NP = 0
InSegment Delete: RPS->NPS = 33, NPS->NP = 33
E2D Add: RPS->NPS = 0, NPS->NP = 0
E2D Update: RPS->NPS = 0, NPS->NP = 0
E2D Delete: RPS->NPS = 0, NPS->NP = 0
D2E Add: RPS->NPS = 0, NPS->NP = 0
D2E Update: RPS->NPS = 0, NPS->NP = 0
D2E Delete: RPS->NPS = 0, NPS->NP = 0
FACS Add: RPS->NPS = 0, NPS->NP = 0
FACS Update: RPS->NPS = 0, NPS->NP = 0
FACS Delete: RPS->NPS = 0, NPS->NP = 0
VPN Add: RPS->NPS = 0, NPS->NP = 0
VPN Update: RPS->NPS = 0, NPS->NP = 0
VPN Delete: RPS->NPS = 0, NPS->NP = 0
[121-diag]disp msgcnt 3 eng
[121-diag]disp msgcnt 3 eg
[121-diag]disp msgcnt 3 egress ?
INTEGER<0-1> Is reset? 1:yes; 0:no; default=0
<cr>

[121-diag]disp msgcnt 3 egress

Start display message conuter on board 03...

Egress Data Message Statistic:
ARP_Request: XXX->NPS = 6349, NPS->NP = 6349
ARP_ACK: XXX->NPS = 718, NPS->NP = 718
L3_NEED_FIB: XXX->NPS = 0, NPS->NP = 0
DHCP_RSTP: XXX->NPS = 0, NPS->NP = 0
HGMP_GVRP: XXX->NPS = 0, NPS->NP = 0
L3_NO_FIB_Other: XXX->NPS = 3860, NPS->NP = 3860
ICMP_L2VPN: XXX->NPS = 0, NPS->NP = 0
RIP_Broatcast: XXX->NPS = 0, NPS->NP = 0
L2_Other: XXX->NPS = 0, NPS->NP = 0
ETH_VRRP: XXX->NPS = 8218, NPS->NP = 8218
L2_ISIS: XXX->NPS = 0, NPS->NP = 0
[121-diag]disp msgcnt 3 ing
[121-diag]disp msgcnt 3 ingress
^
% Incomplete command found at '^' position.
[121-diag]disp msgcnt 3 ingress ?
INTEGER<0-21> Please select number 0:All; 1-20:Component Number; 21:Reset

[121-diag]disp msgcnt 3 ingress 0

Start display message conuter on board 03...

Ingress Data Message Statistic:
Component- 1 Reason_code- 1: NP->NPS = 0, NPS->XXX = 0
Component- 1 Reason_code- 2: NP->NPS = 0, NPS->XXX = 0
Component- 1 Reason_code- 3: NP->NPS = 0, NPS->XXX = 0
Component- 2 Reason_code- 1: NP->NPS = 0, NPS->XXX = 0
Component- 2 Reason_code- 4: NP->NPS = 0, NPS->XXX = 0
Component- 3 Reason_code- 0: NP->NPS = 293, NPS->XXX = 293
Component- 3 Reason_code- 1: NP->NPS = 0, NPS->XXX = 0
Component- 3 Reason_code- 2: NP->NPS = 40643, NPS->XXX = 40643
Component- 3 Reason_code- 3: NP->NPS = 0, NPS->XXX = 0
Component- 3 Reason_code- 4: NP->NPS = 0, NPS->XXX = 0
Component- 3 Reason_code- 6: NP->NPS = 0, NPS->XXX = 0
[121-diag]
[121-diag]disp msgcnt 3 cmo
[121-diag]disp msgcnt 3 cmo ?
INTEGER<0-6> Please select number 0:All; 1亚星游戏官网-yaxin222ort; 2亚星游戏官网-yaxin222rotocol; 3亚星游戏官网-yaxin222os; 4亚星游戏官网-yaxin2222if;
5亚星游戏官网-yaxin222m; 6:Reset

[121-diag]disp msgcnt 3 cmo 0

Start display message conuter on board 03...

CMO Message Statistic:
CMO_PORT_Valid: RPS->NPS = 0, NPS->NP = 0
CMO_PORT_Status: RPS->NPS = 0, NPS->NP = 0 CMO_NI_Status: RPS->NPS = 0, NPS->NP = 0
CMO_NI_ShutDown: RPS->NPS = 12, NPS->NP = 0

4. 查Qos规则命中计数
[121-diag]efu qos hit-count eacl e111
Query EACL hit count from NPS:
e111 r192: GigabitEthernet3/0/0 VLAN 65535 //不同的规则命中计数
The number of EACL hits: 3427293
e111 r193: GigabitEthernet3/0/0 VLAN 65535
The number of EACL hits: 8443947
e111 r111: GigabitEthernet3/0/0 VLAN 65535
The number of EACL hits: 121987474
e111 r110: GigabitEthernet3/0/0 VLAN 65535
The number of EACL hits: 1121935812
5. 查7号表
[121-diag]disp table 3 7 //7号表也是路由表和fib表性质差不多,只是它包含了一些特殊信息。比如板号,端口号等等。

IP=255.255.255.255, prefix=32, Th0=100, Th1=0 Color=0x1
[0] ip=127.0.0.1, hop_action=0x60, tb=0x0, tp=0x0, subindex=0 ,eContext=0
[1] ip=0.0.0.0, hop_action=0x0, tb=0x0, tp=0x0, subindex=0 ,eContext=0
[2] ip=0.0.0.0, hop_action=0x0, tb=0x0, tp=0x0, subindex=0 ,eContext=0

IP=50.1.1.1, prefix=32, Th0=100, Th1=0 Color=0x0
[0] ip=127.0.0.1, hop_action=0x20, tb=0x0, tp=0x0, subindex=0 ,eContext=0
[1] ip=0.0.0.0, hop_action=0x0, tb=0x0, tp=0x0, subindex=0 ,eContext=0
[2] ip=0.0.0.0, hop_action=0x0, tb=0x0, tp=0x0, subindex=0 ,eContext=0

IP=1.1.1.1, prefix=32, Th0=100, Th1=0 Color=0x0
[0] ip=127.0.0.1, hop_action=0x20, tb=0x0, tp=0x0, subindex=0 ,eContext=0
[1] ip=0.0.0.0, hop_action=0x0, tb=0x0, tp=0x0, subindex=0 ,eContext=0
[2] ip=0.0.0.0, hop_action=0x0, tb=0x0, tp=0x0, subindex=0 ,eContext=0

IP=10.164.19.121, prefix=32, Th0=100, Th1=0 Color=0x0
[0] ip=127.0.0.1, hop_action=0x20, tb=0x0, tp=0x0, subindex=0 ,eContext=0
[1] ip=0.0.0.0, hop_action=0x0, tb=0x0, tp=0x0, subindex=0 ,eContext=0
[2] ip=0.0.0.0, hop_action=0x0, tb=0x0, tp=0x0, subindex=0 ,eContext=0

举报本楼

本帖有 14 个回帖,您需要登录后才能浏览 登录 | 注册
您需要登录后才可以回帖 登录 | 注册 |

手机版|C114 ( 沪ICP备12002291号-1 )|联系大家 |网站地图  

GMT+8, 2024-11-25 02:00 , Processed in 0.453166 second(s), 16 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部
XML 地图 | Sitemap 地图