笔记中着重记录在L2TP配置上一些个人经验的总结,至于详细的配置可参考H3C官网中的产品操作手册,写得很详细。
一、PC直连LNS配置
 

L2TP协议笔记3---基于华为系设备的L2TP配置_职场 

1、 配置LNS链接PC的接口Ethernet 2/0/0的IP地址
[FW2] interface Ethernet 2/0/0
[FW2-Ethernet2/0/0] ip address 192.168.1.1  24 
 
2、把Ethernet 2/0/0加入untrust域中(实际加到那个域中根据自己的需求决定)
 
[FW2] firewall zone untrust
[FW2-zone-untrust] add interface Ethernet2/0/0
 
3、设置域间的包过滤(此处以允许全部包过滤为例,实际根据需求决定)
[FW2] firewall packet-filter default permit all
 
4、配置本地用户及为用户分配地址用的地址池(此处只建立一个用户为例)
[FW2] aaa
[FW2-aaa] local-user user1 password simple password1
[FW2-aaa] local-user user1 service-type ppp
[FW2-aaa] ip pool 1 192.168.1.2 192.168.1.100
 
5、配置虚拟接口模板(简称VT,主要就是配置一些作为L2TP拨号网关的内容)
[FW2] interface Virtual-Template 1
[FW2-Virtual-Template1] ppp authentication-mode chap      //PPP认证方式,可以试PAP或CHAP
[FW2-Virtual-Template1] ip address 192.168.1.1 24   //ip地址,即用户拨号后,分配的网关地址
[FW2-Virtual-Template1] remote address pool 1   //指定给用户分配地址的地址池,刚刚在aaa中建立的
 
6、把虚拟接口模板VT1加入到trust域
[FW2] firewall zone trust
[FW2-zone-trust] add interface virtual-template 1
 
7、打开防火墙的L2TP功能
[FW2]L2TP enable
 
8、创建L2TP组并绑定VT1
[FW2] l2tp-group 1
[FW2-l2tp1]allow  l2tp  virtual-template  1  remote name
注:(1) name:为PC时为PC名       
        (2) 使用组1时可以不写retome名字,其它组必须写
[FW2-l2tp1]undo tunnel authentication    //关闭tunnel认证(默认开启),当然也可以开启,在后续LAC-LNS模式中使用隧道认证为例
 
9、××× Client(PC上使用的L2TP拨号客户端,也可用系统自带的)
当FW使用group1且没设置remote name时,主机客户端上不写隧道名称,当group1设置了remote name时,或使用其他group时(除1以外的任何组均必须写remote name),客户端上必须设置隧道名称为主机名。 
 
二、PC---LAC---LNS配置
 

L2TP协议笔记3---基于华为系设备的L2TP配置_ LAC_02

LAC端配置(前提是PC---LAC---LNS之间的基本通信可以保证(包括基本的路由),即可以ping通)
1、 配置链接主机的接口IP(LAC与LNS之间的通信已实现,相关的接口IP、加入的域等配置此处不再说明)
 [FW1] interface Ethernet 2/0/0
[FW1-Ethernet2/0/0] ip address 192.168.1.1  24
 
2、把Ethernet 2/0/0加入untrust域中(实际加到那个域中根据自己的需求决定)
 
[FW1] firewall zone untrust
[FW1-zone-untrust] add interface Ethernet2/0/0
 
3、设置域间的包过滤(此处以允许全部包过滤为例,实际根据需求决定)
[FW1] firewall packet-filter default permit all
 
4、配置本地用户(此处只建立一个用户为例)
[FW1] aaa
[FW1-aaa] local-user user1 password simple password1
[FW1-aaa] local-user user1 service-type ppp
 
5、配置虚拟接口模板(简称VT,主要就是配置一些作为L2TP拨号网关的内容)
[FW1] interface Virtual-Template 1
[FW1-Virtual-Template1] ppp authentication-mode chap      //PPP认证方式,可以试PAP或CHAP
 
6、把虚拟接口模板VT1加入到trust域(不加入域也可以建立L2TP,但业务是不通的
[FW1] firewall zone trust
[FW1-zone-trust] add interface virtual-template 1
 
7、链接主机的接口的虚拟模板VT1上使能PPPoE(实际上LAC此接口可以不配置IP,只要主机上有缺省路由到此设备即可)
[FW1-Ethernet2/0/0] pppoe-server bind virtual-template 1
 
8、打开防火墙的L2TP功能
[FW1]L2TP enable
 
9、l2tp组配置
[FW1] l2tp-group 1
[FW1-l2tp1] Start l2tp ip 3.2.1.1 fullname pc1 //配置对端LNS地址,鉴别用户是否是×××用户,此处也可以指定域名,指定域名后,此域中的用户都会触发L2TP隧道建立
[FW1-l2tp1] Tunnel   authentication          //启动隧道认证
[FW1-l2tp1] Tunnel  password simple hello    //设置l2tp隧道认证密码,与LNS端一致
[FW1-l2tp1] Tunnel  name  lac    //设置隧道名,与LNS端设置的通道对端名一致
 
LNS端配置
1、LAC与LNS之间的通信已实现,相关的接口IP、加入的域等配置此处不再说明
 
2、设置域间的包过滤(此处以允许全部包过滤为例,实际根据需求决定)
[FW1] firewall packet-filter default permit all
 
3、配置本地用户及为用户分配地址用的地址池(此处只建立一个用户为例)
[FW2] aaa
[FW2-aaa] local-user user1 password simple password1   //用户与lac中相同
[FW2-aaa] local-user user1 service-type ppp
[FW2-aaa] ip pool 1 192.168.1.2 192.168.1.100
 
4、配置虚拟接口模板(简称VT,主要就是配置一些作为L2TP拨号网关的内容)
[FW2] interface Virtual-Template 1
[FW2-Virtual-Template1] ppp authentication-mode chap      //可选,PPP认证方式,可以试PAP或CHAP,与强制LCP重协商结合使用
[FW2-Virtual-Template1] mandatory-lcp  //可选,强制本端CHAP验证,使PC在L2TP拨号过程中,在LNS处再次CHAP认证。
[FW2-Virtual-Template1] mandatory-chap  //可选,使PC在L2TP拨号过程中,在LNS处再次以LNS VT中指定的chap或pap进行一次认证。
注:
(1) LNS如果以上两种均没配置,则使用代理认证,即LAC将它从用户得到的所有验证信息和LAC配置的验证方式传给LNS,LNS会利用这些信息和LAC端传来的验证方式对用户进行验证,并不是不验证了。
(2)代理认证和VT上配置的验证方式也存在关系,如果LAC发过来的验证方式是PAP,而LNS得VT上位CHAP,此时会认证不通过(PPP认为这样不合理)。
[FW2-Virtual-Template1] ip address 192.168.1.1 24   //ip地址,即用户拨号后,分配的网关地址
[FW2-Virtual-Template1] remote address pool 1   //指定给用户分配地址的地址池,刚刚在aaa中建立的
注:此地址池只为非域用户指定地址,域用户不需要此命令,FW会自动从域中的地址池按顺序分配地址
 
 
5、打开防火墙的L2TP功能
[FW2]L2TP enable
 
6、 l2tp组配置
[FW2]l2tp-group 1
[FW2-l2tp1] allow l2tp virtual-template 1 [remote lac]         //指定接收呼叫时隧道对端的名字(与LAC端配置的隧道名称对应)和使用的VT
[FW2-l2tp1] Tunnel   authentication          //启动隧道认证 
[FW2-l2tp1] Tunnel  password simple hello    //设置l2tp隧道认证密码,与LAC端一致
[FW2-l2tp1] Tunnel  name  lns   //设置隧道名,只用作显示用