#
interface Pos4/0/0
 link-protocol ppp
#
return
[Huawei-Pos4/0/0]

原理

ppp点到点,的协议,常见的广域网链路层协议,安全认证,pap密码验证协议 ,chap 挑战握手协议,

ppp协议提供了,LCP 链路控制协议,用于链路层参数的协商。例如最大接收单元,认证模式。有良好的扩展性,需要在以太网链路承载ppp协议时,可以扩展为pppoe

ppp协议各种ncp 网络控制协议,入Ipcp ip 控制协议,用于各网络层参数的协商,更好的支持网络层协议。

链路层协商,

认证协商,链路建立协商的阶段认证,

网络层协商,ncp 来协商,

magic 用于防环,

不匹配的话

接收的报文拆解

还有不识别的情况,

ppp 认证模式,pap chap

pap 认证有两次握手,协商报文以明文形式在链路上传输,

chap 认证,安全,一般都是这个方法,

配置ppp

在AR1 上操作

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]in	
[Huawei]int 4/0/0
            ^
Error: Wrong parameter found at '^' position.
[Huawei]int p     	
[Huawei]int Pos 4/0/0
[Huawei-Pos4/0/0]dis this
[V200R003C00]
#
interface Pos4/0/0
 link-protocol ppp
#
return
[Huawei-Pos4/0/0]ip add 10.0.12.1 24
[Huawei-Pos4/0/0]
Jul 28 2026 22:47:17-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
 PPP IPCP on the interface Pos4/0/0 has entered the UP state. 
[Huawei-Pos4/0/0]q
[Huawei]sysnam	
[Huawei]sysname AR1
[AR1]

在AR2 上操作

[Huawei]int p	
[Huawei]int Pos 4/0/0
[Huawei-Pos4/0/0]ip add 10.0.12.2 24
[Huawei-Pos4/0/0]
Jul 28 2026 22:47:18-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
 PPP IPCP on the interface Pos4/0/0 has entered the UP state. 
[Huawei-Pos4/0/0]q
[Huawei]sysn	
[Huawei]sysname AR2

运营商创建

[AR1-aaa]local-user  huawei password cipher huaweiya
AR1-aaa]local-user  huawei pa	
[AR1-aaa]local-user  huawei password c	
[AR1-aaa]local-user  huawei password cipher huaweiya
Info: Add a new user.
[AR1-aaa]dis this
[V200R003C00]
#
aaa 
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default 
 domain default_admin 
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
 local-user huawei password cipher %$%$>^Ef(3Jx3PQ:W9,`y]d;nSxB%$%$
#
[AR1-aaa]local-user huawei service-type ?   给谁创建的,下面是几种类型,
  8021x     802.1x user
  bind      Bind authentication user
  ftp       FTP user
  http      Http user
  ppp       PPP user
  ssh       SSH user
  sslvpn    Sslvpn user
  telnet    Telnet  user
  terminal  Terminal user
  web       Web authentication user
  x25-pad   X25-pad user
[AR1-aaa]local-user huawei service-type ppp

选择认证模式

进入接口,

AR1-aaa]q
[AR1]int po	
[AR1]int Pos 4/0/0
[AR1-Pos4/0/0]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 
[AR1-Pos4/0/0]ppp 
[AR1-Pos4/0/0]ppp a	
[AR1-Pos4/0/0]ppp authentication-mode ?
  chap  Enable CHAP authentication
  pap   Enable PAP authentication
[AR1-Pos4/0/0]ppp authentication-mode pa	
[AR1-Pos4/0/0]ppp authentication-mode pap 
[AR1-Pos4/0/0]dis this
[V200R003C00]
#
interface Pos4/0/0
 link-protocol ppp
 ppp authentication-mode pap 
 ip address 10.0.12.1 255.255.255.0 
#
return

认证方

[AR2-Pos4/0/0]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 
[AR2-Pos4/0/0]ppp p	
[AR2-Pos4/0/0]ppp pap ?
  local-user  Specify user name 
[AR2-Pos4/0/0]ppp pap l	
[AR2-Pos4/0/0]ppp pap local-user ?
  STRING<1-64>  User name 
[AR2-Pos4/0/0]ppp pap local-user huawei password huaweiya?
                                                 ^
Error: Unrecognized command found at '^' position.
[AR2-Pos4/0/0]ppp pap local-user huawei password huaweiya ?
                                                 ^
Error: Unrecognized command found at '^' position.
[AR2-Pos4/0/0]ppp pap lo	
[AR2-Pos4/0/0]ppp pap local-user huawei pa	
[AR2-Pos4/0/0]ppp pap local-user huawei password ?
  cipher  Display the current password with cipher text 
  simple  Display the current password with plain text 
[AR2-Pos4/0/0]ppp pap local-user huawei password c	
[AR2-Pos4/0/0]ppp pap local-user huawei password cipher huaweiya

chap

需要三次握手,

运营商,认证方,设置用户,认证方式,chap

[AR1-aaa]local-user  huawei pa	
[AR1-aaa]local-user  huawei password c	
[AR1-aaa]local-user  huawei password cipher huaweiya
[AR1-aaa]local-user huawei service-type ppp


以上不用操作,因为前面已经操作过了,如果是新的实验环境,或者实际操作,需要配置,


[AR1-Pos4/0/0]ppp a	
[AR1-Pos4/0/0]ppp authentication-mode ?
  chap  Enable CHAP authentication
  pap   Enable PAP authentication
[AR1-Pos4/0/0]ppp authentication-mode ch	
[AR1-Pos4/0/0]ppp authentication-mode chap 
[AR1-Pos4/0/0]

家庭宽带被认证方

也就是AR2

[AR2]int p	
[AR2]int Pos 4/0/0
[AR2-Pos4/0/0]ppp c	
[AR2-Pos4/0/0]ppp chap lo	
[AR2-Pos4/0/0]ppp chap lo
[AR2-Pos4/0/0]ppp chap l	
[AR2-Pos4/0/0]ppp chap l
[AR2-Pos4/0/0]ppp chap 	
[AR2-Pos4/0/0]ppp chap u	
[AR2-Pos4/0/0]ppp chap user huawei 
[AR2-Pos4/0/0]ppp ch	
[AR2-Pos4/0/0]ppp chap pa	
[AR2-Pos4/0/0]ppp chap password huaweiya
                                ^
Error: Unrecognized command found at '^' position.
[AR2-Pos4/0/0]ppp chap password ?
  cipher  Display the current password with cipher text 
  simple  Display the current password with plain text 
[AR2-Pos4/0/0]ppp chap password ci	
[AR2-Pos4/0/0]ppp chap password cipher huaweiya
[AR2-Pos4/0/0]

去除操作,pap认证方式

[AR2-Pos4/0/0]undo ppp o

[AR2-Pos4/0/0]undo ppp p

[AR2-Pos4/0/0]undo ppp pap l

[AR2-Pos4/0/0]undo ppp pap local-user

[AR2-Pos4/0/0]dis this

[V200R003C00]

#

interface Pos4/0/0

link-protocol ppp

ppp chap user huawei

ppp chap password cipher %$%$;t=.RFSr:*WsPDBqdO4:,%Z:%$%$

ip address 10.0.12.2 255.255.255.0

#

return

[AR2-Pos4/0/0]

最后会进行网络协商, NCP 协商配置ip

第一步的时候,会把人r1的ip 加入ip路由,

有动态协商,

1.创建地址池

第一步创建地址池 ip pool pppoe

[AR1]ip pool pppoe 
Info: It's successful to create an IP address pool.
[AR1-ip-pool-pppoe]ne	
[AR1-ip-pool-pppoe]netw	
[AR1-ip-pool-pppoe]network 10.1.1.0 ma	
[AR1-ip-pool-pppoe]network 10.1.1.0 mask 24
[AR1-ip-pool-pppoe]q

然后调用, pppoe 是创建时的名称

remote address 调用,

[AR1]int Pos 4/0/0
[AR1-Pos4/0/0]re	
[AR1-Pos4/0/0]remote-	
[AR1-Pos4/0/0]remote-a	
[AR1-Pos4/0/0]remote-ad	
[AR1-Pos4/0/0]remote ad	
[AR1-Pos4/0/0]remote address po	
[AR1-Pos4/0/0]remote address pool pppoe

接收ip

AR2>sys
Enter system view, return user view with Ctrl+Z.
[AR2]int p	
[AR2]int Pos  4/0/0
[AR2-Pos4/0/0]ip ad	
[AR2-Pos4/0/0]ip address ?
  IP_ADDR<X.X.X.X>  IP address
  ppp-negotiate     Negotiated IP address with the remote
  unnumbered        Share an address with another interface
[AR2-Pos4/0/0]ip address 

[AR2-Pos4/0/0]ip address ppp-negotiate 
Jul 28 2026 23:41:40-08:00 AR2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PP
P IPCP on the interface Pos4/0/0 has entered the DOWN state. 
[AR2-Pos4/0/0]di
Jul 28 2026 23:41:46-08:00 AR2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PP
P IPCP on the interface Pos4/0/0 has entered the UP state.
[AR2-Pos4/0/0]d
[AR2-Pos4/0/0]
[AR2-Pos4/0/0]
[AR2-Pos4/0/0]dis ip in	
[AR2-Pos4/0/0]dis ip int b	
[AR2-Pos4/0/0]dis ip int br	
[AR2-Pos4/0/0]dis ip int brief
*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 3
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 3

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)     
Pos4/0/0                          10.1.1.254/32        up         up        
[AR2-Pos4/0/0]

测试看看能不能ping 通,

AR2-Pos4/0/0]ping 10.1.1.1
  PING 10.1.1.1: 56  data bytes, press CTRL_C to break
    Request time out
    Request time out
    Request time out
    Request time out
    Request time out

  --- 10.1.1.1 ping statistics ---
    5 packet(s) transmitted
    0 packet(s) received
    100.00% packet loss

[AR2-Pos4/0/0]
Jul 28 2026 23:44:43-08:00 AR2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol PP
P IPCP on the interface Pos4/0/0 has entered the DOWN state. 
[AR2-Pos4/0/0]
Jul 28 2026 23:45:33-08:00 AR2 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol PP
P IPCP on the interface Pos4/0/0 has entered the UP state. 
[AR2-Pos4/0/0]ping 10.1.1.1
  PING 10.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=60 ms
    Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms

  --- 10.1.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/28/60 ms

没有修改来ip

AR1-Pos4/0/0]dis this
[V200R003C00]
#
interface Pos4/0/0
 link-protocol ppp
 ppp authentication-mode chap 
 remote address pool pppoe
 ip address 10.0.12.1 255.255.255.0 
#
return
[AR1-Pos4/0/0]undo ip address 10.0.12.1 24
Jul 28 2026 23:44:42-08:00 AR1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PP
P IPCP on the interface Pos4/0/0 has entered the DOWN state. 
[AR1-Pos4/0/0]address 10.1.1.1 24
              ^
Error: Unrecognized command found at '^' position.
[AR1-Pos4/0/0]ip address 10.1.1.1 24
[AR1-Pos4/0/0]
Jul 28 2026 23:45:32-08:00 AR1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PP
P IPCP on the interface Pos4/0/0 has entered the UP state. 

pppoe

拨号上网,利用ppp的特性,来运行,

给广域网,承载的,