PPP协议

本文详细介绍了网络类型的划分,特别是点对点网络(P2P)与非广播型多点接入(NBMA),强调了MAC地址的作用。PPP协议在点对点网络中的重要性,包括其封装、链路控制(LCP)、认证(如PAP和CHAP)以及IPCP协商等内容,并提供了配置示例。

网络类型:根据二层(数据链路层)来区分不同协议

①MA:多点接入网络        

        BMA--广播型多点接入网络---以太网PPP
        NBMA---非广播型多点接入网络

②P2P:(Point To Point)在一个二层网络中只能包含两台设备,这样的网络称为点到点网络。

        NBMA:不支持广播,需要帧中继,转发效率低,不具备内部广播和多点传送能力,在NBMA拓扑结构中的OSPF运行NBMA网络是指那些能够支持多台(两台以上)路由器但不具有广播能力的网络(以太网常见的二层网络)。

        //以太网协议---MAC地址:区分和标识不同的设备
        //以太网中独有的一种地址----MAC地址         

串线

点到点不能用网线,点到点(串线网络)

例子:台式:主机与显示屏串线连接。

serial:(连接设备用)串口、串线 最早是2根铜丝,64kbps,

               起初数据少,刚发展,数据传输要求没有这么高。

        2个标准串线:① T1-北美1.544Mbps  ② E-欧洲 2.048Mbps

       :如何增加传输效率?①增加带宽 ②加铜丝。

          串口照片:

           

          串线图片:


支持以太网的传输介质:

  • 同轴电缆:支持以太网封装格式,结构复杂工序难成本高,国外早发展可能一些地方还     是有普及,由内部的导体、绝缘层、屏蔽层和外部护套组成。同轴电缆的特点是信号传输稳定,抗干扰能力强,适用于长距离传输。同轴电缆可分为基带同轴电缆和宽带同轴电缆两种类型。
  • 网线:RK-45双绞线8根铜丝、RJ-11电话线  
  • 光纤
浅谈同轴电缆

                   8根铜丝4根传输数据,剩下4根供电,双绞线把两根绝缘的铜导线按一定密度互相绞在                    一起,每一根导线在传输中辐射出来的电波会被另一根线上发出的电波抵消,有效降                       低信号干扰的程度。


创建一个点到点的网络

//这时候我们应该选择串线Serial,

//我们不能选择Copper,这其实就是网线,它所遵循的协议或二层的封装模式是遵循以太网协议的,所以在点到点网络中我们不能使用这类网线

//我们选择接口也要注意AS接口


换频

换频—接收不同频率的波--------频分技术(频分复用的基本思想是:要传送的信号带宽是有限的,而线路可使用的带宽则远远大于要传送的信号带宽,通过对多路信号采用不同频率进行调制的方法,使调制后的各路信号在频率位置上错开,以达到多路信号同时在一个信道内传输的目的。因此,频分复用的各路信号是在时间上重叠而在频谱上不重叠的信号。


HDLC

---高级链路控制协议:兼容性很差

是一种面向比特的数据链路层协议,用于在网络节点之间同步传输数据。它支持点到点和多点结构,可以在半双工和全双工传输中工作。

标准的HDLC协议--ISO:

非标的HDLC---各大厂商根据自身的产品,对标准的HDLC进行改进和升级。

//思科默认二层点到点网络使用的封装协议:HDLC

//华为默认二层点到点网络使用的封装协议:PPP

[Huawei-Serial4/0/0]link-protocol hdlc -----修改接口二层封装协议

HDLC控制物理层


笔记   unicast单播;  OX16进制 ;  

PPP

PPP是点对点协议(Point-to-Point Protocol),①兼容性强,是一种数据链路层协议,用于在两个网络节点之间建立连接。PPP协议是点对点访问应用最多的协议,其实是一个协议族,包含多个协议(LCP,NCP等)。PPP协议的帧格式包括标志字段、地址字段和控制字段、协议字段、有效数据部分、帧检验序列FCS字段等。PPP协议支持多种网络层协议,比如IP协议,Xerox协议等,每一种网络层协议在发送数据报之前,都需要对应的网络控制协议为其配置相关信息。其中,IPCP协议用于为IP数据报配置网络信息

凡是接口或是链路,支持全双工的工作模式,就可以运行ppp协议。

单工:A-->C

半双工:A-->C ,C-->A, A到C后,才轮到C给A发信息

全双工:同一时间内A与C互发;

  • PPP协议具有很强的可移植性。(PPPOE是以太网上的点对点协议,PPPOE采用客户端-服务器(C/S)方式,将点对点协议(PPP)封装在以太网框架上的一种网络隧道技术,在以太网上提供点对点的连接。可以使以太网中的多台主机连接到远端的宽带接入服务器。
  • 可以支持授权与认证(计费系统)

~PPP协议与TCP协议相似,在数据转发之前建立PPP会话分为以下几个阶段

     0、协议检测,检测两点设备的端口是否都支持ppp协议

  1. 链路协议建立阶段------LCP(Link Control)链路控制协议,LCP是PPP协议的子协议,完成会话建立。(一次性建立会话)
  2. 认证阶段(可选阶段)主要目的是鉴别发送方的身份,根据鉴别报文的ID和口令等身份信息,接收方来决定是否要和发送方通信。如果发送方身份被接收方认可,就进入联网阶段,否则直接进入终止阶段。常用的鉴别协议是PAP协议和CHAP协议。

     3、网络层协商阶段,NCP是多协议集合体(网络控制协议)

标志(flag):首部的第一个字段和尾部的最后一个字段都是标志字段F(flag),规定的值用十六进制表示为:0x7E = 01111110。标志字段是PPP帧的定界符。相当于前导符,截取数据帧,01111110,固定值,数据帧的开始或者结束。

字节填充(byte stuffing):当PPP使用异步传输时,如果信息字段出现了和标志字段一样的字节(0x7E),就需要进行字节填充,核心思路是通过在该字节前面填充转义字符。

Fcs:校验数据完整性。帧检验序列(Frame Check Sequence, FCS):FCS字段是用于差错检测的,让接收方可以知晓收到的帧是否出了差错。它只能检错,不能纠错。PPP的差错检测使用的是循环冗余校验CRC算法。

Protocol:标注上层所用协议类型, 类型:标识上层所用协议,用来解封装;。


//## Ping:IP协议 会话建立=>参数协商  认证方式  检查链路两端使用的二层协议

1.链路建立阶段---LCP协议
MRU----在点到点网络中规定最大的二层数据量
MTU---规定数据来到链路层数据部分最大携带的数据量
        //协商参数:

         MRU---MTU规定数据部分来到数据链路部分最大携带数据量。MTU是以太网数据链路层概念,默认是1500,当在PPPOE环境的时候,是1492和1480。MRU是PPP链路数据链路层的概念,是点到点网络中规定的最大的二层数据量。

        认证:是否认证,以及如果认证使用何种认证方式(PAP/chap)--双向的过程

        第一次发送的Configure-Request报文会携带两个参数

        ① MRU   ②是否认证

        回的是ACK还是NAK看MRU是否符合要求

        这是一个双向过程

2.认证阶段--(可选阶段)----既可以做单向的认证,也可以做双向的认证---aaa
 PAP认证:

1、认证方检验认证方发来的参数 用户名与密码,以明文方式发送。

CHAP认证--比对摘要值的方式进行认证,更加安全

  • 用户名与随机数c
  • 第二个数据包发出去前,认证方在寻找相关用户与密码,用hash运算
  • 认证方将对面的hash值与本地的hash值对比

       HASH---将任意长度的数据转换为一个定长的输出        

  1. 相同输入,相同输出  2.不可逆性  3.雪崩效应
3、网络层协商阶段

IPCP协商:双向的过程    1.IP报文的压缩格式 2.IP地址

这个过程相当于授权认证的过程。

下面这个情况是不知道对方地址

                当点到点网络链路配置IP地址后,路由器会自动生成一条主机路由/32


PPP协议的配置

主机获取IP地址

[Huawei-Serial4/0/0]ip address ppp-negotiate ---获取方

[Huawei-Serial4/0/0]remote address 1.1.1.1 —下发地址方

PAP认证配置

认证方:

[Huawei-aaa]local-user huazhu password cipher 123456

[Huawei-aaa]local-user huazhu service-type ppp

[Huawei-Serial4/0/0]ppp authentication-mode pap

被认证方:

[Huawei-Serial4/0/0]ppp pap local-user huazhu password cipher 123456 PPP的认证是一次性会话

 CHAP认证配置

认证方:

[Huawei-aaa]local-user huazhu password cipher 123456

[Huawei-aaa]local-user huazhu service-type ppp

[Huawei-Serial4/0/0]ppp authentication-mode chap

被认证方:

 [Huawei-Serial4/0/0]ppp chap password

 [Huawei-Serial4/0/0]ppp chap user

The device is running!

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys isp
[isp]inter Serial 4/0/0 
[isp-Serial4/0/0]ip address 12.0.0.1 24	
[isp-Serial4/0/0]remote address 1.1.1.1
[isp-Serial4/0/0]q	
[isp]inter Serial 4/0/1
[isp-Serial4/0/1]ip address 13.0.0.1 24
[isp-Serial4/0/1]remote address 2.2.2.2
[isp-Serial4/0/1]q
[isp]
Nov  1 2023 18:52:45-08:00 isp %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PP
P IPCP on the interface Serial4/0/0 has entered the UP state. 
[isp]
Nov  1 2023 18:54:12-08:00 isp %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PP
P IPCP on the interface Serial4/0/1 has entered the UP state. 
[isp]aaa
[isp-aaa]local-user huazhu password cipher 123456
Info: Add a new user.
[isp-aaa]local-user huazhu service-type ppp	
[isp]inter Serial 4/0/0
[isp-Serial4/0/0]ppp a	
[isp-Serial4/0/0]ppp authentication-mode pap
[isp-Serial4/0/0]q
[isp]inter Serial 4/0/1
[isp-Serial4/0/1]ppp a	
[isp-Serial4/0/1]ppp authentication-mode chap
[isp-Serial4/0/1]q
[isp]

  Please check whether system data has been changed, and save data in time

  Configuration console time out, please press any key to log on

<isp>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated
<isp>

  Please check whether system data has been changed, and save data in time

  Configuration console time out, please press any key to log on

<isp>sys
Enter system view, return user view with Ctrl+Z.
[isp]link	
[isp]int s	
[isp]int Serial 4/0/0
[isp-Serial4/0/0]lnk-p	
[isp-Serial4/0/0]link	
[isp-Serial4/0/0]link-protocol ppp
[isp-Serial4/0/0]q
<isp>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated
<isp>sys
Enter system view, return user view with Ctrl+Z.
[isp]int s 	
[isp]int Serial 4/0/1
[isp-Serial4/0/1]link-protocol ppp
[isp-Serial4/0/1]q
[isp]q
<isp>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated
<isp>

  Please check whether system data has been changed, and save data in time

  Configuration console time out, please press any key to log on

这是R2

The device is running!

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r2
[r2]ip ad	
[r2]inter s	
[r2]inter Serial 4/0/0
[r2-Serial4/0/0]ip address ppp-negotiate 
[r2-Serial4/0/0]
Nov  1 2023 18:52:45-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
 IPCP on the interface Serial4/0/0 has entered the UP state. 
[r2-Serial4/0/0]

  Please check whether system data has been changed, and save data in time

  Configuration console time out, please press any key to log on

<r2>sys
Enter system view, return user view with Ctrl+Z.
[r2]inter s	
[r2]inter Serial 4/0/0
[r2-Serial4/0/0]disp	
[r2-Serial4/0/0]display ip in	
[r2-Serial4/0/0]display ip interface b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 2
The number of interface that is DOWN in Physical is 4
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 4

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              unassigned           down       down      
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       1.1.1.1/32           up         up        
Serial4/0/1                       unassigned           down       down      
[r2-Serial4/0/0]ppp pap local-user huazhu password cipher 123456
[r2-Serial4/0/0]q

[r2]q
<r2>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated
<r2>

  Please check whether system data has been changed, and save data in time

  Configuration console time out, please press any key to log on

这是R3

The device is running!

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r3
[r3]inte s	
[r3]inte Serial 4/0/1
[r3-Serial4/0/1]ip address ppp-negotiate 
[r3-Serial4/0/1]
Nov  1 2023 18:54:12-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
 IPCP on the interface Serial4/0/1 has entered the UP state. 	

[r3-Serial4/0/1]display ip interface b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 2
The number of interface that is DOWN in Physical is 4
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 4

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              unassigned           down       down      
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       unassigned           down       down      
Serial4/0/1                       2.2.2.2/32           up         up        
[r3-Serial4/0/1]
[r3-Serial4/0/1]ping 13.0.0.1
  PING 13.0.0.1: 56  data bytes, press CTRL_C to break
    Reply from 13.0.0.1: bytes=56 Sequence=1 ttl=255 time=40 ms
    Reply from 13.0.0.1: bytes=56 Sequence=2 ttl=255 time=40 ms
    Reply from 13.0.0.1: bytes=56 Sequence=3 ttl=255 time=30 ms
    Reply from 13.0.0.1: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 13.0.0.1: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 13.0.0.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/34/40 ms

[r3-Serial4/0/1]

  Please check whether system data has been changed, and save data in time

  Configuration console time out, please press any key to log on

<r3>sys
Enter system view, return user view with Ctrl+Z.
[r3]int s	
[r3]int Serial 4/0/1
[r3-Serial4/0/1]ppp ?
  authentication-mode  Specify PPP authentication-mode
  chap                 Specify CHAP parameters 
  ipcp                 Specify IPCP parameters
  mp                   Multilink PPP
  pap                  Specify PAP parameters
  timer                Specify timer 
[r3-Serial4/0/1]ppp chap l	
[r3-Serial4/0/1]ppp chap 
                         ^
Error:Incomplete command found at '^' position.
[r3-Serial4/0/1]ppp chap lo	
[r3-Serial4/0/1]ppp chap pass	
[r3-Serial4/0/1]ppp chap password 123456
                                  ^
Error: Unrecognized command found at '^' position.
[r3-Serial4/0/1]ppp sh	
[r3-Serial4/0/1]ppp cha	
[r3-Serial4/0/1]ppp chap u	
[r3-Serial4/0/1]ppp chap user huazhu
[r3-Serial4/0/1]
<r3>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated
<r3>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值