赞
踩
1、路由器的工作原理:路由器接收数据包,提取目标IP地址及子网掩码计算目标网络地址;根据目标网络地址查找路由表,若找到目标网络地址,按照相应的出口发送到下一个路由器;若未找到,观察是否有默认路由,按照默认路由的出口发送给下一个路由器,若未找到给源IP,发送出错ICMP数据包表明无法传递该数据包;若为直连路由就按照第二层MAC地址发送给目标站点。
2、路由器的工作特点:连接多个网络或网段的网络设备,将不同网络或网段之间的数据信息进行翻译,可相互读懂对方的数据。
1.由管理员手工配置的,是单向的
2.缺乏灵活性
当路由器在路由表中找不到目标网络的路由条月时,路由器把请求转发到默认路由接口
1.主机1项主机2发送数据,主机1在网络层将来自上层的报文封装成IP数据包,其首部包含源地址和目的地址。主机1会用本地配置的24位掩码和目的地址进行”与“运算,得出目的地址和本机地址不在同一频段,因此发往主机2的数据包需要经过网关路由器A转发。
2.主机1通过ARP请求获得默认网关路由器A的E0接口MAC地址。在数据链路层主机1将IP数据包封装成以太网数据帧,那以太网帧首部的源MAC地址就是主机1的MAC地址,目的地址的MAC地址就变成了网关E0接口的MAC地址。
3.路由器A从E0接口接收到数据帧,把数据链路层的封装去掉。路由器A认为IP数据包要通过自己进行路由转发,所以路由器A会查找自己的路由表,寻找于目标IP地址相匹配的路由表项,然后根据路由表的下一跳地址将数据包转发到E1接口。
4.E1接口路由器A重新封装以太网帧,此时源MAC地址就变成了路由器A的E1接口的MAC地址,目的地址为与之相连的路由器B的E1接口的MAC地址。
5. 路由器B从E1接口收到数据帧,同样会把数据链路层的封装去掉,对目的IP地址进行检查,并与路由表进行匹配,然后根据路由表的下一跳信息将数据包转发到E0接口。路由器B发现目的网段与自己的E0接口直接相连,通过ARP广播路由器B获得了主机2以太口的MAC地址。
6. 6.路由器B再把IP数据包封装成以太网帧,这时源MAC地址就是路由器B接口E0的MAV地址,目的MAC地址就是主机2的MAC地址,然后发过去。
R8
<Huawei>sys <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]sys [Huawei]sysname R8 [R8]inter [R8]interface g0/0/1 [R8-GigabitEthernet0/0/1]ip add [R8-GigabitEthernet0/0/1]ip address 192.168.20.2 24 Apr 6 2021 16:47:43-08:00 R8 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. [R8-GigabitEthernet0/0/1]q [R8]interface g0/0/0 [R8-GigabitEthernet0/0/0]ip address 192.168.40.1 24 Apr 6 2021 16:48:02-08:00 R8 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. [R8-GigabitEthernet0/0/0]q [R8]ip rout [R8]ip route-s [R8]ip route-static 192.168.10.0 24 192.168.40.2 [R8]ip route-static 192.168.30.0 24 192.168.40.2
R10
<Huawei>sys <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]sys [Huawei]sysname R10 [R10]inter [R10]interface ^ Error:Incomplete command found at '^' position. [R10]interface g0/0/0 [R10-GigabitEthernet0/0/0]ip add [R10-GigabitEthernet0/0/0]ip address 192.168.40.2 24 Apr 6 2021 16:48:51-08:00 R10 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. [R10-GigabitEthernet0/0/0]q [R10]inter [R10]interface g0/0/1 [R10-GigabitEthernet0/0/1]ip add [R10-GigabitEthernet0/0/1]ip address 192.168.10.2 24 Apr 6 2021 16:49:29-08:00 R10 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. [R10-GigabitEthernet0/0/1]q [R10]ip rout [R10]ip route-s [R10]ip route-static 192.168.20.0 24 192.168.40.1 [R10]inter [R10]interface g0/0/2 [R10-GigabitEthernet0/0/2]ip add [R10-GigabitEthernet0/0/2]ip address 192.168.50.2 24 Apr 6 2021 16:52:28-08:00 R10 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP on the interface GigabitEthernet0/0/2 has entered the UP state. [R10-GigabitEthernet0/0/2] Please check whether system data has been changed, and save data in time Configuration console time out, please press any key to log on <R10> <R10>sys <R10>system-view Enter system view, return user view with Ctrl+Z. [R10]ip rou [R10]ip route-s [R10]ip route-static 192.168.30.0 24 192.168.50.1
R9
<Huawei>sys <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]sys R9 [R9]inter [R9]interface g0/0/0 [R9-GigabitEthernet0/0/0]ip add [R9-GigabitEthernet0/0/0]ip address 192.168.50.1 24 Apr 6 2021 16:54:28-08:00 R9 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. [R9-GigabitEthernet0/0/0]q [R9]inter [R9]interface g0/0/1 [R9-GigabitEthernet0/0/1]ip add [R9-GigabitEthernet0/0/1]ip address 192.168.30.2 24 [R9-GigabitEthernet0/0/1] Apr 6 2021 16:57:22-08:00 R9 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. [R9-GigabitEthernet0/0/1]q [R9]ip [R9]ip tpu [R9]ip rou [R9]ip route-static 192.168.10.0 24 192.168.50.2 [R9]ip route-static 192.168.20.0 24 192.168.50.2 [R9] [R9]ip route-static 192.168.20.0 24 192.168.50.2
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。