ddkDIZ Posted September 17, 2015 Share Posted September 17, 2015 I am trying to set up a failover connection ( dialup with wvdial ) to use when eth0 doesnt have a connection, Linux a20-SSM 3.4.108-sunxi #14 SMP PREEMPT Tue Aug 25 18:13:23 CEST 2015 armv7l GNU/Linux I have set up my /etc/network/interfaces do run wvdial when eth0 goes down.This happens reliably when I send the command to take eth0 down ( ifdown eth0 ) but not when the cable is diconnected. /etc/network/interfaces allow-hotplug eth0 iface eth0 inet dhcp hwaddress ether 02:17:08:80:c1:98 post-down ifup ppp0 post-up ifdown ppp0 #PPP dialup connection auto ppp0 allow-hotplug ppp0 iface ppp0 inet wvdial pre-up /home/ssm/modemTurnon.sh up wvdial When the cable is disconnected ( or the router turns off /power failure )i get this message in terminal , but the interface does not go down and ifconfig still reports that eth0 is up # <6>PHY: sunxi_gmac-0:01 - Link is Down<c> #ifconfig eth0 Link encap:Ethernet HWaddr 02:19:05:82:e3:f4 inet6 addr: fe80::19:5ff:fe82:e3f4/64 Scope:Link UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:253 errors:0 dropped:0 overruns:0 frame:0 TX packets:9 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:50555 (49.3 KiB) TX bytes:706 (706.0 Interrupt:117 cat /sys/class/net/eth0/operstate returns unknown when I call it I think I might be confusing different layers of the networking interface here But I have no idea ho wto get the device to switch over to the wvdial ( ppp0 ) connection when the primary interface fails.does anyone have any suggestions or solutions to this ? Link to comment Share on other sites More sharing options...
petrmaje Posted September 18, 2015 Share Posted September 18, 2015 Hi, there is more cases, how the interface can be down. It can be physicaly unpluged, it can be can be up, but without connection to the internet etc. If you want real failover connection, you have to write some script, which will check connection availability. Something like this: if ping -I eth0 8.8.8.8 then ip route change default via eth0 gateway else ip route change default via ppp0 gateway I did this for my friend a time ago and it works fine. Link to comment Share on other sites More sharing options...
Igor Posted September 18, 2015 Share Posted September 18, 2015 Check bonding interfaces. There is an example in /etc/interfaces Link to comment Share on other sites More sharing options...
Recommended Posts