14

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?

0

5 Answers 5

17

Add to /etc/network/interfaces something like

auto ppp0
iface ppp0 inet wvdial

(tested on Ubuntu Lucid)

1
  • 3
    On Debian wheezy works too
    – Farhadix
    Nov 19, 2013 at 8:01
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 :)

2
  • Regarding GUI-based tools, I am using KDE and KNetworkManager just doesn't work :(
    – Grzenio
    Mar 13, 2011 at 8:32
  • @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
    Mar 16, 2011 at 8:40
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
) &
2
  • 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 May 18, 2015 at 7:16
  • @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
    May 18, 2015 at 7:31
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
1
  • 1
    This 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 How to Answer and take our tour to improve your answer.
    – Burgi
    Sep 24, 2019 at 15:17
0

Another good way to fix this is having a wvdial daemon to keep the connection from disconnecting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.