I want my ppp0 connection to have higher priority over wlan0. I added following lines to /etc/network/interfaces file.
iface wlan0 inet dhcp
up ifmetric wlan0 20
----------------------------------------------------------------------------
#route table after modifying
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.43.1 0.0.0.0 UG 20 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 20 0 0 wlan0
192.168.43.0 0.0.0.0 255.255.255.0 U 20 0 0 wlan0
220.224.141.145 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
As you can see, metric of wlan0 changed to 20, but still it is preferred over ppp0 as default gateway. When i checked man page of route, it was mentioned "metric was not used by recent kernels".
I can change the route manually by deleting the unwanted gw and adding ppp0 as gw. But when wlan0 disconnects and reconnects, the routing table changed to default. How could i set my ppp0 as default gw permanently?