linux ppp GPRS撥號問題

來源:互聯網
上載者:User

我3,4年前在一塊ARM板子上弄通過,由於嵌入式上很多要自己做,redhat上會更簡單,也更容易,如果做嵌入式,你應該先在PC上弄通,在移植到目標板上,大致給你說說,希望對你有所協助
1. 配置kernel使它支援如下PPP選項:
PPP(point-to-point) support
PPP multilink support(EXPERIMENTAL)
PPP support for async serial prots
PPP support for sync tty ports
PPP Deflate compression
PPP BSD-Compress compression
2.編譯交叉編譯ppp-2.4.1,將./pppd/pppd, ,/chat/chat, ./pppdump/pppdump, ./pppstats/pppstats四個檔案拷貝到嵌入式檔案系統的/usr/sbin目錄下,並將他們的檔案屬性改為755.
3.在嵌入式檔案系統中:
a、 建立一個ppp裝置: mknod /dev/ppp c 108 0 並改變/etc/ppp檔案夾的屬性:chmod 600 /etc/ppp.
b、 編輯/etc/modules.conf文檔,增加一行:
options ppp_async flag_time=0
c、 編輯/etc/resolv.conf,加入一行:
nameserver 211.136.17.107(注釋:這是愛立信的GPRS網域名稱解析伺服器DNS地址,當時GPRS沒現在普及,為了這個地址狂打了幾天電信的支援人員,但很多support好水啊,不懂裝懂(藉機損一下那些拿高工資又比較水的telecomer,嘿嘿,不要板磚拍我啊,怕怕的,我),最後終於問到一個帥哥,告訴了我這個。)
d、 檢查/etc/host.conf指令碼,確保有order hosts,bind
4.e、 /etc/ppp目錄下建立如下檔案(這裡怎麼貼附件?真暈,要我挨個貼啊,辛苦是辛苦了點,好在今天心情好,就一併貼了吧,呵呵。為了好看清楚,每個檔案用“#------#”分隔,各個它們都要有可執行許可權哦):
#------------------------------------------------#
# File:
# /etc/ppp/gprs
#
# Description:
# This file holds the serial cable and IrDA pppd options for GPRS phones

# Tell the ppp-daemon to accept mangled data
receive-all

# Give some debug info
debug
kdebug 7

# Print out all the option values which have been set.
dump

# Serial device to which terminal is connected;
# with serial port (COM1 in Windows) use /dev/ttyS0
# and with IrDA use /dev/ircomm0.
#/dev/ircomm0 # IrDA
/dev/ttyAM1 # serial cable (NOTE: 這個地方你要改為真正的你用的串口,比如/dev/ttyS0)

# Serial port line speed
115200

# Turn off waiting of carrier detect or flow control signal
# With IrDA it should be disabled with nocrtscts option.
-crtscts # serial cable
#nocrtscts # IrDA
# Ignore carrier detect signal from the modem
local

# To keep pppd on the terminal
nodetach

# Accept the peer's idea of our local IP address
ipcp-accept-local
# Accept the peer's idea of its (remote) IP address
ipcp-accept-remote

# IP addresses:
# - accept peers idea of our local address and set address peer as 10.0.0.1
# (any address would do, since IPCP gives 0.0.0.0 to it)
# - if you use the 10. network at home or something and pppd rejects it,
# change the address to something else
0.0.0.0:0.0.0.0

-chap
#-pap

# pppd must not propose any IP address to the peer!
#noipdefault

# No ppp compression
novj
novjccomp

papcrypt
nodeflate

#No ppp magic number
nomagic

# no asyn cmap
asyncmap 0

# Add default route
defaultroute

# Connect script
connect /etc/ppp/gprs-connect-chat

# Disconnect script
disconnect /etc/ppp/gprs-disconnect-chat

#------------------------------------------------#
# File:
# /etc/ppp/options
#
receive-all
nopcomp
noaccomp
nomagic
debug
# Mobile is connected to the first serial port
/dev/ttyAM1 (NOTE: 這個地方你要改為真正的你用的串口,比如/dev/ttyS0)
115200
connect '/usr/sbin/chat -e -f /etc/ppp/gprs-connect-chat -v'
disconnect '/usr/sbin/chat -e -f /etc/ppp/chat-disconnect -v'
modem
noauth
noccp
novj
novjccomp
defaultroute
noipdefault
user foo (NOTE:這個很重要,當時搞的我好痛苦,嘿嘿。windows下撥號可以不用使用者名稱,但Linux不行,所以我們騙linux一下,設一個假的好了,另外,還要參見/etc/pap-secrets,呵呵)
lock

#------------------------------------------------#
#!/bin/sh
#
# File:
# /etc/ppp/chat-gprs-connect
#
# Description:
# chat script to open Sonera GPRS service with GPRS phones. If ppp
# negotiation stalls, try restarting the phone. To try with other GPRS
# operator setting, change the PDP contex setting. The settings work with
# all Ericsson models, but Nokia 8310 does not suppor QoS parameters with
# AT commands, so just delete those lines and it'll work.
#
# Set PDP context CID=1, protocol=IP, APN=internet:
# AT+CGDCONT=1,"IP","internet","",0,0
#
# Set CID=1 QoS requirements from the network, not supported by 8310:
# AT+CGQREQ=1,0,0,0,0,0
#
# Set CID=1 minimum acceptable QoS parameters, not supported by 8310:
# AT+CGQMIN=1,0,0,0,0,0
#
# 'Call' CID=1 (activate PDP context one, perform GPRS attach):
# ATD*99***1#
#
# ogin:-BREAK-ogin: /
# TIMEOUT 5 /
# assword: /
# SAY "/nLogged in OK.../n" /

# The actual chat script:
exec chat /
TIMEOUT 5 /
ECHO ON /
ABORT '/nBUSY/r' /
ABORT '/nERROR/r' /
ABORT '/nNO ANSWER/r' /
ABORT '/nNO CARRIER/r' /
ABORT '/nNO DIALTONE/r' /
ABORT '/nRINGING/r/n/r/nRINGING/r' /
'' AT /
TIMEOUT 12 /
SAY "Press CTRL-C to close the connection at any stage!" /
SAY "/ndefining PDP context.../n" /
OK AT+CGATT? /
OK AT+CGATT=1 /
OK AT+CGATT? /
OK 'AT+CGDCONT=1,"IP"' /
OK AT+CGQREQ=1,0,0,3,0,0 /
OK AT+CGACT=1,1 /
OK ATDT*99***1# /
TIMEOUT 120 /
SAY "/nwaiting up to 2 mintues for connect.../n"/
CONNECT "" /
SAY "/nConnected. now logging in.../n" /
SAY "/nIf the following ppp negotiations fail,/n" /
SAY "try restarting the phone./n"
# NOTE: PDP context可能會因你的貓不同而有所區別,查它的手冊來寫吧

#------------------------------------------------#

#!/bin/sh
#
# File:
# /etc/ppp/chat-gprs-disconnect
#
# send break
exec /usr/sbin/chat -V -s -S /
ABORT "BUSY" /
ABORT "ERROR" /
ABORT "NO DIALTONE" /
SAY "/nSending break to the modem/n" /
"" "/K" /
"" "+++ATH" /
SAY "/nPDP context detached/n"
#------------------------------------------------#
# File:
# /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
####### redhat-config-network will overwrite this part!!! (begin) ##########
####### redhat-config-network will overwrite this part!!! (end) ############
#------------------------------------------------#
# File:
#/etc/ppp/pap-secrets
# Secrets for authentication using PAP
# client server secret IP addresses
####### redhat-config-network will overwrite this part!!! (begin) ##########
####### redhat-config-network will overwrite this part!!! (end) ############
foo * "" *
剩下的檔案就是那些關於ip-down,ip-up,ip-down.ipv6to4,ip-up.ipv6to4了,沒啥好說的了,
最後只有祝你good luck了

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.