2

I want to setup Multi gateway on my Ubuntu Machine. 1 for ethernet and another for USB tethering. After browsing, from the below reference

https://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System

I have configured my system according to that.

Configuration :

  1. Ethernet as my default route
  2. USB is configured through iproute2, taken reference from above mentioned site

Issue is I am unable to ping through USB interface.

$ ping -I usb0 www.google.co.in
PING www.google.co.in (173.194.117.88) from 192.168.42.122 usb0: 56(84) bytes of data.
icmp_seq=1 Destination Host Unreachable

But traceroute is not able to show the gateway correctly for both USB

$ traceroute -i usb0 173.194.117.88
traceroute to 173.194.117.88 (173.194.117.88), 30 hops max, 60 byte packets
1 192.168.200.254 (192.168.200.254)  1.956 ms  2.817 ms *
2 * * *
3 * * *


$ traceroute -i eth0 173.194.117.88
traceroute to 173.194.117.88 (173.194.117.88), 30 hops max, 60 byte packets
1  192.168.200.254 (192.168.200.254)  2.020 ms  2.870 ms  3.568 ms
2  10.251.0.1 (10.251.0.1)  21.041 ms  21.437 ms  21.988 ms

Routing Information

$ ip rou
default via 192.168.200.254 dev eth0  proto static 
169.254.0.0/16 dev eth0  scope link  metric 1000 
192.168.42.0/24 dev usb0  proto kernel  scope link  src 192.168.42.122      metric 1 
192.168.200.0/24 dev eth0  proto kernel  scope link  src 192.168.200.102    metric 1

$ ip route list table usbrt
default via 192.168.42.129 dev usb0 
192.168.42.0/24 dev usb0  scope link  src 192.168.42.122 

$ ip route list table usbrt
default via 192.168.42.129 dev usb0 
192.168.42.0/24 dev usb0  scope link  src 192.168.42.122 

$ ip -4 addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
 inet 192.168.200.102/24 brd 192.168.200.255 scope global eth0
4: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
inet 192.168.42.122/24 brd 192.168.42.255 scope global usb0


$ ip rule show
0:  from all lookup local 
32764:  from all to 192.168.42.122 lookup usbrt 
32765:  from 192.168.42.122 lookup usbrt 
32766:  from all lookup main 
32767:  from all lookup default
  • Please add both routing tables and the output of ip -4 addr show to your question by editing it. – Nephente Sep 29 '15 at 5:39
  • I have updated, please have a look into it, – ramakanth Sep 29 '15 at 17:58
  • Routing tables look fine. Did you add the proper rules, e.g ip rule add from 192.168.42.122/32 table usbrt. What's the output of ip rules show? – Nephente Sep 30 '15 at 8:23
  • please find the output for $ ip rule show in above edited "Routing Information". Regarding $ ip rule add. I used the same mentioned command by you. – ramakanth Sep 30 '15 at 18:04
1

Finally i got the answer. use "Interface_IP" instead of "Interface_name" in ping
example :
use

ping -i 192.168.42.122 www.google.co.in 

instead of

ping -i eth0 www.google.co.in 

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.