Along with eth0 I have a ppp0. When there is no internet(by pinging 22.214.171.124) I have to turn on the ppp0 and it then results into 2 default gateways..So I have to delete default gateway of eth0 to get internet working and this creates second problem as I have deleted eth0 gateway I am not able to detect if eth0 internet is up! for that I have to again add the eth0 gateway! I tried using iproute 2 table but it didn't worked! I am using NanoPi Neo..running Ubuntu Core qt embedded
Does the sudo ifconfig eth0 down after connecting ppp solve your issue?
Edit: In order to be able to detect eth0 connection you will need to bring it up again and disconnect the ppp. I can imagine when having both interfaces up, it can be solved with route command to change the default gateway with
sudo ip route del default
sudo ip route add default via 192.168.1.1
where 192.168.1.1 is your new gateway - replace this ip address with your own one.