linux ppp

本文详细介绍了在Linux系统中配置PPP协议的过程,包括下载PPP软件包、编译与安装步骤,以及遇到的常见问题及其解决方案。在配置过程中,讲解了如何解决编译错误、strip工具不匹配的问题,并展示了PPP连接设置,包括拨号文件、聊天脚本和相关配置。最后,文章还提到了PPP协议的操作阶段,如LCP协商、PAP/CHAP认证、IPCP阶段,以及PPP数据报文的解析示例。
摘要由CSDN通过智能技术生成

RFC: http://mirrors.zju.edu.cn/rfc/ 
         http://www.faqs.org/rfcs/
1.ppp download
https://download.samba.org/pub/ppp/

2.configure and make  //要root执行 
# ./configure --host=arm-linux --prefix=$PWD/out 
#make CC=arm-linux-gcc      //一定要在make 指定交叉编译器不能在./configure命令指定
#make install 

3.problem
(1) /opt/Embedsky/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/tq-linaro-toolchain/bin/../arm-fsl-linux-gnueabi/multi-libs/usr/include/linux/if_pppox.h:85:25: error: field 'pppol2tp' has incomplete type

solve:
 

--- ppp-2.4.5/include/linux/if_pppol2tp.h      2009-11-16 22:26:07.000000000 +0000

+++ ppp-2.4.5/include/linux/if_pppol2tp.h      2010-07-16 22:35:22.000000000 +0100

@@ -32,6 +32,45 @@

      __u16 d_tunnel, d_session;   

 };

+

+struct pppol2tpin6_addr {

+      __kernel_pid_t  pid;           

+      int    fd;                   

+

+      __u16 s_tunnel, s_session;     

+      __u16 d_tunnel, d_session;     

+

+      struct sockaddr_in6 addr;     

+};

+

+

+struct pppol2tpv3_addr {

+      pid_t  pid;                   

+      int    fd;                   

+

+      struct sockaddr_in addr;       

+

+      __u32 s_tunnel, s_session;     

+      __u32 d_tunnel, d_session;     

+};

+

+struct pppol2tpv3in6_addr {

+      __kernel_pid_t  pid;           

+      int    fd;                   

+

+      __u32 s_tunnel, s_session;     

+      __u32 d_tunnel, d_session;     

+

+      struct sockaddr_in6 addr;     

+};

+

 /* Socket options:

  * DEBUG      - bitmask of debug message categories

  * SENDSEQ  - 0 => don't send packets with sequence numbers

(2)strip: Unable to recognise the format of the input file `/home/jason/E9/ppp/ppp-2.4.5/out/sbin/chat' 
cause:
#type arm-linux-gcc   //arm-linux-gcc is /opt/Embedsky/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/tq-linaro-toolchain/bin/arm-linux-gcc
#type strip    //strip is /usr/bin/strip  

交叉编译工具gcc与strip命令不是同一系统的, 代码用交叉编译器arm架构编译的,而make install时带的参数"-s"默认的是x86的/usr/bin/strip. 所以要用arm-linux-strip才对.解决办法是把"-s"去掉或指定arm-linux-strip

solve: delete "-s" in all Makefile as showed below:
因为每次./configure各级Makefile都是由右边文件生成如pppd/Makefile <= pppd/Makefile.linux,所以把右边的文件(INSTALL)-s 中的-s 去掉,这样./configure不会再生成-s了.
#./configure
Creating Makefiles.
  Makefile <= linux/Makefile.top
  pppd/Makefile <= pppd/Makefile.linux
  pppstats/Makefile <= pppstats/Makefile.linux
  chat/Makefile <= chat/Makefile.linux
  pppdump/Makefile <= pppdump/Makefile.linux
  pppd/plugins/Makefile <= pppd/plugins/Makefile.linux
  pppd/plugins/rp-pppoe/Makefile <= pppd/plugins/rp-pppoe/Makefile.linux
  pppd/plugins/radius/Makefile <= pppd/plugins/radius/Makefile.linux
  pppd/plugins/pppoatm/Makefile <= pppd/plugins/pppoatm/Makefile.linux
  pppd/plugins/pppol2tp/Makefile <= pppd/plugins/pppol2tp/Makefile.linux 

2. place related files to 
/sbin  /lib/ppp  /var/share 

3. create the dail-up file in /etc/ppp

root@ubuntu:/etc/ppp# ls
chap-secrets  ip-down  ip-down.d  ip-up  ip-up.d  ipv6-down  ipv6-down.d  ipv6-up  ipv6-up.d  options  pap-secrets  peers  resolv.conf
4. /etc/ppp/peers
4.1dail up file:  wcdma
nodetach
lock
/dev/ttyUSB0
115200
#user "card"
#password "card"
crtscts
show-password
usepeerdns
noauth
noipdefault
novj
novjccomp
noccp
defaultroute
ipcp-accept-local
ipcp-accept-remote
connect '/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-connect'
disconnect '/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-disconnect'


4.2chat file :
(1)chat-wcdma-connect :
ABORT 'NO CARRIER'
ABORT 'ERROR'
ABORT 'NO DIALTONE'
ABORT 'BUSY'
ABORT 'NO ANSWER'
'' AT
#OK ATZ
OK ATI
OK AT+CSQ
OK AT+CPIN?
OK AT+COPS?
OK AT+CGDCONT?
OK AT+CGDCONT=2,\"IP\",\"3gnet\",,0,0
OK ATDT*99#
CONNECT ''
(2)chat-wcdma-disconnect:
ABORT  OK
ABORT  BUSY
ABORT  DELAYED
ABORT  "NO ANSWER"
ABORT  "NO CARRIER"
ABORT  "NO DIALTONE"
ABORT  VOICE
ABORT  ERROR
ABORT  RINGING
TIMEOUT  12
""  \K
""  \K
""  \K
""  +++ATH
""  +++ATH
""  +++ATH
""  ATZ
SAY "\nGoodbay\n"

5. dial up
#cd /etc/peers
#pppd call wcdma
 

ot@ubuntu:/etc/ppp/peers# pppd call wcdma &
[1] 1593
abort on (ERROR)
abort on (NO DIALTONE)
abort on (BUSY)
abort on (NO ANSWER)
send (AT^M)
expect (OK)
AT^M^M
OK
 -- got it

send (ATI^M)
expect (OK)
^M
ATI^M^M
LARA-R280-02B-01^M
^M
OK
 -- got it

send (AT+CSQ^M)
expect (OK)
^M
AT+CSQ^M^M
+CSQ: 23,1^M
^M
OK
 -- got it

send (AT+CPIN?^M)
expect (OK)
^M
AT+CPIN?^M^M
+CPIN: READY^M
^M
OK
 -- got it

send (AT+COPS?^M)
expect (OK)
^M
AT+COPS?^M^M
+COPS: 0,0,"CHN-UNICOM",7^M
^M
OK
 -- got it

send (AT+CGDCONT?^M)
expect (OK)
^M
AT+CGDCONT?^M^M
+CGDCONT: 1,"IPV4V6","3gnet.MNC001.MCC460.GPRS","10.231.234.150 254.128.0.0.0.0.
0.0.0.1.0.2.39.51.62.149",0,0,0,0,0,0^M
^M
+CGDCONT: 2,"IP","3gnet","0.0.0.0",0,0,0,0,0,0^M
^M
+CGDCONT: 8,"IP","3gnet","0.0.0.0",0,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值