PPPoE简介
介绍PPPoE的定义和目的。
定义
PPPoE(PPP over Ethernet)协议是一种把PPP帧封装到以太网帧中的链路层协议。PPPoE可以使以太网网络中的多台主机连接到远端的宽带接入服务器。
目的
运营商希望把一个站点上的多台主机连接到同一台远程接入设备,同时接入设备能够提供与拨号上网类似的访问控制和计费功能。在众多的接入技术中,把多个主机连接到接入设备的最经济的方法就是以太网,而PPP协议可以提供良好的访问控制和计费功能,于是产生了在以太网上传输PPP报文的技术,即PPPoE。
PPPoE利用以太网将大量主机组成网络,通过一个远端接入设备连入因特网,并运用PPP协议对接入的每个主机进行控制,具有适用范围广、安全性高、计费方便的特点。
CLI举例:通过IPv4 PPPoE接入互联网
组网需求
如图1所示,FW作为出口网关,为局域网内PC提供接入Internet出口。公司网络规划如下:
- 局域网内所有PC都部署在10.3.0.1/24网段,均通过DHCP方式动态获得IP地址。
- 下行链路:连接公司内的所有PC。
- 上行链路:向运营商申请Internet接入服务。运营商提供的Internet接入服务使用PPPoE协议。
根据以上情况,需要将FW作为PPPoE Client,向PPPoE Server(运营商设备)拨号获得IP地址、DNS地址后,实现接入Internet。
本举例中假设某企业从运营商获取了如下信息,这些信息仅供举例使用,实际配置时请从当地运营商获取。
数据 | 说明 |
---|---|
接口号:GigabitEthernet 1/0/1 安全区域:untrust | 通过拨号向PPPoE Server(运营商设备)拨号获得IP地址、DNS地址。
|
接口号:GigabitEthernet 1/0/3 IP地址:10.3.0.1/24 安全区域:trust | 通过DHCP,给局域网内PC动态分配IP地址。 |
配置思路
-
配置下行链路。
在接口GigabitEthernet 1/0/3上开启DHCP Server服务,为PC动态分配IP地址,指定PC获得的网关和DNS Server地址均为接口GigabitEthernet 1/0/3的IP地址。
PC上网通常需要解析域名,这就需要为其指定DNS Server地址。本例中FW作为DNS Relay设备。
-
配置上行链路,采用PPPoE方式获取IP地址和DNS Server地址。
-
将FW各个接口加入到安全区域,并配置安全策略。
将连接公司局域网的接口加入到高安全等级的区域(trust),将连接Internet的上行接口加入到低安全等级的区域(untrust)。
-
配置NAT策略。
局域网内通常使用私网地址,必须经过地址转换后才能访问Internet。本例中,因为上行接口通过拨号获得IP地址,每次拨号获得的IP地址可能不同,所以配置采用Easy IP方式的NAT策略。
实验拓扑
实验步骤
防火墙配置
FW 防火墙配置
<Huawei> system-view
[Huawei] sysname FW
[FW] interface GigabitEthernet 1/0/3
[FW-GigabitEthernet1/0/3] ip address 192.168.1.254 255.255.255.0
[FW-GigabitEthernet1/0/3] quit
[FW] firewall zone trust
[FW-zone-trust] add interface GigabitEthernet 1/0/3
[FW-zone-trust] quit
[FW] firewall zone untrust
[FW-zone-untrust] add interface GigabitEthernet 1/0/1
[FW-zone-untrust] quit
[FW] security-policy //配置安全策略,允许内部网络中的PC访问Internet
[FW-security-policy] rule name policy_sec_1
[FW-security-policy-policy_sec_1] source-zone trust
[FW-security-policy-policy_sec_1] destination-zone untrust
[FW-security-policy-policy_sec_1] source-address 192.168.1.0 mask 255.255.255.0
[FW-security-policy-policy_sec_1] action permit
[FW-security-policy-policy_sec_1] quit
[FW-security-policy] quit
[FW] nat-policy //配置NAT策略,允许内网用户访问Internet
[FW-policy-nat] rule name policy_nat_1
[FW-policy-nat-rule-policy_nat_1] source-zone trust
[FW-policy-nat-rule-policy_nat_1] source-address 192.168.1.0 mask 255.255.255.0
[FW-policy-nat-rule-policy_nat_1] egress-interface dialer 1
[FW-policy-nat-rule-policy_nat_1] action source-nat easy-ip
[FW-policy-nat-rule-policy_nat_1] quit
[FW-policy-nat] quit
[FW] dhcp enable
[FW] interface GigabitEthernet 1/0/3 //创建接口地址池,为内网PC配置网关地址并指定DNS Server
[FW-GigabitEthernet1/0/3] dhcp select interface
[FW-GigabitEthernet1/0/3] dhcp server ip-range 192.168.1.1 192.168.1.253
[FW-GigabitEthernet1/0/3] dhcp server dns-list 8.8.8.8
[FW-GigabitEthernet1/0/3] dhcp server gateway-list 192.168.1.254
[FW-GigabitEthernet1/0/3] quit
[FW] dialer-rule 1 ip permit //配置接口GigabitEthernet 1/0/1,采用PPPoE方式获得IP地址和DNS Server地址
[FW] interface Dialer 1 //创建虚拟接口Dialer 1
[FW-Dialer1] link-protocol ppp
[FW-Dialer1] dialer user user1 //描述信息
[FW-Dialer1] ip address ppp-negotiate
[FW-Dialer1] ppp ipcp dns admit-any
[FW-Dialer1] dialer-group 1
[FW-Dialer1] dialer bundle 1
[FW-Dialer1] ppp chap user user //用户为user
[FW-Dialer1] ppp chap password cipher huawei //密码为huawei
[FW-Dialer1] quit
[FW] firewall zone untrust
[FW-zone-untrust] add interface Dialer 1
[FW-zone-untrust] quit
[FW] interface GigabitEthernet 1/0/1
[FW-GigabitEthernet1/0/1] pppoe-client dial-bundle-number 1 ipv4
[FW-GigabitEthernet1/0/1] quit
[FW] ip route-static 0.0.0.0 0.0.0.0 Dialer 1 //配置缺省路由,确保局域网用户访问Internet路由可达。下一跳为运营商分配给企业的网关地址
R1 PPPOE服务端配置
R1 PPPOE服务端配置
<Huawei> system-view
Enter system view, return user view with Ctrl+Z.
[Huawei] sysname R1
[R1] undo info-center enable
Info: Information center is disabled.
[R1] ip pool pool1 //配置全局地址池pool1
Info: It's successful to create an IP address pool.
[R1-ip-pool-pool1] network 100.1.1.0 mask 255.255.255.0
[R1-ip-pool-pool1] gateway-list 100.1.1.2
[R1-ip-pool-pool1] quit
[R1]aaa //配置PPPoE认证用户
[R1-aaa] authentication-scheme system_a
Info: Create a new authentication scheme.
[R1-aaa-authen-system_a] authentication-mode local
[R1-aaa-authen-system_a] quit
[R1-aaa] authorization-scheme system_a
Info: Create a new authorization scheme.
[R1-aaa-author-system_a]quit
[R1-aaa] domain system
Info: Success to create a new domain.
[R1-aaa-domain-system] authentication-scheme system_a
[R1-aaa-domain-system] authorization-scheme system_a
[R1-aaa-domain-system] quit
[R1-aaa] local-user user password cipher huawei
Info: Add a new user.
[R1-aaa] local-user user service-type ppp
[R1-aaa] quit
[R1] interface Virtual-Template 1 //创建并配置VT
[R1-Virtual-Template1] ppp authentication-mode chap domain system
[R1-Virtual-Template1] ip address 100.1.1.2 255.255.255.0
[R1-Virtual-Template1] remote address pool pool1 //将上方编写的地址池注入
[R1-Virtual-Template1] ppp ipcp dns 8.8.8.8
[R1-Virtual-Template1] quit
[R1] interface GigabitEthernet 0/0/0 //在以太网接口GE0/0/0上启用PPPoE Server功能
[R1-GigabitEthernet0/0/0] pppoe-server bind virtual-template 1
[R1-GigabitEthernet0/0/0] quit
[R1] interface LoopBack 0
[R1-LoopBack0] ip address 1.1.1.1 32
[R1-LoopBack0] quit
结果验证
可ping通R1的loopback 0 接口