Using serial modem: Difference between revisions

From Alpine Linux
(Cleaning up, adding setserial notes, etc.)
(→‎Create configfiles: Modifying configfiles (still untested))
Line 32: Line 32:


=== Create configfiles ===
=== Create configfiles ===
{{Note|This is a draft config - it needs fixing}}
'''''/etc/ppp/peers/serialmodem'''''
'''''/etc/ppp/peers/serialmodem'''''
/dev/ttyS0
<pre>debug
38400
/dev/ttyS0
crtscts
115200
modem
modem
noauth
crtscts
usepeerdns
asyncmap 0
defaultroute
defaultroute
noipdefault
noipdefault
debug
lock
noccp
connect '/usr/sbin/chat -f /etc/ppp/chat-serialmodem'
nobsdcomp
</pre>
novj
user "irrelevant"
password "irrelevant"
connect '/usr/sbin/chat -f /etc/ppp/chat-serialmodem'


{{Note|This is a draft config - it needs fixing}}
'''''/etc/ppp/chat-serialmodem'''''
'''''/etc/ppp/chat-serialmodem'''''
ABORT BUSY
<pre>'ABORT' 'BUSY'
ABORT ERROR
'ABORT' 'ERROR'
ABORT 'NO CARRIER'
'ABORT' 'NO ANSWER'
REPORT CONNECT
'ABORT' 'NO CARRIER'
TIMEOUT 10
'ABORT' 'NO DIALTONE'
"" "ATZ"
'ABORT' 'Invalid Login'
OK "AT+CPIN='''''pin'''''"
'ABORT' 'Login incorrect'
OK AT+CGDCONT=1,"ip","'''''internet'''''"
'REPORT' 'CONNECT'
OK "ATE1V1&D2&C1S0=0+IFC=2,2"
'TIMEOUT' '60'
OK "AT+IPR=115200"
'' 'ATZ'
OK "ATE1"
'OK' 'ATDT{phonenumber}'
TIMEOUT 60
'CONNECT' ''
"" "ATD*99***1#"
'ogin:' '{login_id}'
CONNECT \c
'sword:' '{your_password}'
</pre>


'''Note:''' The above highlighted word(s) ''''''pin'''''' is the PIN of your card (typically a four digit code)<BR>
{{Note|Replace above words '''{login_id}''', '''{your_password}''' and '''{phonenumber}''' with what you received from your ISP.}}
'''Note:''' The above highlighted word(s) ''''''internet'''''' is the Access Point Name (APN) of the service you use (for instance mine is "web.omnitel.it"). If you don't know the Internet APN, ask your service provider.<BR>
See [http://www.yolinux.com/TUTORIALS/LinuxTutorialPPP.html this] link for more details.


= Start/Stop=
= Start/Stop=

Revision as of 16:45, 5 January 2011

General notes

Warning: Page is under heavy construction. Do not use unless you know what you are doing! Funtionallity is still unknown.


Requirements

Install alpine-2.1.3 or newer (see these notes if you are unsure how to do it).
And do basic setup (run 'setup-alpine').

Hardware

Choose what ttyS port to use. (In below examples replace ttyS? with the ttyS? that applies for your needs)

  • /dev/ttyS0 is same as COM1
  • /dev/ttyS1 is same as COM2
  • (and so on...)

Install packages

Configure repository

When this article was written, some of the packages was still in 'testing'. So we need to add testing to repository.

echo "http://dl-3.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repository
apk update

Install packages

Install required packages

apk add ppp
apk add setserial

Modules

Load some needed modules and make sure they get automatically loaded at next reboot

modprobe ppp
echo "ppp" >> /etc/modules

Configure

Create configfiles

/etc/ppp/peers/serialmodem

debug
/dev/ttyS0
115200
modem
crtscts
asyncmap 0
defaultroute
noipdefault
lock
connect '/usr/sbin/chat -f /etc/ppp/chat-serialmodem'

/etc/ppp/chat-serialmodem

'ABORT' 'BUSY'
'ABORT' 'ERROR'
'ABORT' 'NO ANSWER'
'ABORT' 'NO CARRIER'
'ABORT' 'NO DIALTONE'
'ABORT' 'Invalid Login'
'ABORT' 'Login incorrect'
'REPORT' 'CONNECT'
'TIMEOUT' '60'
'' 'ATZ'
'OK' 'ATDT{phonenumber}'
'CONNECT' ''
'ogin:' '{login_id}'
'sword:' '{your_password}'
Note: Replace above words {login_id}, {your_password} and {phonenumber} with what you received from your ISP.

See this link for more details.

Start/Stop

Start connection

pon serialmodem

Stop connection

poff serialmodem

If something goes wrong...

Check if process is running

ps | grep pppd

Logfile would also give you information on what happened

grep pppd /var/log/messages

Check nic information

ifconfig ppp0

pppd seems to have some pppstats function

pppstats

Check and set serial speed

Check your ttyS settings

setserial -ga /dev/ttyS1

You should see something like this:

/dev/ttyS1, Line 1, UART: 16550A, Port: 0x02f8, IRQ: 3
    Baud_base: 115200, close_delay: 50, divisor: 0
    closing_wait: 3000
    Flags: spd_normal skip_test