(1) 安装pppoe,安装完成后,会有pppoe-server命令
yum install rp-pppoe
安装完成后,会在动在/etc/ppp目录下生成pppoe-server-options文件。
(2) 修改服务配置文件
vi /etc/ppp/pppoe-server-options
# PPP options for the PPPoE server
# LIC: GPL
# 认证方式为chap, 还可以配置为pap方式
# win7密码是加密的,可能不支持pap,所以测试最好是chap
require-chap
login
lcp-echo-interval 10
lcp-echo-failure 2
(3) 修改配置文件 /etc/ppp/options
vi /etc/ppp/options
# local # local for chap
auth # auth for chap
lock # lock for chap
(4) 添加账户
(a) 若采用chap认证方式
vi /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
"test" * "12345678" *
(b) 若采用pap认证方式
vi /etc/ppp/pap-secrets
# Secrets for authentication using PAP
# client server secret IP addresses
"test" * "12345678" *
(5) 设置支持IP转发
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1 # 修改为1
(6) 启动pppoe
pppoe-server -I eth0 -L 192.168.11.101 -R 192.168.22.200 -N 10 -F
# -L 虚拟PPPoE接口,不是eth0的IP地址(可以不设置eth0的IP地址)
# -R 起始地址
# -N 地址个数
# -F 前台运行,默认后台运行
(1) 添加pppoe客户端,如果已经存在,则直接连接
(a) 打开网络共享中心
(b) 设置新的连接和网络
(2) 输入账号和密码,开始连接
(1) 安装 rp-pppoe 包
yum install rp-pppoe
(2)使用root用户,执行 pppoe-setup 生成配置
pppoe-setup
# 按照提示输入对应内容即可
Ethernet Interface: eth0
User name: test
Activate-on-demand: No
DNS: Do not adjust
Firewalling: NONE
User Control: yes
Accept these settings and adjust configuration files (y/n)? y
Adjusting /etc/sysconfig/network-scripts/ifcfg-ppp0
Adjusting /etc/ppp/chap-secrets and /etc/ppp/pap-secrets
(But first backing it up to /etc/ppp/chap-secrets.bak)
(But first backing it up to /etc/ppp/pap-secrets.bak)
Congratulations, it should be all set up!
Type '/sbin/ifup ppp0' to bring up your xDSL link and '/sbin/ifdown ppp0'
to bring it down.
Type '/sbin/pppoe-status /etc/sysconfig/network-scripts/ifcfg-ppp0'
to see the link status.
(3) 运行
[root@centos ~]# ifdown ppp0 // 停止
[root@centos ~]# ifup ppp0 // 运行
[root@centos ~]#
[root@centos ~]# ifconfig // 查看网口配置
ppp0 Link encap:Point-to-Point Protocol
inet addr:192.168.22.201 P-t-P:192.168.11.101 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:17 errors:0 dropped:0 overruns:0 frame:0
TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:220 (220.0 b) TX bytes:265 (265.0 b)
(4) 查看日志信息
[root@centos ~]# tail -f /var/log/messages
Nov 12 10:26:10 centos pppd[7389]: pppd 2.4.5 started by root, uid 0
Nov 12 10:26:10 centos pppd[7389]: Using interface ppp0
Nov 12 10:26:10 centos pppd[7389]: Connect: ppp0 <--> /dev/pts/1
Nov 12 10:26:10 centos pppoe[7390]: PPP session is 2 (0x2)
Nov 12 10:26:11 centos pppd[7389]: CHAP authentication succeeded: Access granted
Nov 12 10:26:11 centos pppd[7389]: CHAP authentication succeeded
Nov 12 10:26:36 centos pppd[7389]: local IP address 192.168.22.201
Nov 12 10:26:36 centos pppd[7389]: remote IP address 192.168.11.101