一般情况下,安装rp-pppoe包后,使用pppoe-setup进程配置拨号,然后使用pppoe-start进行拨号,这是官方文档中给出的做法
但在多拨环境中,就力不从心了,使用pon peer拨号可以很好地进行多拨
在/etc/ppp/peers里加入所要的拨号,然后使用pon peers的名字就行
peers配置文件格式如下
noipdefault noauth defaultroute ifname pppoe-out1 plugin rp-pppoe.so ens192 logfile /var/log/ppp/pppoe-out1.log user 'u1' password 'p1'
其中
ifname 配置拨号成功后,接口的名字
plugin 使用pppoe模块来拨号,绑定网卡接口ens192
logfile 配置拨号的日志文件
user 拨号帐号
password 拨号密码
官方参考:https://wiki.archlinux.org/index.php/Ppp
可以使用macvlan批量拨号,脚本如下
#!/bin/sh cat>/etc/iproute2/rt_tables<<EOF # # reserved values # 255 local 254 main 253 default 0 unspec # # local # #1 inr.ruhep EOF for i in `seq 1 1 250`;do ip link add link ens192 macvlan$i type macvlan cat >/etc/ppp/peers/pppoe-out${i}<<EOF noipdefault noauth defaultroute ifname pppoe-out$i plugin rp-pppoe.so macvlan$i logfile /var/log/ppp/pppoe-out${i}.log user 'u1' password 'p1' EOF echo "$i pppoe-out$i">>/etc/iproute2/rt_tables done
使用计划任务检查维护拨号在线(添加到/etc/crontab)
#! /bin/bash export PATH=/sbin:/bin:/usr/bin:/usr/local/bin a_ppps=`ls -al /sys/class/net/ | grep ppp | awk '{print $9}' | grep ppp` all_ppps=`ls -al /etc/ppp/peers/ | grep ppp | awk '{print $9}' | grep ppp` [ -z "$all_ppps" ] && exit 0 for i in $all_ppps; do if [[ ${a_ppps} =~ "${i}" ]];then echo "$i拨号正常";else pon $i; sleep 1;fi done