I start my USB 3G Modem by:

# wvdial

And then I must do, in order to acquire internet access:

# route add default ppp0

Note that ppp0 is, in this case, the newly created virtual network interface.
I would like to automate this:

route add default ppp0

But sometimes there is some previous ppp connection established (i.e: VPN), so the correct adapter must have another number (it is created as ppp1, ppp2... etc), and I need to parse ifconfig output or any other method.

Isn't there a more practical way to automate the routing part of the PPP connection?

EDIT-1: This is my /etc/wvdial.conf :

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","ac.vodafone.es";
Modem = /dev/ttyUSB0
Phone = *99***1#
Username = vodafone
Password = vodafone
Stupid Mode = 1
# Carrier Check = no
#Dial Command = ATDT
#Baud = 9600
Baud = 460800
ISDN = 0
Modem Type = Analog Modem

The carrier is Vodafone.

EDIT-2: My distro is Kali Linux v1.0.5

EDIT-3: Added to /etc/wvdial.conf :

New PPPD = yes

Still no results :-( .

  • Did you check, whether Check Def Route is set to yes in your /etc/wvdial.conf ? – SeDav Jan 14 '15 at 2:19
  • Negative, @SeDav. My /etc/wvdial.conf has no reference to Check Def Route. I have edited original post to add it. – Sopalajo de Arrierez Jan 14 '15 at 2:39
  • Normally accordng to the man page it should be activated by default, if there is no entry, but could you try to add Check Def Route = yes This should tell wvdial to add the default route automatically. – SeDav Jan 14 '15 at 8:59
  • Tested, but not working, @SeDav. Results are the same. My distro is Kali Linux v1.0.5. – Sopalajo de Arrierez Jan 15 '15 at 1:18
  • @SeDav , Check Def Route is reported by the man page as «Option added by SuSE». Is this supposed to mean that any other distro will not work with it? – Sopalajo de Arrierez Jan 15 '15 at 16:22

Firstly, you should do:

route del default 

You can test if the default route is deleted with the command:

route -n 

Add the default route using the modem IP and gateway as default route. For example:

route add default netmask gw {IP_GATEWAY_FROM_3G_MODEM} dev ppp0

You can test, everything is working fine with a simple traceroute command.

traceroute google.es

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.