Using serial modem: Difference between revisions
(Note that this is draft) |
(→Load modules: use ppp_generic) |
||
(13 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Networking]] | [[Category:Networking]] | ||
== Requirements == | == Requirements == | ||
Install alpine-2.1.3 or newer (see [[Installation|these]] notes if you are unsure how to do it | Install alpine-2.1.3 or newer (see [[Installation|these]] notes if you are unsure how to do it). | ||
Decide which serial port to use and plug you modem there.<BR> | |||
In below examples replace ttyS0 with the ttyS? that applies for your needs.<BR> | |||
''(/dev/ttyS0 is same as COM1, ttyS1=COM2, ttyS2=COM3, ttyS3=COM4, ...)'' | |||
== Install packages == | == Install packages == | ||
Install required packages | Install required packages | ||
{{cmd|apk add ppp}} | |||
== | == Load modules == | ||
Load some needed modules and make sure they get automatically loaded at next reboot | Load some needed modules and make sure they get automatically loaded at next reboot | ||
{{cmd|modprobe ppp_generic | |||
echo "ppp_generic" >> /etc/modules}} | |||
== | == Configfiles == | ||
=== | === /etc/ppp/peers/serialmodem === | ||
''(The filename 'serialmodem' can be changed to whatever is appropriate for you, but you will need to remember it when running pon/poff command)'' | |||
<pre>debug | <pre>debug | ||
/dev/ttyS0 | /dev/ttyS0 | ||
Line 39: | Line 28: | ||
asyncmap 0 | asyncmap 0 | ||
defaultroute | defaultroute | ||
lock | lock | ||
connect '/usr/sbin/chat -f /etc/ppp/chat-serialmodem' | noauth | ||
user '{login_id}' | |||
connect '/usr/sbin/chat -v -f /etc/ppp/chat-serialmodem' | |||
</pre> | </pre> | ||
=== /etc/ppp/chat-serialmodem === | |||
<pre> | ''(The filename 'chat-serialmodem' can be changed to whatever is appropriate for you, but you will need modify above configfile to reflect your decition)'' | ||
<pre>ABORT 'BUSY' | |||
ABORT 'ERROR' | |||
ABORT 'NO ANSWER' | |||
ABORT 'NO CARRIER' | |||
ABORT 'NO DIALTONE' | |||
ABORT 'Invalid Login' | |||
ABORT 'Login incorrect' | |||
REPORT 'CONNECT' | |||
TIMEOUT '60' | |||
'' 'ATZ' | '' 'ATZ' | ||
OK 'ATDT{phonenumber}' | |||
CONNECT '\d\c' | |||
Username: '{login_id}' | |||
Password: '{your_password}' | |||
</pre> | </pre> | ||
{{Note|Replace above words '''{login_id}''', '''{your_password}''' and '''{phonenumber}''' with what you received from your ISP.}} | === /etc/ppp/pap-secrets === | ||
When you look at the logs and see pppd report something like this: | |||
daemon.debug pppd[5665]: rcvd [LCP ConfReq id=0xf6 <asyncmap 0xa0000> <auth pap> <magic 0xa239b2b1> <pcomp> <accomp>] | |||
''(Note the "<auth pap>" section)''<BR> | |||
Then you might need to use pap-secrets file (or chap-secrets depending on what pppd reports in the logs).<BR> | |||
You file might in this case look something like this | |||
<pre># client server secret IP addresses | |||
{login_id} * {your_password} * | |||
</pre> | |||
If you are using 'pap-secrets' (or 'chat-secrets') you should most likely comment out 'Username:' and 'Password:' lines in your '/etc/ppp/chat-serialmodem' config. | |||
== Note for above example configs == | |||
{{Note|Replace above words '''{login_id}''', '''{your_password}''' and '''{phonenumber}''' with what you received from your ISP. The characters '''{''' and '''}''' should also be removed.}} | |||
{{Note|You might need to replace the''' 'Username:' '''and''' 'Password:' '''parts to reflect the words your ISP is using to ask you to enter your credentials}} | |||
{{Tip|You might need to replace "'''CONNECT '\d\c''''" with "'''CONNECT 'CLIENT''''" in your chat-serialmodem config}} | |||
References: | |||
* http://axion.physics.ubc.ca/ppp-linux.html | |||
* http://www.yolinux.com/TUTORIALS/LinuxTutorialPPP.html | |||
* http://www.linux.org/docs/ldp/howto/PPP-HOWTO/options.html | |||
= Start/Stop= | = Start/Stop= | ||
== Start connection == | == Start connection == | ||
{{cmd|pon serialmodem}} | |||
== Stop connection == | == Stop connection == | ||
{{cmd|poff serialmodem}} | |||
= If something goes wrong... = | = If something goes wrong... = | ||
Check if process is running | Check if process is running | ||
{{cmd|pidof pppd}} | |||
Logfile | Logfile might give you a clue on what went wrong | ||
{{cmd|egrep "pppd{{!}}chat" /var/log/messages}} | |||
Check nic information | Check nic information | ||
{{cmd|ifconfig ppp0}} | |||
pppd | pppd has a statusinformation function that could come in handy | ||
{{cmd|pppstats}} | |||
Revision as of 13:51, 1 May 2018
Requirements
Install alpine-2.1.3 or newer (see these notes if you are unsure how to do it).
Decide which serial port to use and plug you modem there.
In below examples replace ttyS0 with the ttyS? that applies for your needs.
(/dev/ttyS0 is same as COM1, ttyS1=COM2, ttyS2=COM3, ttyS3=COM4, ...)
Install packages
Install required packages
apk add ppp
Load modules
Load some needed modules and make sure they get automatically loaded at next reboot
modprobe ppp_generic echo "ppp_generic" >> /etc/modules
Configfiles
/etc/ppp/peers/serialmodem
(The filename 'serialmodem' can be changed to whatever is appropriate for you, but you will need to remember it when running pon/poff command)
debug /dev/ttyS0 115200 modem crtscts asyncmap 0 defaultroute lock noauth user '{login_id}' connect '/usr/sbin/chat -v -f /etc/ppp/chat-serialmodem'
/etc/ppp/chat-serialmodem
(The filename 'chat-serialmodem' can be changed to whatever is appropriate for you, but you will need modify above configfile to reflect your decition)
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 '\d\c' Username: '{login_id}' Password: '{your_password}'
/etc/ppp/pap-secrets
When you look at the logs and see pppd report something like this:
daemon.debug pppd[5665]: rcvd [LCP ConfReq id=0xf6 <asyncmap 0xa0000> <auth pap> <magic 0xa239b2b1> <pcomp> <accomp>]
(Note the "<auth pap>" section)
Then you might need to use pap-secrets file (or chap-secrets depending on what pppd reports in the logs).
You file might in this case look something like this
# client server secret IP addresses {login_id} * {your_password} *
If you are using 'pap-secrets' (or 'chat-secrets') you should most likely comment out 'Username:' and 'Password:' lines in your '/etc/ppp/chat-serialmodem' config.
Note for above example configs
References:
- http://axion.physics.ubc.ca/ppp-linux.html
- http://www.yolinux.com/TUTORIALS/LinuxTutorialPPP.html
- http://www.linux.org/docs/ldp/howto/PPP-HOWTO/options.html
Start/Stop
Start connection
pon serialmodem
Stop connection
poff serialmodem
If something goes wrong...
Check if process is running
pidof pppd
Logfile might give you a clue on what went wrong
egrep "pppd|chat" /var/log/messages
Check nic information
ifconfig ppp0
pppd has a statusinformation function that could come in handy
pppstats