1、检查系统是否已安装PPPoE服务器
rpm -q rp-pppoe
或rpm -qa | grep pppoe
如果未安装,则执行:
yum install pppoe
也可以到 https://www.roaringpenguin.com/products/pppoe 下载
2、配置系统以支持IP转发
echo 1 > /proc/sys/net/ipv4/ip_forward
3、修改PPPoE身份验证方式
修改/etc/ppp/pppoe-server-options,全部内容如下:
require-chap #使用chap验证协议,如果使用pap验证协议,则此行为 require-pap
login
lcp-echo-interval 10
lcp-echo-failure 2
ms-dns 10.10.12.10 #分配给客户端的DNS
ms-dns 8.8.8.8
4、添加身份验证账户
修改/etc/ppp/chap-secrets,添加账户 #如果使用pap验证,则修改/etc/ppp/pap-secrets
swz * swz *
test * 654321 *
####### system-config-network will overwrite this part!!! (begin) ##########
####### system-config-network will overwrite this part!!! (end) ############
此认证方式的帐号必须是系统帐号,即
/etc/passwd
文件中存在的帐号
5、启动pppoe服务器
pppoe-server -I eth0 -L 192.168.0.1 -R 192.168.0.5 -N 10
-I eth0 指定pppoe服务器在那个网卡接口监听连接请求
-L 192.168.0.1 指定pppoe服务器的ip地址。(注意:此IP地址不是网卡的IP地址,而是PPPOE服务器的虚拟IP)
-R 192.168.0.5 pppoe服务器分配给客户端的IP地址,从192.168.0.5开始,递增
-N 10 指定最多可以连接pppoe服务器的客户端数量
查看pppoe服务是否启动,请执行:
pstree | grep pppoe
若显示
|-pppoe-server
说明已启动
6、关闭PPPOE服务器
kill -9 `pidof pppoe-server`
备注:
1、如果使用pap验证方式,windowsxp以上系统自带的pppoe拨号,无法拨通。可能原因是pap使用明文密码验证,而windows保存的密码是加密的,而且是不可恢复的加密,所以windows无法提供密码明文。
2、/etc/ppp/pppoe-server-options和/etc/ppp/options,配置无论写在哪个文件中,都能够起到作用。
3、以上第2、5步可以写入/etc/rc.d/rc.local中,实现自动启动;fedora需要关闭防火墙,例如:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
echo 1 >/proc/sys/net/ipv4/ip_forward
/etc/init.d/iptables stop
ifup eth0
pppoe-server -I eth0 -L 192.168.100.1 -R 192.168.100.10 -N 10