3g wan on boot not starting

I setup a 3g wan connection, it works ok but on boot quite always pppd doesn't start at all (logread -f reveal no attempts of connection) a network restart is enough to make work everything.
I suspect the 3g dongle is a bit slow so where starts pppd to let it sleep a bit before starting?

What is the output of uci export network ?

root@OpenWrt:~# uci export network
package network

config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config globals 'globals'
option ula_prefix 'fdcb:a86a:4893::/48'

config interface 'lan'
option type 'bridge'
option proto 'dhcp'
option ifname 'eth0 zt2lr7k26f'

config interface 'wan'
option enabled '1'
option proto '3g'
option apn 'tre.it'
option dialnumber '*99#'
option device '/dev/ttyUSB0'
option service 'umts'

Thanks

Added in section wan

option delay '20'

But after a reboot nothing and in luci at wan 3g interface is present

Error: Network device is not present

When /dev/ttyUSB0 is present :pensive:

Try this one:
uci set network.wan.auto=1 ; uci commit network ; reboot
Or from Luci Network->Interfaces-> Edit wan -> go to advanced tab -> tick "Bring up on boot"


Bring on boot is already enabled....
But really not present auto =1 in network.wan config...
...Added but same result

So you are now facing a different problem than the one described in the first post? Because there you mentioned that it works fine, but doesn't come up on boot. The only thing you changed was the delay time, is that right?

Not really, the problem, not really great and solvable with a network restart after boot in rc.local, is not connecting automatically on boot also with bring on boot flag in luci or adding auto=1 in network config (should be the same thing but seems that luci did not added it in confs).
Just now I noticed that in luci is reported the absence of /dev/ttyUSB0 that really is present and digging a bit more in dmesg is reported but nothing about pppd (I'm referring to the boot process) so maybe pppd is triggered before dev is discovered and not rise also whit a deley of 20 secs in wan config.
Where is triggered pppd? I think in etc/init.d/networks but I didn't find it.
Just another question witch is the cli call for starting a single interface? In future the 3g dongle should start only as backup of main lan internet connection in case of main power failure.

What does gcom -d /dev/ttyUSB0 say?
You can start interface wan from command line with ifup wan. If it is already up, it will first be turned off and then back on.

root@OpenWrt:~# gcom -d /dev/ttyUSB0
SIM ready
Waiting for Registration..(120 sec max)
Registered on Roaming network: "22288",2
Signal Quality: 6,99

That is after a completed boot.
As just said after the boot the dongle works correctly but isn't triggered the connection nor with ifup wan, but with network restart it goes...
When connected with network restart, ifdown wan OK and ifup wan OK.

Could you explain that? It works correctly or not?
Your signal is pretty weak by the way, so maybe you need to give it more time to register. I have Signal Quality 20 and I have a delay of 15.
Also I am not sure if the fact that you are connected on Roaming network matters in the automatic connection.

Ok the signal is weak but is enough to connect.
At boot time the device is normally detected and dev file created, but connection doesn't start in particular pppd doesn't try at all the connection (normally when it works it would cycle until the connection is established reporting if the signal isn't enough and is shown by logread), as seen luci instead reports that dev ttyUSB0 isn't present(wrong) so greping dmesg for pppd reports nothing but greping dmesg for ttyUSB0 is positive.... in that situation ifup wan does nothing and gcom report as above.
Only /etc/init.d/networks restart works and automatically ends with 3g connection established. Only now ifdown and ifup wan work disconnecting and reconnnecting... with the same weak signal!
Update
Increased delay to 40.. nothing different
Logread | grep ttyUSB0 happen at 9.422354
Uci export networks report delay of 40 is correctly set...
Update 2
In luci:

Error: Network device is not present

Using luci to restart wan only the same:

Error: Network device is not present

I am out of ideas, so I hope someone else can provide a better solution :confused:

I tried disabling network on boot and after boot start it and connection works
So is a matter of timing access to dev/TTYUSB0 before is ready
I'm not so able to understand well /etc/init.d/network script but it seem to not delay at all the 3g iface

Out of curiosity, give the delay a high value of 120 and see if it makes any difference.

After about 10 minutes after reboot nothing

Set the 3g not to start on boot
Add a script in /etc/rc.local

#! /bin/sh
sleep 30; ifup wan
exit 0

I hope this helps.

It will not works only add in rd.local /etc/init.d network restart would works
Ifup wan do nothing witout /etc/init.d network restart after boot, seems that ttyUSB0 is not present but is present, is recognised only after /etc/init.d network restart that is not the same for eth0:
Driver for eth0 is used in boot time at 9.3138etc
while driver for 3g dongle at 9.49...
How can find in dmesg when is triggered network start on boot?

Is triggered 3 times and after all modules loaded and of course after /dev/ttyUSB0 is created....

I don't think it is clearly mentioned, but you can search for the timestamp when some eth is coming up.
Another suggestion is to locate the modules that are required for the 3g and add them in /etc/modules.d/3g then add symlink in /etc/modules-boot.d/.
If this doesn't work as well I can only suggest to add the service network restart in rc.local

1 Like