GPRS через USB (руководство)

Sabayon, Calculate, Funtoo, Exherbo

Модератор: /dev/random

Nikoli
Сообщения: 554
Статус: Житель
ОС: Gentoo

GPRS через USB

Сообщение Nikoli »

Появилась необходимость в GPRS соединение в качестве страховочного. Телефоны подключал по USB. Потратил пару часов на настройку, но в итоге получилось довольно простое решение. Здесь для Gentoo такого руководства не выкладывали, надеюсь моё будет полезно. Если считаете необходимым, добавьте его в FAQ.

1) Ядро должно быть собрано с:

Код: Выделить всё

Device Drivers  --->
      USB support  --->
         <M>   USB Modem (CDC ACM) support

2) Должен быть установлен ppp

3) В /etc/conf.d/net нужно добавить:

Код:

#**********/-------Nokia with Megafon config_ppp1=( "ppp" ) link_ppp1="ttyACM0" pppd_ppp1=( "debug" # Comment this off, if you don't need more info #460800 # Serial port line speed "crtscts" # hardware flow control for cable "local" # Ignore carrier detect signal from the modem: "lcp-echo-failure 0" "lcp-echo-interval 0" # IP addresses: ":0.0.0.0" # - accept peers idea of our local address and set address peer as 10.6.6.6 # (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 "noipdefault" # pppd must not propose any IP address to the peer! "ipcp-accept-local" # Accept peers idea of our local address "defaultroute" # Add the ppp interface as default route to the IP routing table #replacedefaultroute # New route should be our default route to Internet "usepeerdns" # User DNS returned by server "noauth" # The phone is not required to authenticate # Most phone do not support compression, so turn it off. #noipv6 #novj #nobsdcomp #novjccomp #nopcomp #noaccomp # Username and password: # If username and password are required by the APN, put here the username # and put the username-password combination to the secrets file: # /etc/ppp/pap-secrets for PAP and /etc/ppp/chap-secrets for CHAP # authentication. See pppd man pages for details. 'user "internet"' # Change this "persist" # Persistent connection "maxfail 99999" # Retry and retry and retry if failed... ) chat_ppp1=( 'TIMEOUT' '45' 'ABORT' 'BUSY' 'ABORT' 'NO CARRIER' 'ABORT' 'ERROR' '' 'ATE1' 'OK' 'AT+CGDCONT=1,"IP","internet"' 'OK' 'ATD*99***1#' 'CONNECT' 'c' ) #**********/-------Motorola with Beeline config_ppp2=( "ppp" ) link_ppp2="ttyACM0" pppd_ppp2=( "debug" # Comment this off, if you don't need more info #460800 # Serial port line speed "crtscts" # hardware flow control for cable "local" # Ignore carrier detect signal from the modem: "lcp-echo-failure 0" "lcp-echo-interval 0" # IP addresses: ":0.0.0.0" # - accept peers idea of our local address and set address peer as 10.6.6.6 # (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 "noipdefault" # pppd must not propose any IP address to the peer! "ipcp-accept-local" # Accept peers idea of our local address "defaultroute" # Add the ppp interface as default route to the IP routing table #replacedefaultroute # New route should be our default route to Internet "usepeerdns" # User DNS returned by server "noauth" # The phone is not required to authenticate # Most phone do not support compression, so turn it off. #noipv6 #novj #nobsdcomp #novjccomp #nopcomp #noaccomp # Username and password: # If username and password are required by the APN, put here the username # and put the username-password combination to the secrets file: # /etc/ppp/pap-secrets for PAP and /etc/ppp/chap-secrets for CHAP # authentication. See pppd man pages for details. 'user "internet.beeline.ru"' # Change this "persist" # Persistent connection "maxfail 99999" # Retry and retry and retry if failed... ) chat_ppp2=( 'TIMEOUT' '45' 'ABORT' 'BUSY' 'ABORT' 'NO CARRIER' 'ABORT' 'ERROR' '' 'ATE1' 'OK' 'AT+CGDCONT=1,"IP","internet.beeline.ru"' 'OK' 'ATD*99***1#' 'CONNECT' 'c' )


4) Сделайте ссылки на net.lo

Код: Выделить всё

ln -s /etc/init.d/net.lo /etc/init.d/net.ppp1
 ln -s /etc/init.d/net.lo /etc/init.d/net.ppp2


5) Подключите телефон с помощью USB, появится /dev/ttyACM0
6) Выполните

Код: Выделить всё

/etc/init.d/net.ppp1 start

Возможно у вас появится соединение с интернетом.
Полезно почитать вывод tail -f /var/log/messages :

Код:

Oct 27 01:18:03 kompyc pppd[9874]: pppd 2.4.4 started by root, uid 0 Oct 27 01:18:03 kompyc chat[9877]: timeout set to 45 seconds Oct 27 01:18:03 kompyc chat[9877]: abort on (BUSY) Oct 27 01:18:03 kompyc chat[9877]: abort on (NO CARRIER) Oct 27 01:18:03 kompyc chat[9877]: abort on (ERROR) Oct 27 01:18:03 kompyc chat[9877]: send (ATE1^M) Oct 27 01:18:03 kompyc chat[9877]: expect (OK) Oct 27 01:18:03 kompyc chat[9877]: ATE1^M^M Oct 27 01:18:03 kompyc chat[9877]: OK Oct 27 01:18:03 kompyc chat[9877]: -- got it Oct 27 01:18:03 kompyc chat[9877]: send (AT+CGDCONT=1,"IP","internet"^M) Oct 27 01:18:04 kompyc chat[9877]: expect (OK) Oct 27 01:18:04 kompyc chat[9877]: ^M Oct 27 01:18:04 kompyc chat[9877]: AT+CGDCONT=1,"IP","internet"^M^M Oct 27 01:18:04 kompyc chat[9877]: OK Oct 27 01:18:04 kompyc chat[9877]: -- got it Oct 27 01:18:04 kompyc chat[9877]: send (ATD*99***1#^M) Oct 27 01:18:04 kompyc chat[9877]: expect (CONNECT) Oct 27 01:18:04 kompyc chat[9877]: ^M Oct 27 01:18:05 kompyc chat[9877]: ATD*99***1#^M^M Oct 27 01:18:05 kompyc chat[9877]: CONNECT Oct 27 01:18:05 kompyc chat[9877]: -- got it Oct 27 01:18:05 kompyc chat[9877]: send (c^M) Oct 27 01:18:05 kompyc pppd[9874]: Serial connection established. Oct 27 01:18:05 kompyc pppd[9874]: Using interface ppp1 Oct 27 01:18:05 kompyc pppd[9874]: Connect: ppp1 <--> /dev/ttyACM0 Oct 27 01:18:06 kompyc pppd[9874]: local IP address 10.205.145.43 Oct 27 01:18:06 kompyc pppd[9874]: remote IP address 10.6.6.6 Oct 27 01:18:06 kompyc pppd[9874]: primary DNS address 10.77.48.2 Oct 27 01:18:06 kompyc pppd[9874]: secondary DNS address 10.77.48.3

Проверял на том, что было. С отключённым сжатием у меня заработало, у вас его возможно нужно выключить. Если у вас есть замечания по улучшению, буду рад.
По мотивам:
http://gentoo-wiki.com/Nokia_S60_and_N_series
http://gentoo-wiki.com/HOWTO_Phone_sync
http://www.opennet.ru/base/modem/gprs_linux.txt.html
Спасибо сказали: