How can I get wvdial to run from /etc/network/interfaces

14

3

I am using wvdial to connect to a mobile network (I have a usb modem) and it works fine. However, I wanted to automate the connection a bit (currently I am running wvdial every time I want to connect). I was wandering if there is a way to add this network to /etc/network/interfaces (in a truly Debian way) to have it connect on startup and/or whenever I connect my modem.

Any ideas anyone?

Grzenio

Posted 2010-12-23T22:22:06.427

Reputation: 2 599

Answers

17

Add to /etc/network/interfaces something like

auto ppp0
iface ppp0 inet wvdial

(tested on Ubuntu Lucid)

Joril

Posted 2010-12-23T22:22:06.427

Reputation: 1 879

3On Debian wheezy works too – Farhadix – 2013-11-19T08:01:41.727

2

You need to integrate wvdial with the ifupdown system. If you want a full shell-based solution start with The alternative PPP connection with wvdialconf. But note that Debian recommends using graphical tools like the NetworkManager for configuring network connections on GUI-based desktops.

PS: That should normally be a comment but I don't have permissions to comment yet :)

sakisk

Posted 2010-12-23T22:22:06.427

Reputation: 121

Regarding GUI-based tools, I am using KDE and KNetworkManager just doesn't work :( – Grzenio – 2011-03-13T08:32:11.023

@Grzenio What do you mean by "just doesn't work"? I remember that it was very easy to create a new mobile broadband connection using the GNOME NetworkManager and set it to auto-connect. It should be similar in KNetworkManager. – sakisk – 2011-03-16T08:40:24.593

0

To run wvdial with boucle, you can use this script and you can stop it with Ctrl+C:

#!/bin/bash     
i=1
while [ $i -le 10 ];
        wvdial 
        sleep 10
      $i
let $[ i+=1 ] 
done

user1093791

Posted 2010-12-23T22:22:06.427

Reputation: 1

1This is extremely similar to @harrymc's answer. Are you able to go into a little more detail on what is different with your script and why it would work better? Please take a look at [answer] and take our [tour] to improve your answer. – Burgi – 2019-09-24T15:17:58.180

0

Try the Auto Reconnect feature of wvdial described in wvdial.conf. This option is "on" by default, so might just not work in your case.

It it does not work for you, disable it and use instead this script from ArchWiki Wvdial :

If wvdial randomly drops connection you can use script below.

#! /bin/bash
(
   while : ; do
       wvdial
       sleep 10
   done
) &

harrymc

Posted 2010-12-23T22:22:06.427

Reputation: 306 093

Hi, I found this answer in another question here - it doesn't work. The problem is, sometimes the PPPD process dies, but, wvdial stays up - so, this script won't fire as wvdial can't run twice – William Hilsum – 2015-05-18T07:16:55.703

@WilliamHilsum: If pppd is started from /etc/inittab, for example by s1:23:respawn:/usr/sbin/pppd /dev/ttyS1 115200, it will be restarted when it dies. The above script is supposed to fail and keep failing when wvdial is already running. – harrymc – 2015-05-18T07:31:05.027