首页 文章

Raspberry Pi sim900默认Internet访问

提问于
浏览
3

我已经 Build 了一个ITEAD sim900 GSM模块来与raspberry pi连接 . 我相信我已经通过wvdial Build 了与AT&T的gprs连接,因为我得到了这些结果 .

--> WvDial: Internet dialer version 1.61
    --> Initializing modem.
    --> Sending: AT+CGDCONT=1,"IP","Broadband"
    AT+CGDCONT=1,"IP","Broadband"
    OK
    --> Modem initialized.
    --> Sending: ATDT*99#
    --> Waiting for carrier.
    ATDT*99#
    CONNECT
    --> Carrier detected.  Starting PPP immediately.
    --> Starting pppd at Thu Aug 14 05:49:20 2014
    --> Pid of pppd: 2794

我一直在互联网上寻找一些我的问题的答案,但我似乎找不到任何问题 . 任何有关以下问题的帮助将不胜感激!谢谢!

我有三个问题,有些可能是愚蠢的,因为我对这个领域非常陌生 .

  • 我实际连接到AT&T的GPRS网络吗?

  • 如何将此模块(串口/ dev / ttyAMA0)设为我的默认互联网连接?我的意思是我希望通过此调制解调器(网上冲浪,电子邮件等)路由所有互联网流量 . 我通过ssh连接到Raspberry所以我必须有以太网或wifi激活才能访问计算机 - 我目前正在使用以太网 . 在我通过上面显示的方式连接到wvdial,并禁用所有其他Internet源我无法访问 . 它似乎仍然在寻找活动的以太网端口的数据(我可能是错的) .

  • 对于我的项目,我需要将sim900调制解调器作为互联网接入点,但我还需要能够通过无法访问互联网的wifi连接到局域网 . 这可能吗?

1 回答

  • 4

    最后我得到了(raspberrypi ppp gprs / gsm-modem)工作 .

    开始前的一些注意事项

    • 确保您用于raspberrypi的电源精确为5V,并且它可以提供至少2A电流而不会出现电压下降.SIM900电源必须为3.3V 2A

    • 通过以下方式将SIM900波特率设置为115200: AT+IPR=115200

    • 通过以下方式检查调制解调器串行外设: $ screen /dev/ttyAMA0 115200 类型 AT<enter> 它将回显: OK . 点击 ctrl+a k y 退出 .

    /etc/ppp/options-mobile

    ttyAMA0
    115200
    lock
    crtscts
    modem
    passive
    novj
    defaultroute
    replacedefaultroute
    noipdefault
    usepeerdns
    noauth
    hide-password
    persist
    holdoff 10
    maxfail 0
    debug
    

    Create the /etc/ppp/peers directory:

    $ mkdir /etc/ppp/peers
    $ cd /etc/ppp/peers
    

    /etc/ppp/peers/mobile-auth

    file /etc/ppp/options-mobile
    user "your_usr"
    password "your_pass"
    connect "/usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat"
    

    /etc/ppp/peers/mobile-noauth

    file /etc/ppp/options-mobile
    connect "/usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat"
    

    Create the /etc/ppp/chatscripts directory:

    $ mkdir /etc/ppp/chatscripts
    

    /etc/ppp/chatscripts/mobile-modem.chat

    ABORT 'BUSY'
    ABORT 'NO CARRIER'
    ABORT 'VOICE'
    ABORT 'NO DIALTONE'
    ABORT 'NO DIAL TONE'
    ABORT 'NO ANSWER'
    ABORT 'DELAYED'
    REPORT CONNECT
    TIMEOUT 6
    '' 'ATQ0'
    'OK-AT-OK' 'ATZ'
    TIMEOUT 3
    'OK' @/etc/ppp/chatscripts/pin
    'OK\d-AT-OK' 'ATI'
    'OK' 'ATZ'
    'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
    'OK' @/etc/ppp/chatscripts/mode
    'OK-AT-OK' @/etc/ppp/chatscripts/apn
    'OK' 'ATDT*99***1#'
    TIMEOUT 30
    CONNECT ''
    

    /etc/ppp/chatscripts/my-operator-apn

    AT+CGDCONT=1,"IP","<apn-name>"
    

    /etc/ppp/chatscripts/pin.CODE

    AT+CPIN=1234
    

    /etc/ppp/chatscripts/pin.NONE

    AT
    

    /etc/ppp/chatscripts/mode.3G-only

    AT\^SYSCFG=14,2,3fffffff,0,1
    

    /etc/ppp/chatscripts/mode.3G-pref

    AT\^SYSCFG=2,2,3fffffff,0,1
    

    /etc/ppp/chatscripts/mode.GPRS-only

    AT\^SYSCFG=13,1,3fffffff,0,0
    

    /etc/ppp/chatscripts/mode.GPRS-pref

    AT\^SYSCFG=2,1,3fffffff,0,0
    

    模式 . *文件中的SYSCFG行与设备有关,可能是华为特定的,因此如果您的调制解调器是SIM900,您可以使用mode.NONE文件 . *

    /etc/ppp/chatscripts/mode.NONE

    AT
    

    Make some symbolic links:

    $ ln -s /etc/ppp/chatscripts/my-operator-apn /etc/ppp/chatscripts/apn
    $ ln -s /etc/ppp/chatscripts/mode.NONE /etc/ppp/chatscripts/mode
    $ ln -s /etc/ppp/chatscripts/pin.NONE /etc/ppp/chatscripts/pin
    

    If you have to enter credentials use mobile-auth

    $ mv provider provider.example
    $ ln -s /etc/ppp/peers/mobile-noauth /etc/ppp/peers/provider
    

    Check syslog in another console:

    $ tail -f /var/log/syslog | grep -Ei 'pppd|chat'
    

    Finally issue the pon command to see the result:

    $ pon
    

    基本指令:https://wiki.archlinux.org/index.php/3G_and_GPRS_modems_with_pppd

相关问题