I have a wifi dongle where I have three interfaces wlan0
(default route), uvpn0
(VPN interface) and usb0
(interface between the host machine and the dongle).
usb0 Link encap:Ethernet HWaddr DA:CE:84:EA:A3:E3
inet addr:10.0.0.1 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::d8ce:84ff:feea:a3e3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:49190 errors:0 dropped:0 overruns:0 frame:0
TX packets:123259 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8718640 (8.3 MiB) TX bytes:150323744 (143.3 MiB)
uvpn0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.87.0.3 P-t-P:10.87.0.3 Mask:255.255.0.0
UP POINTOPOINT RUNNING MTU:1420 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:368 (368.0 B) TX bytes:1552 (1.5 KiB)
wlan0 Link encap:Ethernet HWaddr D0:17:69:EC:A2:E4
inet addr:10.117.176.210 Bcast:10.117.176.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:121589 errors:0 dropped:0 overruns:0 frame:0
TX packets:43659 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:143066201 (136.4 MiB) TX bytes:6608011 (6.3 MiB)
Currently, the internet traffic is go through the wlan0
interface. I want the internet traffic to go through the VPN server 10.87.0.1
. I tried the following things
- Change the default route by adding the following command
ip route add default via 10.87.0.1 dev uvpn0
The moment I added the above command. I am not able to ping to the VPN server from the dongle.
- I also added an IP rule
iptables -t nat -A POSTROUTING -s 10.117.176.0/24 -o uvpn0 -j MASQUERADE
What am I missing here?