ppp脚本源码分享(1)(2)
options.ttyS1 IP地址分配
配置PPP服务器端本地)IP地址和客户端远端)的IP地址
- /apps/etc/ppp >: cat options.ttyS1
- #Server_IP_address:Client_IP_address
- 10.78.28.194:10.78.28.224
- chap和pap认证的帐号文件:
- /apps/etc/ppp >: cat pap-secrets
- # Secrets for authentication using PAP
- #User Server Secret IP Address
- na_admin * 123 *
- /apps/etc/ppp >: cat chap-secrets
- # Secrets for authentication using CHAP
- #User Server Secret IP Address
- na_admin * 123 *
pppd启动拨号过程:
- /apps/etc/ppp >: pppd /dev/ttyS1
- OK
- ATE0 //chat脚本的调试输出
- OK
- RING
- CONNECTSerial connection established.
- using channel 1
- Using interface ppp0
- Connect: ppp0 <--> /dev/ttyS1
- rcvd [LCP ConfReq id=0x0 <asyncmap 0x0> <magic 0x58452c14> <pcomp> <accomp> <callback CBCP>]
- Warning - secret file /etc/ppp/pap-secrets has world and/or group access
- sent [LCP ConfReq id=0x1 <asyncmap 0x0> <auth pap> <magic 0xb701c04a> <pcomp> <accomp>]
- sent [LCP ConfRej id=0x0 <callback CBCP>]
- rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <auth pap> <magic 0xb701c04a> <pcomp> <accomp>]
- rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x58452c14> <pcomp> <accomp>]
- sent [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x58452c14> <pcomp> <accomp>]
- sent [LCP EchoReq id=0x0 magic=0xb701c04a]
- rcvd [LCP code=0xc id=0x2 58 45 2c 14 4d 53 52 41 53 56 35 2e 31 30]
- sent [LCP CodeRej id=0x2 0c 02 00 12 58 45 2c 14 4d 53 52 41 53 56 35 2e 31 30]
- rcvd [LCP code=0xc id=0x3 58 45 2c 14 4d 53 52 41 53 2d 30 2d 4d 45 49 51 49 4e 50 43 30 31]
- sent [LCP CodeRej id=0x3 0c 03 00 1a 58 45 2c 14 4d 53 52 41 53 2d 30 2d 4d 45 49 51 49 4e 50 43 30 31]
- rcvd [PAP AuthReq id=0xc user="na_admin" password=<hidden>]
- Warning - secret file /etc/ppp/pap-secrets has world and/or group access
- sent [PAP AuthAck id=0xc "Login ok"]
- PAP peer authentication succeeded for na_admin
- sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
- sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 10.78.28.194>]
- rcvd [LCP EchoRep id=0x0 magic=0x58452c14]
- rcvd [CCP ConfReq id=0x4 < 12 06 00 00 00 01>]
- sent [CCP ConfRej id=0x4 < 12 06 00 00 00 01>]
- rcvd [IPCP ConfReq id=0x5 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-wins 0.0.0.0> <ms-
- dns3 0.0.0.0> <ms-wins 0.0.0.0>]
- sent [IPCP ConfRej id=0x5 <ms-wins 0.0.0.0> <ms-wins 0.0.0.0>]
- rcvd [CCP ConfRej id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
- sent [CCP ConfReq id=0x2]
- rcvd [IPCP ConfAck id=0x1 <compress VJ 0f 01> <addr 10.78.28.194>]
- rcvd [CCP TermReq id=0x6"XE,\024\000<\315t\000\000\002\334"]
- sent [CCP TermAck id=0x6]
- rcvd [IPCP ConfReq id=0x7 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
- sent [IPCP ConfNak id=0x7 <addr 10.78.28.224> <ms-dns1 10.78.28.10> <ms-dns3 10.78.28.11>]
- rcvd [IPCP ConfReq id=0x8 <compress VJ 0f 01> <addr 10.78.28.224> <ms-dns1 10.78.28.10> <ms-dns3
- 10.78.28.11>]
- sent [IPCP ConfAck id=0x8 <compress VJ 0f 01> <addr 10.78.28.224> <ms-dns1 10.78.28.10> <ms-dns3
- 10.78.28.11>]
- local IP address 10.78.28.194
- remote IP address 10.78.28.224
测试
/apps/etc/ppp >: ping 10.78.28.224
PING 10.78.28.224 (10.78.28.224): 56 data bytes
64 bytes from 10.78.28.224: seq=0 ttl=64 time=194.570 ms
64 bytes from 10.78.28.224: seq=1 ttl=64 time=190.331 ms
评论暂时关闭