找回密码
 注册
查看: 1120|回复: 1

华为路由器:PPPOE配置模拟实验及NAT配置

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2022-3-16 09:39:13 | 显示全部楼层 |阅读模式
实验环境6 ^4 t' ~$ [2 A5 Q4 l( z* S
" n8 x/ w& z* W3 N- N+ J. Q. t
pppoe-client上面的接口信息
8 ^5 y( u3 `$ V- B* v( [
0 d. k$ L% y. Q6 ?[AR1]dis ip interface brief
0 p$ E/ {8 n+ Y, L) h*down: administratively down
. ^5 b8 s3 B% E8 }/ L* C^down: standby: }& G3 t! C( E% ^8 t. p: J+ v, @
(l): loopback
0 b  i/ o# ^8 e(s): spoofing
; `9 ~: w! Q: w0 Z6 m  m1 e! LThe number of interface that is UP in Physical is 2
- A) n8 @7 j2 P2 Q$ {The number of interface that is DOWN in Physical is 1
& u7 v/ t3 M" I% \2 @8 KThe number of interface that is UP in Protocol is 1
' I9 v8 w2 v( L1 UThe number of interface that is DOWN in Protocol is 2
- q$ X9 p. D/ {) `1 R3 o% {/ J5 y4 j5 b# V/ h: t
Interface                         IP Address/Mask      Physical   Protocol  
+ n( o2 B, d- Q+ OGigabitEthernet0/0/0              unassigned           up         down      9 _0 u# T% i# d5 [. y% D2 a, ^
GigabitEthernet0/0/1              192.168.1.254/24     down       down      
; P0 d7 n6 ?: T5 rNULL0                             unassigned           up         up(s)     
1 H! B6 Y4 S4 v* P; [* l2 A6 h; z; q! S8 q9 X

: q  ]' g. q! o配置了基于接口的DHCP
8 u" f0 U$ j* J5 Z  j/ c, H# Q! u% l' l+ D( _( g
interface GigabitEthernet0/0/1* M" p/ P! ]; x, S1 ^/ J! M% e( ]
ip address 192.168.1.254 255.255.255.0 5 R+ b9 G; O5 n! v
dhcp select interface3 z$ ^6 ?& ^# i8 ?# C) J, x2 P
dhcp server dns-list 8.8.8.8
3 [: v, ^: I( _ dhcp server domain-name pokes.com# K0 `3 g& k2 W% Z

# p7 [: h, W9 R2 A- T注意事项:AR1、AR2的物理接口g0/0/0不配地址." D& k4 `, B9 ~' |/ D
5 f& A+ _; Q1 N9 v9 a
一、pppoe-server的配置( z- X( J- h3 o7 Z4 _$ H+ h2 K2 @
1、pppoe-server 配置地址池- |# v1 @: j2 I2 K0 T6 C6 t! n
[pppoe-server]ip pool pokes            #创建名为pokes的地址池,名字可以随便起,后面要调用
$ Y1 c3 k5 i/ q1 t& Z. CInfo: It's successful to create an IP address pool., \6 t# p& b0 w% W
[pppoe-server-ip-pool-pokes]network 10.1.12.0 mask 24   #地址池为10.1.12.0/24/ i; m' o! e; z; z
[pppoe-server-ip-pool-pokes]dis th* T8 A9 h& Q& g
[V200R003C00]4 y0 d5 g- E) G+ w4 v8 [$ P7 B- A
#+ D6 B3 p9 P$ O, |5 c
ip pool pokes
9 ]3 Q* S6 m3 E4 T7 n network 10.1.12.0 mask 255.255.255.0 4 e3 X# A  e- q! V: d
#  R9 ?: o* F  r
return$ ^. ?7 W- Y* [8 m' k$ Z
[pppoe-server-ip-pool-pokes]q
' C+ B) e2 ]5 L- L0 |/ H4 V8 k1 O4 U- M# S5 G3 T4 m- X- n
2、配置虚拟口关联地址池9 p/ f) @5 E0 l1 T- b8 S
配置虚拟口关联地址池,即创建Virtual-Template 1模版。
! k+ q5 S9 D3 l3 K/ R/ `# y4 G
) q7 Q8 u, S6 r8 L" a8 f0 F[pppoe-server]interface Virtual-Template 1    #创建虚拟接口1/ k. X. V' u& [* d* a8 n
[pppoe-server-Virtual-Template1]ip add 10.1.12.2 24                   #虚拟接口1的地址
5 k' m' ^/ @3 D1 `) U5 O3 E# \[pppoe-server-Virtual-Template1]ppp authentication-mode chap   #认证类型$ V( u$ d9 r4 }
[pppoe-server-Virtual-Template1]remote address pool pokes      #客户端的地址池pokes
6 s' L+ _8 Y9 y4 }[pppoe-server-Virtual-Template1]dis th
9 {" ^8 v4 i0 ?interface Virtual-Template1! u  F0 z! T2 ?
ppp authentication-mode chap 5 ^1 I# c6 |7 n- ^# E7 B' B
remote address pool pokes
. O& ]2 d, C/ }. u! c  d% B: x ip address 10.1.12.2 255.255.255.0
2 ^9 P8 j( l' i
* p9 p0 N2 h) x# C- G) E[pppoe-server]int g0/0/0        ; K% ?, [- h0 o9 q1 V
[pppoe-server-GigabitEthernet0/0/0]pppoe-server bind virtual-template 1   #将虚拟接口1关联到g0/0/0接口, C2 G' z: M3 y5 c1 ^( ]
[pppoe-server-GigabitEthernet0/0/0]dis th
" Q$ r" ]" h, P- v0 a( B[V200R003C00]- J+ S1 Y$ v, H: L) _  V7 X. T
#
6 ]7 X1 u8 b; _6 T3 xinterface GigabitEthernet0/0/02 }# O  W& b+ F$ E
pppoe-server bind Virtual-Template 1
/ x4 T0 ~% E+ C$ m1 v% V3 a. ?& C#
# x3 b% _% l9 nreturn  g( k% T, `: x* _
[pppoe-server-GigabitEthernet0/0/0]
# V& v: P9 m, `5 W
( }5 d  @) F0 k( H2 @0 B5 j3、创建pppoe拨号的账号
3 L. I- }5 h3 P1 @- o+ H按理我们应该创建pppoe拨号的账号。* s$ z8 Z% H  E9 Z! n) Z' ^
这里为了演示拨号失败,我们这里先不新建账号,后面再新建。$ `+ H7 w- ~* E7 D* e# d" Y" S: [9 k5 s

, n6 K- n/ Y0 N! V3 ?二、pppoe-client的配置
1 Z" m  V1 ?# U3 A8 F6 y# {/ n[pppoe-client]dialer-rule   
6 x. _) G7 A9 g9 d[pppoe-client-dialer-rule]dialer-rule 1 ?5 q# E; w7 X9 F$ n. x6 L" w# j( @/ P5 R
  acl   Permit or deny based on access-list   
! m1 F1 V3 o4 S  ip    Ip
& s& I: S! m% v# m8 I. L$ j  ipv6  Ipv6       
2 g9 M6 z( [9 n" Z2 ~* i& E[pppoe-client-dialer-rule]dialer-rule 1 ip permit   #创建拨号规则,允许ip流量触发拨号
4 w) H4 ]4 r/ W2 w
2 c, Y6 v2 P  ^4 P' t: C3 v6 F[pppoe-client]interface Dialer 16 f( t; l5 ~: c* C; B8 Q+ U
Jul 15 2021 18:55:22-08:00 pppoe-client %%01IFPDT/4/IF_STATE(l)[0]:Interface Dia
( B7 r2 E9 N/ Oler1 has turned into UP state.
1 H5 g* j2 @5 r( @; o7 m" P[pppoe-client-Dialer1]ip add       
* P+ {3 d2 ?) _# j( {; z[pppoe-client-Dialer1]ip address ppp       
( S  f1 S" ~! b4 v[pppoe-client-Dialer1]ip address ppp-negotiate  #地址采用ppp协商
4 Y$ k) X% j. F' ~1 U& w- T- T+ v* M  l! N
[pppoe-client]interface Dialer 1                #创建接口拨号组13 W/ ^7 ]5 [. m4 |6 k) C0 t9 z
[pppoe-client-Dialer1]ip address ppp-negotiate  #ip地址采用ppp协商  C) v. q6 t3 q- A# F/ ^
[pppoe-client-Dialer1]dialer user zhprny        #此用户不用于认证,是标识作用以及和dialer绑定
% ~5 j* f' ?$ S[pppoe-client-Dialer1]dialer bundle 1           #设备通过Dialer bundle将物理接口与拨号接口关联起来。, `  @  v5 {, J
[pppoe-client-Dialer1]dialer-group 1             #放到一个拨号访问组1中
' X1 K/ Z9 x/ p2 k& Z  }5 u4 k[pppoe-client-Dialer1]ppp chap user pokes        #指定dialer1接口的编号,拨号账号) l3 {2 t7 x: c+ F) s1 H1 W0 b# w
[pppoe-client-Dialer1]ppp chap password 123456   #拨号的密码
" i9 C6 Y' F9 C5 M) Y+ u' }9 S/ S2 N. F) p5 ^5 ^/ Z
+ W0 t  K% A# ?/ e
[pppoe-client-Dialer1]dis th2 c% Z% K! b. \% }
[V200R003C00]
! }( m2 @  I3 i5 F* c#3 X8 q# @* i" X" D: i5 N" ?6 @- f
interface Dialer1/ G1 r2 h2 q( n6 e7 s$ `! b) t0 F
link-protocol ppp
% W3 R5 I4 c5 M. W: ^& ~& j9 ^ ppp chap user pokes
, _. N. e$ T7 i' R! w0 Z ppp chap password cipher %$%$I/!'WCyd<7p[~8;,>51L,$sl%$%$
& \; e8 x% R2 h8 m- ~* K ip address ppp-negotiate
2 u7 Z' y3 L$ `/ Z2 h dialer user zhprny
6 P9 Y: v+ q7 J2 {" }- d" B dialer bundle 1; k/ g8 L4 o/ \9 |7 M$ |
dialer-group 1. d% @& M) P) v* ~" i7 u

8 [3 w4 O5 G0 `: T! j! R[pppoe-client-GigabitEthernet0/0/0]
2 l5 N: P% p; O* G! w0 W1 I4 BJul 15 2021 19:07:54-08:00 pppoe-client %%01IFNET/4/LINK_STATE(l)[0]:The line pr
* S8 ~/ q. _, c. x1 b, Rotocol PPP on the interface Dialer1:0 has entered the UP state.  #PPP已进入启动状态5 S6 r7 d6 P5 R" d9 w' ~
[pppoe-client-GigabitEthernet0/0/0]
% w' B3 g* S* {. ^% ~Jul 15 2021 19:07:54-08:00 pppoe-client %%01IFNET/4/LINK_STATE(l)[1]:The line pr
  @. }* n7 C; O' W+ Z0 Wotocol PPP on the interface Dialer1:0 has entered the DOWN state. #PPP已进入关闭状态$ A* N( c3 k( Q5 o' Q1 C( m7 f( b
2 F0 h$ k& b6 ^% U
#不停的循环。。。。( _7 E, T. a1 h  J

* i- n3 m( V& W0 s0 B' _' K' }* }& v$ w/ i
#原因是没有认证成功,因为我们在PPPOE-server上面还没有创建认证用户和密码7 P- e6 _5 B2 a8 a3 i

7 _9 G" s4 J2 e. J三、pppoe服务器上新建认证用户
8 c. q9 P3 A# L1 S+ q% V* ~8 D  O我们到服务器上直接新建认证用户:: O9 Y+ |4 a% z4 I  J

1 w! z# m8 l% |- M7 n[pppoe-server]aaa
: h3 U6 n6 U) f5 k$ c6 a- C) ~[pppoe-server-aaa]local-user pokes password cipher 123456; a, R# {2 l) ?. v5 `& n
Info: Add a new user.( j- F0 U) s' u
[pppoe-server-aaa]local-user pokes service-type ppp    #类型为ppp
; q# B+ w2 E' C# g/ D- _- o  q+ r
' u+ y3 ^7 r+ b. N( e/ ]
8 B7 Y; S5 i+ ^% J: f' o. \四、客户端验证结果
" M( P+ q- N% i8 h' G7 ]; h1、认证成功信息( h5 s% G* p! N, w
然后客户端就会出现认证成功的提示:. ~' f& E6 Z2 J; c4 q

& L7 `" E% `, {3 i) @; a[pppoe-client-GigabitEthernet0/0/0]6 k4 U, h; M4 D; @& z: a/ y6 \
Jul 15 2021 19:09:23-08:00 pppoe-client %%01IFNET/4/LINK_STATE(l)[10]:The line p6 \; d) l$ _: z! w) o* t
rotocol PPP on the interface Dialer1:0 has entered the UP state.
  @+ o! K( y7 y, @. |[pppoe-client-GigabitEthernet0/0/0]
+ q4 ~! c% r7 SJul 15 2021 19:09:23-08:00 pppoe-client %%01IFNET/4/LINK_STATE(l)[11]:The line p
' U0 L& y7 m  w$ Krotocol PPP IPCP on the interface Dialer1:0 has entered the UP state.
2 y8 b/ S* v  J2 k2 y[pppoe-client-GigabitEthernet0/0/0]q/ ~) ^6 W$ m4 X, l8 l9 V
[pppoe-client]dis ip in b0 U4 Y$ [; t! S' K" z1 O
*down: administratively down$ S+ Y8 h( J  e& |
^down: standby
* w# ^$ A' i- B" O* Y5 ](l): loopback
  S3 {! N# X8 y" ~% L7 Q* Q(s): spoofing
. a6 G$ `4 k' U$ _& AThe number of interface that is UP in Physical is 4
( O  _4 W# \& a! s/ }The number of interface that is DOWN in Physical is 0
0 }/ r" q& z* K% t, R- q! w* i4 ?The number of interface that is UP in Protocol is 3
! p% M. h# e/ G* }' {3 wThe number of interface that is DOWN in Protocol is 17 N" x- f4 f- j. G4 ]
; g/ J2 ?3 |1 r( s; Z
Interface                         IP Address/Mask      Physical   Protocol  2 e" i! w* }+ c) U$ ~
Dialer1                           10.1.12.254/32       up         up(s)     #拿到了PPPOE服务器上的地址, D' ]7 D7 ^" b/ r
GigabitEthernet0/0/0              unassigned           up         down      / g0 ?+ r% I; k, u7 @
GigabitEthernet0/0/1              192.168.1.254/24     up         up        ) H% p  v9 W# {
NULL0                             unassigned           up         up(s)
% w9 U4 g% w3 N% ?# e! ~+ f, X% o- v* c4 y& d6 }6 t
6 R  q1 q$ s3 N6 e, A; l/ b( c
2、pppoe-server 信息
4 L: M: [" [! Q& _1 S& y# [<pppoe-server>dis interface Virtual-Template 1! Z; f+ f, i. `
Virtual-Template1 current state : UP
2 ^/ e/ `0 V* a1 l( @Line protocol current state : UP
9 f1 E' B' {0 @1 h; f- XLast line protocol up time : 2021-07-15 19:09:22 UTC-08:00
/ @+ [# M1 [0 V& ^Description:HUAWEI, AR Series, Virtual-Template1 Interface
/ Q  w; n' |8 jRoute Port,The Maximum Transmit Unit is 1492, Hold timer is 10(sec)
/ |( x+ X9 s" P: ?. qInternet Address is 10.1.12.2/248 @/ e6 b; A/ {( s; n( m) u
Link layer protocol is PPP
# |2 M0 \& }( L( S& f  ]. G8 ZLCP initial6 X' V' r- _; A4 E$ \1 D, I
Physical is None7 V" Z5 u/ |1 g& N8 g
Current system time: 2021-07-15 20:27:28-08:00
0 `4 k( Y: p; F+ v4 ^- v8 ]    Last 300 seconds input rate 0 bits/sec, 0 packets/sec
% b8 |( y. y- N    Last 300 seconds output rate 0 bits/sec, 0 packets/sec( ?0 m2 _! r+ s) t! v9 A+ s
    Realtime 0 seconds input rate 0 bits/sec, 0 packets/sec) }5 z8 e. M! ]5 {- k1 N! |
    Realtime 0 seconds output rate 0 bits/sec, 0 packets/sec$ G  I4 ^; g& \
    Input: 0 bytes! G& @& E8 S6 n& [" L, u4 O0 b2 [
    Output:0 bytes3 {& y$ v5 e' E0 K
    Input bandwidth utilization  :    0%
: s9 [, C, ]) x. D- ^    Output bandwidth utilization :    0%
# p2 z, |/ t5 n$ B( h* s. y7 @, h$ Q- y
<pppoe-server>8 t" V4 d6 y! T5 E; W
3 s' ]. n( r1 I- t
6 H# W/ M4 ~3 F# S1 ?  f
3、pppoe-client信息
' @/ ~0 ?/ i. f6 M8 d<pppoe-client>dis interface Dialer 14 N, ^$ [& ]& l9 y' Q+ `
Dialer1 current state : UP
2 f) S6 H4 ?; m5 Q/ a0 `0 O1 W/ ?% @Line protocol current state : UP (spoofing)
% N* ]6 b5 J; Q1 A/ W- F7 HDescription:HUAWEI, AR Series, Dialer1 Interface7 W/ y( b8 x* W. h0 _
Route Port,The Maximum Transmit Unit is 1500, Hold timer is 10(sec)2 A# x# i: U8 [% q- }7 ~
Internet Address is negotiated, 10.1.12.254/329 b! b$ C& c) i
Link layer protocol is PPP! _% ?! O- y8 [$ ^- N0 k/ n# z
LCP initial
7 A; V4 i! W% J" b! ^Physical is Dialer+ T7 `; Z# X% e( U' |, U) P+ Y1 w
Current system time: 2021-07-15 20:23:56-08:00
: c, p6 R5 g# ~: e$ ?6 U2 R; A    Last 300 seconds input rate 0 bits/sec, 0 packets/sec
/ }! b6 k8 @$ r; u7 ~, `- ^% ^# e    Last 300 seconds output rate 0 bits/sec, 0 packets/sec  G& J( A0 O1 r; h$ D' l: T2 L  y
    Realtime 0 seconds input rate 0 bits/sec, 0 packets/sec
! [& ]# d( i7 K$ n* q/ V    Realtime 0 seconds output rate 0 bits/sec, 0 packets/sec) j0 x) Z8 X4 R. \( L4 J% B- u' V3 P
    Input: 0 bytes9 _$ k5 m# e* C+ D4 ~! M& Z- b
    Output:0 bytes
% ]! p, e4 t  Q7 o    Input bandwidth utilization  :    0%
9 j3 k. W2 F) x    Output bandwidth utilization :    0%2 U) S; n  w5 v" k+ v/ T2 ~2 i
Bound to Dialer1:0:
1 X2 o8 @) @$ `) a/ J- n, kDialer1:0 current state : UP ,
" M0 P) F& I' Y5 c* J! c' v' MLine protocol current state : UP
2 [$ h7 a( G8 K. T) m5 W7 r* A; I$ [! O3 S0 z$ m0 N
Link layer protocol is PPP6 |) U. a( t0 M; A; o+ g. L
LCP opened, IPCP opened
- x/ g# m- }: ~, p) `Packets statistics:/ S9 n, V- O. F0 A
  Input packets:0,  0 bytes) b2 E; }( f/ M9 x
  Output packets:4, 336 bytes6 ^5 c. S. o2 Q! A5 ~7 D7 v1 `' e
  FCS error packets:0+ Y6 u: I' @4 d) ?
  Address error packets:0  {4 b4 ^- s2 Z$ x, B8 Y1 n# U+ y0 {3 z
  Control field control error packets:0
# w" U8 \% V; i  Z) P
/ {5 r/ d0 h4 o& ]% E, Z. F% b0 F3 l/ J' T, F
<pppoe-client>8 z8 t! `8 U; E+ h# O) k7 G# v
* L, H, g. [/ M9 G1 j
五、NAT的配置
5 v; o8 }  H1 g3 ~( @* `用PC2直接ping 10.1.12.254是可以通的。10.1.12.254是AR1的g0/0/0口获取到的地址,其实就是我们常说的WAN口地址。
! R/ l% {9 P. i" M: O; w
: R$ d) ?  I( y/ aPC2>ping 10.1.12.254- H0 b* ]+ H: I$ [$ T5 z
; u$ d5 P2 e' a+ [1 v1 _
Ping 10.1.12.254: 32 data bytes, Press Ctrl_C to break
7 W. ^& C+ Q( U' l: Z9 bFrom 10.1.12.254: bytes=32 seq=1 ttl=255 time=63 ms
/ \+ X  p( \* N8 Y  n, kFrom 10.1.12.254: bytes=32 seq=2 ttl=255 time=31 ms; B4 B1 S8 A+ A& q. S. O
From 10.1.12.254: bytes=32 seq=3 ttl=255 time=47 ms, b8 _! q1 M+ R1 {4 ?
From 10.1.12.254: bytes=32 seq=4 ttl=255 time=31 ms- M5 M; d8 p& X4 T
From 10.1.12.254: bytes=32 seq=5 ttl=255 time=47 ms
3 q- I9 }! {7 O, r4 L+ F* P" a9 l9 N5 p# z
--- 10.1.12.254 ping statistics ---
3 m. U- _. L: R  5 packet(s) transmitted: [: Y# d7 |1 s4 b% G! Q9 A
  5 packet(s) received
% ^( ~) e# |6 D+ O7 b' Q; b  0.00% packet loss. O9 \3 Q5 N* R% S* V# v
  round-trip min/avg/max = 31/43/63 ms+ u3 R: |: o7 F3 ?. Z3 S! S6 V
2 b* Y5 i* g) M
PC2>ping 10.1.12.2# c" C* f0 u( c& l8 \, N" I
8 Z9 O3 K2 l1 k7 t- ^  W1 k
Ping 10.1.12.2: 32 data bytes, Press Ctrl_C to break
" u5 Z3 v& T7 WRequest timeout!
$ @; W% c) i+ |) ~. ]& i  ]" bRequest timeout!6 u; h2 n* Y* k5 y  P
Request timeout!
; G/ D  f+ a/ B7 \+ V5 b6 L) TRequest timeout!# B6 e; T; f& ~! q2 B
Request timeout!
! F4 h* K. \. l1 ~
& l# H7 s$ |- s( e: G+ I% l$ x--- 10.1.12.2 ping statistics ---! [! R# f! |8 [4 R
  5 packet(s) transmitted
2 a" z+ |3 Y# s; p8 N& W  0 packet(s) received7 q; u* I5 c  p/ z# `6 q$ Z& \  h4 Z
  100.00% packet loss
: p" z: ~  |% ~+ z: Q* f9 v#但是无法ping通10.1.12.27 g: {  r3 Z9 Q" D  U+ w+ `7 H
6 D" e0 R. W9 o9 K) f* Z$ ~% a' T

  {7 z+ F; g- e4 y无法ping通10.1.12.2的原因是:我们没有做NAT .接下来我们在pppoe-client上面做NAT5 f! }" I, ]; [4 F) w8 l/ |+ P+ o
& _0 x  d' Y& ^+ q5 f
1、这里配置规则2000- K/ B4 X' r; A- f# V. k' X
[pppoe-client]acl number 2000       
* J; X# L: b/ A[pppoe-client-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
$ U3 F+ M9 p3 ?( m# w2 r/ ~" H. X! L$ N* H2 n" f5 t
2、将规则2000绑定到接口
7 i* I/ O7 i: e) I7 h如下接口信息,需要注意的是pppoe的接口是Dialer1,并不是GigabitEthernet0/0/0口。我们必须将规则绑定在Dialer1口,最容易犯错的就是直接绑定在g0/0/0口。
, t* o6 E. I/ L4 a
7 `" ~, H, R9 {8 X- m3 j& b7 G) B[pppoe-client]dis ip int b
2 @% f: q$ G# }3 y( U. B5 M  n*down: administratively down; R: x6 O3 k. L0 P, }
^down: standby
4 S' K, k, o' A" C* n0 o& p(l): loopback
( P7 G' z! r! e1 }( E7 d* J! P; j(s): spoofing
5 N4 ]% W; w9 @- B% eThe number of interface that is UP in Physical is 4: B( M; [' N# x4 t% ~
The number of interface that is DOWN in Physical is 0# V6 g4 s- ?2 @/ i! U  D- J
The number of interface that is UP in Protocol is 3
. n4 h( i. ~1 K+ ^% \# b7 YThe number of interface that is DOWN in Protocol is 1
# u5 e. t) g( m9 z/ ]6 {& R2 d  p
Interface                         IP Address/Mask      Physical   Protocol  
- R; ]3 A7 q1 A) K+ X' hDialer1                           10.1.12.254/32       up         up(s)     3 _) m6 x4 {5 k; V  W% X7 e# @0 q- f
GigabitEthernet0/0/0              unassigned           up         down      * A& _6 V& [4 s' @
GigabitEthernet0/0/1              192.168.1.254/24     up         up        
* J$ X  C. v6 \3 {& K/ {. Z. {NULL0                             unassigned           up         up(s)     
1 p, n* ^2 r3 P- k" d: o4 m7 b[pppoe-client]: s' u% ?& Z$ `' ~$ z
3 U6 ?2 Z/ j7 t" \6 B
[pppoe-client]int Dialer 1        + Z2 W4 H5 L* N. `
[pppoe-client-Dialer1]nat outbound 2000" A. F6 v+ E( W* ]' v8 _% l% i
[pppoe-client-Dialer1]dis th
& e* K+ g3 O1 L/ T8 f[V200R003C00]
' |$ M& H; ~1 B6 ?' G3 M: {#( E6 E! R! b5 \
interface Dialer1
' C2 k0 H0 ~" Q, Q: N link-protocol ppp8 U9 k; R8 u$ N* i% `8 S; `# G) [0 t
ppp chap user pokes! \+ b2 ~9 ^4 N$ w; o
ppp chap password cipher %$%$I/!'WCyd<7p[~8;,>51L,$sl%$%$
: |: t* N' H3 G; C1 O. b1 A ip address ppp-negotiate
/ j7 x7 Z3 R7 T+ }& ~7 W: U dialer user zhprny/ b; M3 G% {+ ~9 |7 p
dialer bundle 14 x9 J1 \2 D% N+ P
dialer-group 1
) w* l; U; p: |3 Q' o nat outbound 2000
4 \$ q2 m9 y, X8 U  y; x) M#
# }5 h3 n1 z5 W. c# h) M4 g5 yreturn, z6 ]3 h# k" Q0 W% _7 p. _
[pppoe-client-Dialer1]
, Z3 v1 _# \" b; o6 |, b( \, j1 [) W8 J+ n0 i6 Q2 E; C( k
接下来我们就可以ping通10.1.12.2 了。! Z7 \- Z, `! f' P4 T6 y

; c/ i6 j% U0 f' `3 |+ g9 fPC2>ping 10.1.12.2+ _$ ?* j% @; \. @- m) X
4 l  T  f) Z# g
Ping 10.1.12.2: 32 data bytes, Press Ctrl_C to break" O$ G0 F6 G$ P
From 10.1.12.2: bytes=32 seq=1 ttl=254 time=31 ms! p1 ^" K) y' i4 _
From 10.1.12.2: bytes=32 seq=2 ttl=254 time=32 ms: q# f/ K- f: E  r! t* q" Q% A: Z3 A
From 10.1.12.2: bytes=32 seq=3 ttl=254 time=46 ms* B+ L7 c  O8 y) z1 @/ ]
From 10.1.12.2: bytes=32 seq=4 ttl=254 time=32 ms
! ]9 `' K+ A  ]0 ]; ?2 L( R) \+ @From 10.1.12.2: bytes=32 seq=5 ttl=254 time=31 ms8 x; k# C( ]* Y* ]2 u- y% a$ }
" N: \6 d2 a, T- }7 V. n% S
--- 10.1.12.2 ping statistics ---) R4 K6 U& ?. A
  5 packet(s) transmitted
5 \5 {! ~' `8 O' ?; ~, j( T  5 packet(s) received) M1 F4 C% P: m
  0.00% packet loss
6 _$ q7 W% Y" W; v6 A, e  round-trip min/avg/max = 31/34/46 ms
" F0 q3 A1 U% X( I& w5 P$ x
: \7 d3 M4 U( q. y  ~+ c* A
' @/ z7 u, t, [' [  V+ }

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2022-3-17 09:27:15 | 显示全部楼层
华为路由器:PPPoE实验
' d/ Q; Z; ?. W( t. l/ I$ aPPPoE协议是基于C/S架构的一种网络拨号协议。分为客户端和服务器两部分,它的建立过程分为discovery和session两个阶段。本次实验的目标:掌握PPPoE拨号技术;/ q: G6 L( `4 D$ {
实验拓扑:/ n6 S2 E- E' k8 [1 K8 m% \

$ C! B  U# L. c) a0 s3 s* Y本实验结合虚拟机进行:
5 I# R- `- H  D% p3 _6 L% s9 }首先,必须在虚拟机的网络配置中加以设置,我新建了VM6,去掉了DHCP的钩。这个时候会在你的网卡界面多出来一个虚拟的VM6的网卡。但是当你打开ensp时,会出现检测不到VM6的情况,这个时候你重启一下电脑,就可以了。9 p  }5 f: Y/ r7 |
0 h! c# S3 `5 j+ D) U4 @; y
Cloud1的设置如下图:( Z, l; {4 E: L- O
' b8 P( O& ^$ A5 E. \9 G& i
1、基本的IP配置- T0 S0 `) w3 d9 }9 E& @
[pppoe-server]dis ip in b
9 A0 _: @: \8 G*down: administratively down
6 ~0 Q' r  \1 Z6 e# m: Y^down: standby4 S' @( I  f; t/ _4 @0 e
(l): loopback
; n, J1 H6 ^5 o' \- ?(s): spoofing8 z9 }" D1 |, d# q0 t0 y+ F
The number of interface that is UP in Physical is 4" n9 u9 x; Y/ M. O
The number of interface that is DOWN in Physical is 11 F$ u+ r. C3 Z3 \$ e
The number of interface that is UP in Protocol is 24 U2 \( s' U% O
The number of interface that is DOWN in Protocol is 3& v: o$ e6 c0 b9 ^" D
Interface                         IP Address/Mask      Physical   Protocol  
2 g0 T, U8 q. Q" ?8 hGigabitEthernet0/0/0              unassigned           up         down      ) c; E! [: |+ e7 q
GigabitEthernet0/0/1              202.104.10.1/24      up         up        
( F& b9 j- b. J$ uGigabitEthernet0/0/2              unassigned           down       down      8 h8 {1 C" k% r+ m
NULL0                             unassigned           up         up(s)     
+ G0 {0 A! J& G3 w7 f+ e% q0 f9 j& qVirtual-Template1                 192.168.10.1/24      up         down      2 O+ G$ X0 S: j6 {4 y% A) @
[pppoe-server]5 D4 j" S8 \% k' v7 ?! |

0 y& S1 F; b; a* Q, }' B" `2、配置虚拟模板% ?2 k! q9 G2 t$ l/ w5 M8 j
配置虚拟模板用来承载多种同层协议
. N0 j, q% e$ N9 v[pppoe-server]int Virtual-Template 1                            #创建虚拟模板,编号为1
* g! ]. H/ `: U) w4 }% |[pppoe-server-Virtual-Template1]ppp authentication-mode chap    #PPP认证为chap
6 f% z  A# ?/ i5 R, h1 ~7 q[pppoe-server-Virtual-Template1]remote address pool pokes       #指定使用地址池名为pokes' q. A9 V4 c  O+ ^( R9 x' v3 i
[pppoe-server-Virtual-Template1]ip add 192.168.10.1 24          #配置作为用户上网的网关IP) ]( L  m5 ?3 z  V- t, I3 b1 j
[pppoe-server-Virtual-Template1]q& X) D1 e8 n3 W5 O  Z

6 v+ D! [( _  N3、创建地址池
: I$ v( K0 I5 Y% R9 y[pppoe-server]ip pool pokes                                            #创建地址池pokes
& `, p0 W5 J- X+ UInfo: It's successful to create an IP address pool.$ X( @- q6 z: m9 F
[pppoe-server-ip-pool-pokes]gateway-list 192.168.10.1                  #配置网关地址, M! a( Z; `6 E$ n& _% n, k9 @" O+ M
[pppoe-server-ip-pool-pokes]network 192.168.10.0 mask 255.255.255.0    #配置给用户分配的ip网段
/ f5 j$ E8 ?/ n# ~[pppoe-server-ip-pool-pokes]
" Q9 E& X4 O5 A7 O* _[pppoe-server-ip-pool-pokes]excluded-ip-address 192.168.10.200 192.168.10.254    #排除地址+ w/ S% P, H; @/ R) ?  j
[pppoe-server-ip-pool-pokes]lease day 8 hour 0 minute 0     #租约配置8小时
# T: o4 ?0 E! P/ K* A; P. [[pppoe-server-ip-pool-pokes]dns-list 114.114.114.114        #DNS
/ J+ F  G) d9 ?' e[pppoe-server-ip-pool-pokes]dis th) l4 s$ i5 l/ b2 j' K/ K
[V200R003C00]
+ d, G8 z$ a  \- t#
6 q# E) ^! k9 e9 \ip pool pokes5 j9 a/ V" t4 J4 F" |
gateway-list 192.168.10.1
+ a. _9 h; x" C network 192.168.10.0 mask 255.255.255.0
  U$ Q8 z4 D4 U excluded-ip-address 192.168.10.200 192.168.10.254 0 b/ r0 R( N" i
lease day 8 hour 0 minute 0
- E' [/ _; o' V" x% R2 ? dns-list 114.114.114.114
2 i7 L4 y" J  f) B#
0 n* }8 @4 R* \3 Z& Hreturn
# S6 v0 ?2 m7 @; d[pppoe-server-ip-pool-pokes]
" E& h5 G0 e3 x8 V# y  `9 H9 }9 ?$ x0 j0 ~" a
4、创建PPPoE用户
4 q! ?$ ?8 l' ?" [2 [# t  E[pppoe-server]aaa) [  ~3 D& L9 y
[pppoe-server-aaa]local-user user1 password cipher 1234561 m& l7 x* q$ P' K0 G+ [; e" Z
Info: Add a new user.3 p- x5 ?' V" S" x# C1 m
[pppoe-server-aaa]local-user user1 service-type ppp, {- L7 j! ?/ l0 E7 ?5 [5 v
[pppoe-server-aaa]dis th. N+ C2 f, z; x' F; s
[V200R003C00]/ A2 d) _: _6 L& B6 B* A4 _
#% y2 I, D) s  Q, K! E; i9 h* y
aaa
* O8 J0 T8 S* A0 _) V authentication-scheme default( t/ C) E2 U' v. o
authorization-scheme default! l4 f9 @7 L8 B' [+ k6 W3 W
accounting-scheme default5 I7 }. v" a, I$ _4 }; J
domain default 4 q" h; R7 ~1 j, U% V6 M% {
domain default_admin ) u( m) T) T3 E
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
3 m, M0 A& I9 o$ u/ {- y local-user admin service-type http# Z8 T: S' W$ ~4 m
local-user user1 password cipher %$%$aLq+.xS\rBJXJ}V|dJw'eZry%$%$
" s) N& R4 @  J5 o& E0 Y$ _5 S4 h local-user user1 service-type ppp
' \" j: F( Q1 K# ]& L#
# h( `9 q7 c. ~  b  X' qreturn
5 v0 R( q" B  C% \% m[pppoe-server-aaa]# C0 s) p- b- e# L" Y3 j- F
  G. |8 c* Z0 t( \- H* K/ v. s9 `
5、绑定接口' t7 ^" F+ t) P6 l
将虚拟模板接口与物理接口绑定提供服务# D8 i7 s" G3 S/ U" v2 Q9 X
[pppoe-server]int g0/0/0/ q+ o4 o) P  q. r3 Q5 g( q$ b
[pppoe-server-GigabitEthernet0/0/0]pppoe-server bind virtual-template 1  #将虚拟模板1绑定在物理接口上
" K( m. a% W1 V5 k; g" R0 t. L, q- h4 X9 o" }' j/ K
至此,服务器端的配置基本完成,如果想对PPPoE的访问流量进行控制,还可以配置ACL。* c# j# b$ K& o( ]0 o! c
& a8 A! [) v6 \4 j8 d" |2 w1 j  r' b4 t

" k8 g- f& l# t+ m! c虽然已经拨号成功,也能ping通网关192.168.10.1,但是因为没有nat所以无法ping通202.104.10.150的服务器
6 y# T+ V# z7 y6、NAT配置
8 z) I9 D4 l2 }4 l: Q! X! V[pppoe-server]acl number 2000
3 Q2 y( O9 c7 H4 V  G8 w8 R( ?[pppoe-server-acl-basic-2000]rule permit source 192.168.10.0 0.0.0.255
) y1 x, l3 ~& l$ l/ p; I[pppoe-server-acl-basic-2000]int g0/0/18 @9 }: t0 O( J, h- q
[pppoe-server-GigabitEthernet0/0/1]nat outbound 2000
2 M8 G# `6 T. e; O) y[pppoe-server-GigabitEthernet0/0/1]q0 W5 W8 L& I& a8 ?! i

- r  p# G( h6 z说明:这里ACL的含义就是允许哪些网段可以上网,这里为192.168.10.0/24这个网段,然后调用在拨号接口下。
" Q; ~/ S( T% h现在就可以ping通服务器了
0 M6 j. e! U: p; ]4 S$ X
/ R  X/ M% E- c! `0 r  s) E( W
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 02:59 , Processed in 0.019684 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表