I'll start by explaining the situation. I started My project using a raspberry Pi 2 model B and installed Fedora Arm on it. My current Goal is to be able to connect the pi to internet through an ethernet cable connected to a DSL router aswell as a 3G usb dongle in a way where I can set up a fail over mechanic.To do so I figured I need to make a script that checks if eth0 (ethernet connection) is working by issuing ping 8.8.8.8 -I eth0, if it isn't working I can switch to the 3G connection by taking down the eth0, and activating eth1 (3G dongle).Everything was fine and it is here that a problem showed up, I wanted to go back to Ethernet once it is back, but I had noway of doing so while my 3G connection was running (issuing ping 8.8.8.8 -I eth0 wasn t working even thought I brought up eth0)I had to take down eth1 so I could check if the internet connection is back on eth0.I've realized that when I have both interfaces up only one is active at a time and I can't ping the internet through both using ping 8.8.8.8 -I eth0'and 'ping 8.8.8.8 -I eth1 at the same time.my question is :Is it possible to ping through the two interfaces while both up?If yes then How?If not then I would apreciate any directive on what am trying to achieve.
Is it possible to ping 8.8.8.8 from two interfaces connected to diffrent WANs
networking
Apparently the problem is that by default, you can only have one default gateway on a system. The case described would lead to asynchronous routing.SolutionThe iproute2 program, which is included in all current Linux distributions and already installed even, as a rule, can be used for the solution of this problem. Normally, a Linux system only has one routing table, in which only one default gateway can make entries. With iproute2, you have the ability to setup an additional routing table, for one thing, and allow this table to be used by the system based on rules, for another.Initial PositionWe will assume that we have two interfaces: eth0 and eth1. The two networks that should be used are 192.168.0.0/24 and 10.10.0.0/24, whereby the first IP address in each respective network should be the gateway. The initial configuration would appear as follows. /etc/network/interfaces# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceallow-hotplug eth0iface eth0 inet static    address 192.168.0.10    netmask 255.255.255.0    gateway 192.168.0.1# The secondary network interfaceallow-hotplug eth1iface eth1 inet static    address 10.10.0.10    netmask 255.255.255.0Adding a Second Routing TableTo add a new routing table, the file, /etc/iproute2/rt_tables must be edited. We will call the routing table rt2 and set its preference to 1. The named file should then appear as follows.## reserved values#255     local254     main253     default0       unspec## local##1      inr.ruhep1 rt2Configuring the New Routing TableFrom this point, four commands are needed to achieve our goal. First, the new routing table needs to be populated, which is done using the following command.ip route add 10.10.0.0/24 dev eth1 src 10.10.0.10 table rt2ip route add default via 10.10.0.1 dev eth1 table rt2The first command says that the network, 10.10.0.0/24, can be reached through the eth1 interface. The second command sets the default gateway.Routing RulesSo that the system knows when to use our new routing table, two rules must be configured.ip rule add from 10.10.0.10/32 table rt2ip rule add to 10.10.0.10/32 table rt2These rules say that both traffic from the IP address, 10.10.0.10, as well as traffic directed to or through this IP address, should use the rt2 routing table. 