Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Nov 2012 17:05:25 +0100
From:      Polytropon <freebsd@edvax.de>
To:        s m <sam.gh1986@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: set connection to a modem
Message-ID:  <20121128170525.c3fb92e8.freebsd@edvax.de>
In-Reply-To: <CAA_1SgGYhUO3TA8D_=rVLJZBpU4pNri-RPixCnBQ7X1tHeUzkA@mail.gmail.com>
References:  <CAA_1SgGYhUO3TA8D_=rVLJZBpU4pNri-RPixCnBQ7X1tHeUzkA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 28 Nov 2012 13:44:18 +0330, s m wrote:
> hello guys,
> 
> i want to connect my freebsd system to modem and configure it via my
> freebsd.

For doing _what_ exactly? I ask because depending on your
goal there might be different approaches neccessary:

a) dial out to connect to the Internet
b) dial out to dial in to something else (e. g. shell access)
c) dial out to send a fax
d) dial out to make annoying phone calls :-)
e) dial in so people can dial your system and log in
f) dial in so people can send you fax
g) dial in so you can control something using DTMF
.......

There are many possibilities, each requiring a different
thing to do on FreeBSD (because they are obviously different(.

And of course: Are you talking about a real modem (external
serial modem), some modem card (often dysfunctional "WinModem"),
or a USB modem? Brand and model?



> i thought that i should change /etc/ttys file to set speed and
> other configuration.

Wouldn't you better do this with ppp.conf? Just assuming you
want to dial _out_.



> in order to check if i am right or not, i comment ttyu
> line in ttys file and expect the modem got disconnected but the modem still
> works and can access to it.

The /etc/ttys file doesn't restrict you in controlling the
modem from your host system.



> i googled and found that there are three files in /etc that we can edit
> them to configure our devices: /etc/ttys, /etc/gettytab and
> /etc/rc.d/serial.sh. moreover we can edit init file for each device in /dev
> to set default speed and other configuration by stty command.

Also depends on _what_ you are going to do.



> now i am confused and don't know which file i should edit to set speed and
> flow control and other setting to have a connection to my modem. i mean
> from which file i can configure my connection? i know it's too easy but
> please clear it for me.

Really, I assume you're talking about dialing out with a serial
modem in order to connect to the Internet (or some other system),
and then be "networked" with it.

In that case you would add an entry to /etc/ppp/ppp.conf. Allow
me to provide an example that I've been using on FreeBSD 4 and 5:

# PPP Configuration File
# See /usr/share/examples/ppp/ for some examples
# $FreeBSD: src/etc/ppp/ppp.conf,v 1.8 2001/06/21 15:42:26 brian Exp $

default:
	set log Phase Chat LCP IPCP CCP tun command
	ident user-ppp VERSION (built COMPILATIONDATE)
	set device /dev/cuaa0
	set speed 115200
	set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \"\" AT OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT"
	set ifaddr 10.0.0.1/0 10.0.0.2/0
	set timeout 180
	enable dns

papchap:
 # edit the next three lines and replace the items in caps with
 # the values which have been assigned by your ISP.
	set phone PHONE_NUM
	set authname USERNAME
	set authkey PASSWORD
	set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
	add default HISADDR

mymodem:
	set phone 01234567890
	set authname myname
	set authkey mypass
	add default HISADDR

The example name I've chosen here is "mymodem". Change it
to something meaningful. :-)

The essential authorisation data here is the phone number
of 01234567890, the username 'myname' and the password 'mypass'

Note that today it may be required to change the device name!
I haven't tried to do anything with a modem on current FreeBSD,
so I can't be more specific, sorry.

The device name /dev/cuaa0 will probably need a change. And
then "set speed 115200" sets the speed you need.

If you've done everything properly, you would do something like

	# ppp mymodem
	ppp> dial

Then the modem should dial. With "close" you close the connection.
There are options for /etc/rc.conf (the ppp_* variables) that
allow you to automate things, like "dial on demand".





In contradiction, in /etc/ttys something like

	ttyd0   "/usr/libexec/getty std.9600" dialup   on  secure

would enable you a serial "console access" (e. g. to connect a
serial terminal to) at a speed of 9k6 (e. g. a DEC vt100). When
connected via serial cable, you would receive a login prompt.

Again, note that ttyd0 might not be valid here.





-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121128170525.c3fb92e8.freebsd>