IP首部,ICMP协议,ARP缓存表,路由表,静态/默认路由设置

1.IP首部封装至少50字节
*
版本:版本号ipv4
*
首部长度:
*
优先级与服务类型:确认优先级
*
总长度:整个ip包长度 65535字节
*
标识符:标识作用
*
标志段偏移量:与IP分片有关
*
TTL:生命周期,每经过一个路由TTL-1,为0时丢包(防止路由环路和网络风暴)
*
协议号:上层协议是什么
*
校验和:检测数据是否破损

2.ICMP:Internet control message protocol
*
ping使用ICMP协议,防火墙有时会阻止ICMP协议
*
ICMP是网络层协议(有争议)

3.ARP
*
IP→MAC地址协议,Pc1与Pc2通信,ARP广播得到对应MAC地址
*
ARP缓存表:主机上IP和MAC对应边
*
Pc1初始化 ARP请求→广播FFFFFFFFFFFF→ pc2缓存表记录pc1 IP和MAC地址对应关系→pc2回复pc1→pc1缓存表记录

pc2IP地址和MAC地址对应关系→进行单播
*
ARP攻击:同一广播域中pc机向主机发送虚假应答,主机更新ARP缓存表,继而通信故障
*
ARP欺骗:转发流量,继而对流量进行控制和查看私密信息
*
防御手段:将目标IP和MAC地址手动写入ARP缓存表中

4.静态路由原理与配置
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

* 路由器功能:路径选择(最佳路径而非最短路径)
* 

路由表中有路由条目进行路径选择(路由表中记录网断和接口/下一跳路由对应关系)
*
路由器中两块网卡在不同网段
*
①直连:只需配置网卡信息,配置IP就可以使用

②非直连:手动添加

在这里插入图片描述
5.静态路由的特点

在这里插入图片描述

* 手动配置,单向
* 

缺乏灵活性
*
可以避免路由回环

6.动态/默认路由
*
路由器路由表找不到网络路由条目时,路由器把请求转发到默认路由接口(末梢网络)
*
当目的地址为庞大的地址合集时,可以设置默认路由,再由下一个路由处理。
*
默认路由只可以设置在与pc机连接的路由器

7.三种表的区分
*
ARP缓存表 IP地址⇆MAC地址 终端设备
*
MAC地址表 MAC地址⇆接口 交换机
*
路由表 目标网断⇆接口/下一跳 路由器/pc机

8.静态路由和默认路由配置

在这里插入图片描述
9.静态/默认路由配置案例

在这里插入图片描述
R1,R3(末梢网络)使用默认路由,R2使用静态路由
配置静态,默认前先配置主机和路由网卡的IP/网关和MAC地址。

  1. R1

Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R1
R1(config)#int f0/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no sh
R1(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
R1(config-if)#int f0/1
R1(config-if)#ip add 10.0.0.1 255.0.0.0
R1(config-if)#no sh
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
R1(config-if)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0 10.0.0.254
R1(config)#

2.R2
Router>en
Router#host R2
^
% Invalid input detected at ‘^’ marker.

Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R2
R2(config)#int f0/0
R2(config-if)#ip add 10.0.0.254 255.0.0.0
R2(config-if)#no sh
R2(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
R2(config-if)#int f0/1
R2(config-if)#ip add 20.0.0.1 255.0.0.0
R2(config-if)#no sh
R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
R2(config-if)#exit
R2(config)#ip route 192.168.10.0 255.255.255.0 10.0.0.1
R2(config)#ip route 192.168.20.0 255.255.255.0 20.0.0.254
R2(config)#

3.R3

Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R3
R3(config)#int f0/0
R3(config-if)#ip add 20.0.0.254 255.0.0.0
R3(config-if)#no sh
R3(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
R3(config-if)#int f0/1
R3(config-if)#ip add 192.168.20.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R3(config-if)#ip route 0.0.0.0 0.0.0.0 20.0.0.1
R3(config)#

猜你喜欢

转载自blog.csdn.net/qq_39109226/article/details/109093277