实际上和dhcp一样,pppoe的脚本是 /lib/netifd/proto/ppp.sh
它根据配置,生成pppd的参数,然后执行pppd。pppd波上号后,执行一个回调函数,接口也是pppd进程创建的。在pppd退出的时候,接口也销毁了。
pppoe setup wan {"device":"eth1","proto":"pppoe","username":"test","password":"test","ipv6":"auto"} eth1
ppp_generic_setup wan plugin rp-pppoe.so nic-eth1
/usr/sbin/pppd nodetach ipparam wan ifname pppoe-wan lcp-echo-interval 1 lcp-echo-failure 5 lcp-echo-adaptive +ipv6 set AUTOIPV6=1 nodefaultroute usepeerdns maxfail 1 user test password test ip-up-script /lib/
netifd/ppp-up ipv6-up-script /lib/netifd/ppp6-up ip-down-script /lib/netifd/ppp-down ipv6-down-script /lib/netifd/ppp-down mtu 1492 mru 1492 plugin rp-pppoe.so nic-eth1
/ # ./ppp.sh
Plugin rp-pppoe.so loaded.
PPPoE plugin from pppd 2.4.9
Warning: couldn't open ppp database /var/run/pppd2.tdb
PPP session is 2
Connected to 00:15:5d:01:09:03 via interface enp3s0
Renamed interface ppp0 to pppoe-wan
Using interface pppoe-wan
Failed to create pid file /var/run/pppoe-wan.pid: No such file or directory
Connect: pppoe-wan <--> enp3s0
CHAP authentication succeeded: Access granted
CHAP authentication succeeded
peer from calling number 00:15:5D:01:09:03 authorized
local IP address 10.67.15.2
remote IP address 10.0.0.1