10.1 L2TP配置
10.1.1 PC-LAC-LNS
【需求】
PC通过PSTN拨入LAC,然后由LAC发起和LNS建立L2TP。
【组网图】
【配置脚本】
LAC配置脚本 |
# sysname LAC # l2tp
enable
/使能l2tp/ l2tp domain suffix-separator
@
/domain的分隔符为@/ l2tp match-order domain-dnis # dialer-rule
1 ip permit # domain
huawei.com
/创建huawei.com域/ scheme none /认证方式为:不认证。将验证用户的工作交给LNS来处理,如需认证,则需要配置本地帐号/ domain
system # interface
Analogmodem1/0
/AM口使能拨号/ async
mode protocol link-protocol
ppp dialer
enable-circular dialer-group
1 dialer
circular-group 0 # interface
Dialer0 link-protocol
ppp ppp authentication-mode pap domain huawei.com
/PPP认证域为huawei.com/ ip
address 1.1.1.1 255.255.255.0 dialer
enable-circular dialer-group
1 # interface
Ethernet0/0 ip
address 202.101.100.2 255.255.255.252 # l2tp-group
1 tunnel password simple
quidway
/tunnel认证密码为quidway/ tunnel
name lac-end start l2tp ip 202.101.100.1 domain huawei.com /根据用户域名来发起建立隧道的连接请求/ # user-interface
tty 17 authentication-mode
scheme modem
both
/AM口使能modem/ return |
LNS配置脚本 |
# sysname
LNS # l2tp enable /使能l2tp/ l2tp
domain suffix-separator
@
/domain的分隔符为@/ l2tp
match-order domain # domain
huawei.com /创建huawei.com域/ ip pool 1 192.168.0.2
192.168.0.20
/分配给拨号用户的地址/ domain
system # local-user
usera
/创建用于验证用户的本地帐号/ password
simple usera service-type
ppp # interface
Virtual-Template0 ppp authentication-mode pap domain huawei.com /PPP认证域为huawei.com/ ip
address 192.168.0.1 255.255.255.0 remote address pool
1 /指定使用ip pool 1给用户分配地址/ # interface
Ethernet2/0 ip
address 202.101.100.1 255.255.255.252 # l2tp-group
1 mandatory-lcp
/LCP再协商/ allow l2tp virtual-template 0 remote
lac-end /接受lac-end的l2tp请求,并绑定到VT0/ tunnel
password simple quidway
/tunnel认证密码为quidway/ tunnel
name lns-end # |
【提示】
1、 lac可以是路由器也可以是拨号接入服务器
2、用户在拨号网络输入 帐号和口令 usera@huawei.com/usera
拨号成功后,PC将分配到LNS上的地址。
3、在LAC可以只判断域名,然后根据域名发起l2tp。不需要进行PPP的验证和分配地址。
10.1.2 PC作为lac拨入lns路由器
【配置脚本】
LNS配置脚本 |
# sysname
LNS # l2tp enable
/使能l2tp/ # domain system ip pool 1 192.168.0.2
192.168.0.100
/分配给拨号用户的地址/ # local-user
usera /创建用于验证用户的本地帐号/ password
simple usera service-type
ppp # interface
Virtual-Template0 ppp authentication-mode pap /PPP认证方式为PAP,使用system默认域/ ip
address 192.168.0.1 255.255.255.0 remote
address pool
1
/指定使用ip pool 1给用户分配地址/ # interface
Ethernet2/0 ip
address 202.101.100.1 255.255.255.252 # l2tp-group
1 mandatory-lcp
/LCP再协商/ allow
l2tp virtual-template
0 /接受任何LAC的l2tp请求,并绑定到VT0/ undo tunnel
authentication
/不进行tunnel认证/ # ip
route-static 0.0.0.0 0.0.0.0 202.101.100.2 preference 60 return |
10.1.3 pc欲使用l2tp拨号,所需要做的配置
【windows 98】
1、使用网上下载的Enternet500,新建l2tp拨号连接,注意设置为不加密,pap验证。
2、对新版本1.74-0108以上包括VRP3.4
allow l2tp virtual-template 1
最后可以不加LocalHost,可以允许所有对端的l2tp的请求。当有200个PC作L2TP拨入特别方便,一条搞定。
3、可以修改remote name的Ethernet500下载链接:
http://forum.huawei-3com.com/viewthread.php?tid=402
【windows 2000/xp/nt】
Windows下Ethernet 500安装可能出现若干问题,推荐用windows自带拨号程序。
由于Windows2000系统缺省情况下启动了IPSec功能,因此在发起VPN请求时应禁止IPSec功能,在命令行模式下执行regedit命令,弹出“注册表编辑器”对话框。
在左侧注册表项目中逐级找到:HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Rasman\Parameters,单击Parameters参数,接着在右边窗口空白处单击鼠标右键,选择[新建/双字节值]并新建一个注册表值(名称为ProhibitIPSec,值为1),然后重新启动Windows2000。
注意设置为pap验证,尤其注意要选择l2tp拨号,微软默认的是pptp。
想偷懒的人,可以到华三论坛下载热心网友qingq制作的注册表修改文件,直接导入即可。
链接地址:http://forum.huawei-3com.com/viewthread.php?tid=877
【提示】
1、 如果l2tp不通,建议在l2tp-group中增加mandatory-lcp
2、 当L2TP组号为1时(缺省的L2TP组号),可以不指定隧道对端名remote-name。如果在L2TP组1的视图下,仍指定对端名称,则L2TP组1不作为缺省的L2TP组。
3、当LNS上的内网同时需要作NAT上网的时候,注意在配置NAT的ACL的时候要将内网访问L2TP地址池的流量deny掉,不进行NAT转换。
参考配置脚本 |
# sysname
Quidway # l2tp
enable l2tp
domain suffix-separator @ # domain
system accounting
optional ip
pool 1 192.168.1.2 192.168.2.100 # local-user
test password
cipher =W6JJ`N_LBKQ=^Q`MAF4<1!! level
3 service-type
ppp # interface
Virtual-Template1 ppp
authentication-mode pap ip
address 192.168.1.1 255.255.255.0 remote
address pool 1 # interface
Ethernet0/0 ip address
192.168.2.1 255.255.255.0 # interface
Ethernet0/1 ip
address 202.101.xxx.2 255.255.255.0 nat outbound 3000 interface # acl
number 3000 rule 0 deny ip source 192.168.2.0 0.0.0.255 destination 192.168.1.0
0.0.0.255 rule 1
permit ip source 192.168.2.0 0.0.0.255 # l2tp-group
1 undo
tunnel authentication mandatory-lcp allow
l2tp virtual-template 1 # ip
route-static 0.0.0.0 0.0.0.0 202.90.xxx.1 preference 60 # |
10.1.4 LAC作为客户端的典型配置
【需求】
LAC本身作为客户端,自动发起隧道连接,采用用户名认证方式。
【组网图】
【配置脚本】
LAC侧配置脚本 |
# sysname LAC # l2tp enable # web set-package force flash:/http.zip # radius scheme system # domain system # local-user admin password cipher .]@USE=B,53Q=^Q`MAF4<1!! service-type telnet terminal level 3 service-type ftp local-user
huawei
/创建用户名、密码和类型/ password simple
hello service-type ppp # interface
Virtual-Template1
/VT1设置/ ppp
authentication-mode pap ppp pap local-user
huawei password simple hello l2tp-auto-client
enable
/设置LAC侧自动发起隧道连接/ ip address
ppp-negotiate undo ip fast-forwarding # interface Aux0 async mode flow # interface Ethernet1/0 ip address 1.1.1.1 255.255.255.0 # interface Ethernet2/0 speed 10 duplex full ip address 3.3.3.1 255.255.255.0 # interface NULL0 # l2tp-group 1 tunnel password
simple 123
/隧道设置/ tunnel name LAC start l2tp ip
3.3.3.2 fullusername huawei # FTP server enable # ip route-static 2.2.2.2 255.255.255.255 Virtual-Template 1 preference 60 ip route-static 0.0.0.0 0.0.0.0 Virtual-Template 1 preference 60 # user-interface con 0 user-interface aux 0 user-interface vty 0 4 authentication-mode scheme # return |
LNS侧配置脚本 |
# sysname
LNS # l2tp
enable # radius
scheme system # domain system ip pool 1 192.168.0.2 192.168.0.10 /配置地址池/ # local-user
admin password
cipher .]@USE=B,53Q=^Q`MAF4<1!! service-type
telnet terminal level
3 service-type
ftp local-user
huawei password
simple hello service-type
ppp # interface Virtual-Template1 ppp authentication-mode pap ip address 192.168.0.20 255.255.255.0 remote address pool 1 # interface Aux0 async mode flow # interface
Ethernet2/0 ip
address 3.3.3.2 255.255.0.0 # interface
Ethernet2/1 ip
address dhcp-alloc # interface
NULL0 # interface
LoopBack1 ip
address 2.2.2.2 255.255.255.255 # l2tp-group 1 allow l2tp virtual-template 1 remote LAC tunnel password simple 123 tunnel name LNS # FTP
server enable # ip route-static 1.1.1.0 255.255.255.0
Virtual-Template 1 preference 60 # user-interface con 0 user-interface aux 0 user-interface vty 0 4 authentication-mode scheme # return |
【验证】
LAC和LNS可以建立隧道且可以互通。
隧道的建立:
[LAC]dis l2tp tunnel
LocalTID RemoteTID RemoteAddress Port Sessions RemoteName KeepStanding
1
1
3.3.3.2
1701 1
LNS NO
Total tunnel = 1
会话的建立:
[LAC]dis l2tp session
LocalSID
RemoteSID LocalTID IdleTimeLeft
5127 7186 1 NOT
SET
Total session = 1
LAC和LNS互通:
[LAC]ping 2.2.2.2
Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=255 time=11
ms
Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=255 time=4 ms
Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=255 time=4 ms
Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=255 time=4 ms
Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=6 ms
--- 2.2.2.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max =
【提示】
1、两端的用户名和密码及类型要配置一致。
2、在LNS侧配置隧道信息时注意是隧道对端名。
2、采用域名认证
【需求】
LAC本身作为客户端,自动发起隧道连接,采用域名认证方式。
【组网图】
【配置脚本】
LAC侧配置脚本 |
# sysname LAC # l2tp enable # web set-package force flash:/http.zip # radius scheme system # domain huawei.com scheme none /设置本地不认证/ domain system # local-user admin password cipher .]@USE=B,53Q=^Q`MAF4<1!! service-type telnet terminal level 3 service-type ftp local-user h3c@huawei.com password simple hello service-type ppp # interface Virtual-Template1 ppp
authentication-mode pap domain huawei.com
/VT1设置/ ppp pap local-user
h3c@huawei.com password simple hello l2tp-auto-client
enable ip address
ppp-negotiate undo ip fast-forwarding # interface Aux0 async mode flow # interface Ethernet1/0 ip address 1.1.1.1 255.255.255.0 # interface Ethernet1/1 # interface Ethernet1/2 # interface Ethernet1/3 # interface Ethernet1/4 # interface Ethernet2/0 speed 10 duplex full ip address 3.3.3.1 255.255.255.0 # interface NULL0 # l2tp-group 1 tunnel password simple 123 tunnel name LAC start l2tp ip
3.3.3.2 fullusername h3c@huawei.com # FTP server enable # ip route-static
2.2.2.2 255.255.255.255 Virtual-Template 1 preference 60 # user-interface con 0 user-interface aux 0 user-interface vty 0 4 authentication-mode scheme # return |
LNS侧配置脚本 |
# sysname LNS # l2tp enable # radius scheme system # domain
huawei.com
/配置地址池/ ip pool 1
192.168.0.1 192.168.0.10 domain system # local-user admin password cipher .]@USE=B,53Q=^Q`MAF4<1!! service-type telnet terminal level 3 service-type ftp local-user h3c password simple hello service-type ppp local-user h3c@huawei.com password simple hello service-type ppp # interface Virtual-Template1 ppp
authentication-mode pap domain huawei.com ip address
192.168.0.20 255.255.255.0 remote address pool
1 # controller E1 1/0 # interface Aux0 async mode flow # interface Ethernet0/0 ip address 3.3.3.2 255.255.255.0 # interface Ethernet0/1 ip address dhcp-alloc # interface NULL0 # interface LoopBack1 ip address 2.2.2.2 255.255.255.255 # l2tp-group 1 allow l2tp
virtual-template 1 remote LAC tunnel password
simple 123 tunnel name LNS # FTP server enable # ip route-static
1.1.1.0 255.255.255.0 Virtual-Template 1 preference 60 # user-interface con 0 user-interface aux 0 user-interface vty 0 4 authentication-mode scheme # return |
【验证】
隧道的建立:
[LAC]dis l2tp tunnel
LocalTID RemoteTID RemoteAddress Port Sessions RemoteName KeepStanding
1
1
3.3.3.2
1701 1
LNS
NO
Total tunnel
= 1
会话的建立:
[LAC]dis l2tp session
LocalSID RemoteSID LocalTID IdleTimeLeft
17386 5986 1 NOT
SET
Total session
= 1
LAC和LNS互通:
[LAC]ping 2.2.2.2
Reply from 2.2.2.2: bytes=56
Sequence=1 ttl=255 time=24 ms
Reply from 2.2.2.2: bytes=56
Sequence=2 ttl=255 time=5 ms
Reply from 2.2.2.2: bytes=56
Sequence=3 ttl=255 time=5 ms
Reply from 2.2.2.2: bytes=56
Sequence=4 ttl=255 time=5 ms
Reply from 2.2.2.2: bytes=56
Sequence=5 ttl=255 time=5 ms
--- 2.2.2.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max =
【提示】
1、隧道两端的用户名和密码及用户类型要配置一致。
2、在LNS侧配置隧道信息时配置的是隧道对端的名字。
3、在LAC侧配置域的时候设置本地不认证。
4、地址池配置在要认证的域内。