測試pppd的syslog
更新記錄
item | note |
---|---|
20160727 | 第一版 |
目錄
busybox syslogd
1 | xxx :[/etc]# syslogd -help |
測試pppd的syslog
帶起busybox syslogd
1 | syslogd |
帶起pppd查看log
- pppd參數 記得加入debug,才會將訊息道到/var/log/message
1 | pppd debug plugin rp-pppoe.so eth0 user 7476xxxx@hinet.net password wicpxxx persist usepeerdns defaultroute unit 2 |
- /var/log/message
1 | xxx :[/etc]# cat /var/log/messages [25/1973] |
pppd重撥
- 當第一次帶起pppd會送出PADI(Active Disconvery Initiation)
- 等得一段時間未收到PAD0則判為timenout此時如何再次重撥
重撥的方式
pkill -USER2 -x -n pppd
測試了二次(USR2), 此時未接上撥接的網路線
- 每次送出PADI間隔5S,一共送出3次PADI(40S,45S,55S)
- 再來等得約35S(與第一次送PADI時間差),若未得到PADO則為timeout
- 因此設定至少35S才會合理,重新送出USR2的時間
- 若第一階段(Discovery)未完成,未處理若何程序(ex. USR2),在30S之後pppd自行結束
1 | Jul 28 07:34:56 gk350a daemon.debug pppd[14427]: Send PPPOE Discovery V1T1 PADI session 0x0 length 12 |
Note
Some limited degree of control can be exercised over a running pppd process by sending it a signal from the list below.
SIGUSR1
- This signal toggles the state of the debug option.
- pppd預設debug訊息不會打到syslog (但其它會如: warn,err等)
- 因此需要使用USR1來開啟debug訊息
- Debugging can also be enabled or disabled by sending a SIGUSR1 signal to the pppd process. This signal acts as a toggle.
- 表示:第一次使用USR1,則開啟pppd debug模式,第二次使用USER1則關閉debug模式
SIGUSR2
- This signal causes pppd to renegotiate compression.
- This can be useful to re-enable compression after it has been disabled as a result of a fatal decompression error
- 當未收到PADO即產生timeout則此時不會自動重撥,需要使用USR2來啟動重新送出PADI訊息
SIGINT, SIGTERM
- These signals cause pppd to terminate the link (by closing LCP), restore the serial device settings, and exit.
- 產生/etc/ppp/ip.down及相關流程,並且結束pppd
SIGHUP
- This signal causes pppd to terminate the link, restore the serial device settings, and close the serial device
- If the persist or demand option has been specified, pppd will try to reopen the serial device and start another connection (after the holdoff period)
- 當有persist參數時,產生/etc/ppp/ip.down及相關流程,之後再重新撥號,此時ppppd尚未關閉(若成功撥號成功)
- 可用來當gateway pin不到時,重新撥接 (關閉ppp2介面,再重新撥接)
pppd撥接成功
- defaultroute
- Add a default route to the system routing tables, using the peer as the gateway, when IPCP negotiation is successfully completed
usepeerdns
- Ask the peer for up to 2 DNS server addresses.
- 更新/etc/pppp/resolv.conf
先執行/etc/ppp/ip-up
之後再執行 :
/etc/ppp/ip-up.d/0000usepeerdns
- 有設定此參數usepeerdns,才會執行此0000usepeerdns,使用撥接的dns
/etc/ppp/ip-up.d/000resolvconf
- 不在存/sbin/resolvconf ,內容不會執行
- resolvconf: manage nameserver information
/etc/ppp/ip-up.d/0dns-up
- 不存在/usr/sbin/pppconfig,內容不會執行
- pppconfig:configure pppd to connect to the Internet
/etc/ppp/ip-up.d/ez-ipupdate
- 不存在/usr/sbin/ez-ipupdate,內容不會執行
- ez-ipupdate: 用來更新ddns
- pppoe up syslog message
1 | Jul 28 08:27:28 gk350a daemon.info pppd[1362]: Plugin rp-pppoe.so loaded. |
pppd關閉
- pppoe down syslog message
1 | Jul 28 09:15:54 gk350a daemon.info pppd[1365]: Terminating on signal 15 |
- pppoe down script程序
1 | gk350a :[/tmp]# cat /tmp/ppp-log |
/etc/pppd 目錄結構
1 | gk350a :[/tmp]# ls -l /etc/ppp |