# pppd instead wvdial

## ev56o

Hi! I have to connect to internet jumping wvdial.

Now i use wvdial and works with this configuration

```

m@marco ~ $ cat /etc/wvdial.conf 

[Dialer Defaults]

Baud = 460800

ISDN = false

Init1 = ATZ

#Init1 = AT+CPIN=6541

Init2 = ATQ0 V1 E1 S0=0 &C1 &D2

Init3 = AT+CGDCONT=16,"IP","websfr"

Modem = /dev/ttyUSB0

Modem Type = Analog Modem

username=dummy

password=dummy

Phone = *99#

#Phone = *99***16#

```

I must no use wvdial and use pppd, i don' t understand the mass of guide on the web.

How to do?

----------

## NeddySeagoon

ev56o,

wvdial starts pppd when the connection is established.

You need both pppd and some means of settng up the data link so that pppd can work.

There are GUI replacements for wvdial but I'm not aware of any pppd replacements.

----------

## ev56o

I don' t want replace pppd.

I seen a lot of guide that shows a connection using pppd and no other programs.

These guides make a configuration for ppp and a command line start the connection.

----------

## ev56o

Can i have some help please?

----------

## xaviermiller

Hello,

what you want is to convert the wvdial.conf to "pure ppp" scripts ?

I don't have the answer too, I would also like to use my 3G key without gas factories like NetworkManager...

----------

## Gusar

Untested, but should work in theory:

/etc/ppp/peers/websfr

```
connect "/usr/sbin/chat -f /etc/ppp/websfr.chat"

/dev/ttyUSB0

460800

crtscts

noipdefault

defaultroute

usepeerdns

noauth

novj

noccp

nobsdcomp

user dummy

password dummy
```

/etc/ppp/websfr.chat

```
TIMEOUT 30

#ECHO   ON

ABORT   'BUSY'

ABORT   'ERROR'

ABORT   'NO ANSWER'

ABORT   'NO CARRIER'

''      ATZ

#OK     AT+CPIN=6541

OK      'ATQ0 V1 E1 S0=0 &C1 &D2'

OK      AT+CGDCONT=1,"IP","websfr"

OK      ATD*99#

CONNECT ""
```

Then a simple

```
pon websfr
```

to connect, and

```
poff websfr
```

to disconnect.Last edited by Gusar on Wed Sep 12, 2012 5:46 pm; edited 1 time in total

----------

## NeddySeagoon

Gusar,

Thats cheating.  You are just replacing wvdial with chat.

Chat is worth installing just to read the man page  :)

XavierMiller,

Theres your hint ... chat or wvdial.

----------

## Gusar

 *NeddySeagoon wrote:*   

> Thats cheating.  You are just replacing wvdial with chat.

 

Well, chat is part of the ppp package, so I don't think it's cheating  :Smile: . I don't think this is possible with just pppd.

----------

## ev56o

The gusar solution doesn' t work, i see the daemon pppd and chat work for seconds and dead, there isn' t log.

----------

## NeddySeagoon

ev56o,

chat was what we used to use when 28k modems were new.  I've probably not used it since.

You can make chat produce a log but its off by default as it records the username and password in clear text.

Its probably timing issues.  You may need to add delays into the chat script so it doesn't execute too fast.

Like I say, its a long time since I used chat.

You can use ppp with a one liner and I have been doing it for years, I just didn't know.  I use PPPoE

```
/usr/sbin/pppd plugin rp-pppoe.so unit 0 user <username> remotename ppp0 linkname ppp0 plugin passwordfd.so defaultroute passwordfd 0 defaultmetric 4007 maxfail 0 persist connect true eth0
```

Note that my <username> has been removed and pppd receives the passwowd but does not echo it

```
ps -Alf
```

which would be a very bad thing.

The man page suggests the ppp will run chat if you need to, so its possible to just use ppp but it knows how to run chat.

I start ppp from the /etc/conf.d/net file too, so open-rc takes care of the fiddly bits, see  /usr/share/doc/openrc-*/net.example.bz2

Even the username and password goes into /etc/conf.d/net too in clear text so make sure its only redable by root.

----------

## ev56o

I don' t understand, do i have to use that command line with the configuration of gusar?

----------

## Gusar

 *ev56o wrote:*   

> I don' t understand, do i have to use that command line with the configuration of gusar?

 

No, that's just an example of using pppoe, which is a different thing from what you want. What you need to do is figure out which part of my configuration is failing for you.

Or you simply use wvdial. Why exactly can't you simply use that?

----------

## NeddySeagoon

Gusar,

Its only pppoe because of the plugin it can be pppo<anything> with the <anything> plugin

----------

## Gusar

 *NeddySeagoon wrote:*   

> Its only pppoe because of the plugin it can be pppo<anything> with the <anything> plugin

 

Can it be a "dial-up" connection? Without chat? All examples I found on the net use chat. And I know it works, I've used something very similar to what I posted, except the "modem" was a cellphone connected to the machine via bluetooth, so the device was /dev/rfcomm0 instead of /dev/ttyUSB0

----------

## NeddySeagoon

Gusar,

The pppd man page says that pppd will shell out to chat to get the link up.  It can be over serial or mobile phone or whatever. pppd calls chat for itself, given the one liners with all of the information. Its not without chat but its without visible chat.

I suppose I can test with my USB 3G dongle, which currently uses wvdial.

----------

## ev56o

I use wvdial with huaveii e220 usb modem with sim card.

Finally we have to find the problem in the configuration posted from gusar, ok. Ho to do? I have non output or similar.

----------

## NeddySeagoon

ev56o,

Gusars chat script is 

```
TIMEOUT 30 

#ECHO   ON 

ABORT   'BUSY' 

ABORT   'ERROR' 

ABORT   'NO ANSWER' 

ABORT   'NO CARRIER' 

''      ATZ 

#OK     AT+CPIN=6541 

OK      'ATQ0 V1 E1 S0=0 &C1 &D2' 

OK      AT+CGDCONT=1,"IP","websfr" 

OK      ATD*99# 

CONNECT ""
```

read man chat to find out how it works.  To see it in action uncomment the 

```
#ECHO   ON
```

  line.  This will send everything including your clear text username and password to stderr.  Thats either the screen or a log file

The line 

```
''      ATZ
```

means expect nothing then send ATZ to the modem.  Thats the reset to defualt state. Thu can take several seconds to execute, so you must wiat for the OK response from the modem before sending further commands or the modem will miss them.

----------

## ev56o

Ok, i unconcommented the line ON and wait seconds, but don' t appean anything. With ps -aux i see there isn' t chat, pppd or pon process, i think of a crash. Is this normal? Do i have to wait along after launch pon?

I add an information, after launche pon (with non success) the modem don' t work neither with wvdial, i think in consqeuence of ATZ.

----------

## NeddySeagoon

ev56o,

Emerge minicom and talk to the modem yourself, rather like talking to Bomb 20 in Dark Star .

To do this, you send AT commands to the modem.  If the modem executes the command, it will respond OK

AT alone does nothing but the modem should respons OK

ATZ is reset.

ATH1 is go off hook

ATH0 is hangup

ATDT<number> is dial <number> using DTMF.

ATDP<number> is the same but with pulse dialing. Most modems ignore the P

You cannot start pppd this way as you can't type fast enough but talking to the modem and getting responses is a good first step.

----------

## ev56o

I can' t use minicom because of a situation that requires use only pppd, i understand i can do this. How to do?

----------

## NeddySeagoon

ev56o,

minicom will never get your data link up, which is what starts pppd.  However, something, sometime has to talk to the modem directly to establish the link.

That something can be anything, minicom, chat, wvdial pppd, you can even assign a tty to the modem.

minicom is good for finding out whats wrong with getting the link up, if anything.

As a test, you can make the modem dial a phone number, your mobile phone, landline or whatever.  If the phone rings, the test has passed.

I agree, you can'r use minicom for more than testing.

Your wvidal.conf said

```
 Modem = /dev/ttyUSB0 
```

which is a USB serial port.  Do you have that device when your modem is connected?

If so, tell minicom to talk to that device.

If not, your kernel is missing something.

I am trying to discover exactly where your problem is before I try to fix it.

----------

## ev56o

I always have the devices

```

m@marco ~ $ ls -la /dev/ttyUSB*

crw-rw---- 1 root uucp 188, 0 Sep 18 17:48 /dev/ttyUSB0

crw-rw---- 1 root uucp 188, 1 Sep 18 17:48 /dev/ttyUSB1

```

why not?

----------

## NeddySeagoon

ev56o,

udev creates and removes /dev entries as devices come and go.  When you unplug your USB 3G dongle, the /dev entries will vanish.

That the /dev entries are there indicates your kernel is in good shape too.

How do you know which device of the two devices is your modem?

Did you do the minicom test?

Is your normal user in the uucp group?

If not, only root can use those two devices.

----------

## ev56o

The device is alwaya plugged, the device /dev/ttyUSB0 is indicate in the wvdial.conf, i use root always and i didn' t the minicom test yet.

----------

## NeddySeagoon

ev56o,

I see that /dev/ttyUSB0 is in wvdial.conf.  You also said that wvdial does not work.

We don't know why yet, thats what minicom will tell.

----------

