When I connect to VPN as client, ping to Local IP goes to tun0 not to eth0

Hello everyone. Happy new year.

I'm a beginner, so I don't know how to explain about my problem.
Please understand even if it's frustrating.

I have an old TV-BOX bought from eBay. The model name is XNANO X5.
It is very similar with ziddo X8S or X9S.
It has Realtek RTD1295 based OPENWRT 15.05.1 and Android 6.0 dual OS system.
It boots simultaneously with Android and openwrt.

It is connected to home internet router(gw:192.168.0.1) and Local IP is 192.168.0.5
And OpenVPN Client app is installed on Android side.

And my problem is :
When VPN is connected, ping to Local IP goes to tun0 not to eth0.

Please give me some advice.

Thanks!

My ssh result:

========================================================
root@OpenWrt:~# ping -c 1 www.google.com        // OK
PING www.google.com (172.217.175.100): 56 data bytes
64 bytes from 172.217.175.100: seq=0 ttl=115 time=37.780 ms


root@OpenWrt:~# ping -c 1 -I tun0 www.google.com        // OK
PING www.google.com (172.217.175.100): 56 data bytes
64 bytes from 172.217.175.100: seq=0 ttl=115 time=37.760 ms


root@OpenWrt:~# ping -c 1 -I eth0 www.google.com        // OK
PING www.google.com (172.217.175.100): 56 data bytes
64 bytes from 172.217.175.100: seq=0 ttl=113 time=57.115 ms


root@OpenWrt:~# ping -c 1 -I eth0 192.168.0.1        // OK
PING 192.168.0.1 (192.168.0.1): 56 data bytes
64 bytes from 192.168.0.1: seq=0 ttl=64 time=1.030 ms


root@OpenWrt:~# ping -c 1 -I tun0 192.168.0.1        // OK fail, but this is normal
PING 192.168.0.1 (192.168.0.1): 56 data bytes
^C
--- 192.168.0.1 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss


root@OpenWrt:~# ping -c 1 192.168.0.1                   // goes to tun0
PING 192.168.0.1 (192.168.0.1): 56 data bytes
^C
--- 192.168.0.1 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
========================================================
root@OpenWrt:~# ip ro
default via 192.168.0.1 dev eth0  metric 202
10.x.xx.0/24 dev tun0  proto kernel  scope link  src 10.x.xx.149
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.5
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.5  metric 202

root@OpenWrt:~# ip ru
0:      from all lookup local
10000:  from all fwmark 0xc0000/0xd0000 lookup 99
10500:  from all oif eth0 lookup 1002
11000:  from all iif tun0 lookup 97
12000:  from all fwmark 0xc0065/0xcffff lookup 1005
12000:  from all fwmark 0x0/0x20000 iif lo lookup 1005
13000:  from all fwmark 0x10063/0x1ffff lookup 97
13000:  from all fwmark 0x10064/0x1ffff lookup 1002
13000:  from all fwmark 0x10065/0x1ffff lookup 1005
13000:  from all fwmark 0x10065/0x1ffff lookup 1005
14000:  from all oif eth0 lookup 1002
14000:  from all oif tun0 lookup 1005
15000:  from all fwmark 0x0/0x10000 lookup 99
16000:  from all fwmark 0x0/0x10000 lookup 98
17000:  from all fwmark 0x0/0x10000 lookup 97
19000:  from all fwmark 0x64/0x1ffff lookup 1002
21000:  from all fwmark 0x65/0x1ffff lookup 1002
22000:  from all fwmark 0x0/0xffff lookup 1002
23000:  from all fwmark 0x0/0xffff lookup main
32000:  from all unreachable

root@OpenWrt:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether c4:4e:**:**:**:** brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.5/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::c64e:****:****:****/64 scope link
       valid_lft forever preferred_lft forever
3: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN group default
    link/gre 0.0.0.0 brd 0.0.0.0
4: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
5: tun0: <POINTOPOINT,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 500
    link/none
    inet 10.x.xx.149/24 scope global tun0
       valid_lft forever preferred_lft forever

root@OpenWrt:~# ip ro show table all
default via 192.168.0.1 dev eth0  table 1002  proto static
192.168.0.0/24 dev eth0  table 1002  proto static  scope link
default dev tun0  table 1005  proto static  scope link
10.x.xx.0/24 dev tun0  table 1005  proto static  scope link
default via 192.168.0.1 dev eth0  metric 202
10.x.xx.0/24 dev tun0  proto kernel  scope link  src 10.x.xx.149
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.5
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.5  metric 202
broadcast 10.x.xx.0 dev tun0  table local  proto kernel  scope link  src 10.x.xx.149
local 10.x.xx.149 dev tun0  table local  proto kernel  scope host  src 10.x.xx.149
broadcast 10.x.xx.255 dev tun0  table local  proto kernel  scope link  src 10.x.xx.149
broadcast 127.0.0.0 dev lo  table local  proto kernel  scope link  src 127.0.0.1
local 127.0.0.0/8 dev lo  table local  proto kernel  scope host  src 127.0.0.1
local 127.0.0.1 dev lo  table local  proto kernel  scope host  src 127.0.0.1
broadcast 127.255.255.255 dev lo  table local  proto kernel  scope link  src 127.0.0.1
broadcast 192.168.0.0 dev eth0  table local  proto kernel  scope link  src 192.168.0.5
local 192.168.0.5 dev eth0  table local  proto kernel  scope host  src 192.168.0.5
broadcast 192.168.0.255 dev eth0  table local  proto kernel  scope link  src 192.168.0.5
unreachable default dev lo  proto kernel  metric 4294967295  error -101 pref medium
unreachable default dev lo  proto kernel  metric 4294967295  error -101 pref medium
unreachable default dev lo  proto kernel  metric 4294967295  error -101 pref medium
fe80::/64 dev eth0  table 1002  proto kernel  metric 256  pref medium
unreachable default dev lo  proto kernel  metric 4294967295  error -101 pref medium
unreachable default dev lo  table 1005  proto static  metric 1024  error -101 pref medium
unreachable default dev lo  proto kernel  metric 4294967295  error -101 pref medium
unreachable default dev lo  proto kernel  metric 4294967295  error -101 pref medium
local ::1 dev lo  table local  proto none  metric 0  pref medium
local fe80:: dev lo  table local  proto none  metric 0  pref medium
local fe80::c64e:****:****:**** dev lo  table local  proto none  metric 0  pref medium
ff00::/8 dev eth0  table local  metric 256  pref medium
unreachable default dev lo  proto kernel  metric 4294967295  error -101 pref medium

Try disabling that PBR/mwan3 which is apparently configured incorrectly.

Thanks for quick answer. :slightly_smiling_face: However, this device cannot install additional packages because the support link is closed and PBR/mwan3 is not installed. May I know where I can download the package for RTD1295?

ls -1 /etc/rc.d
root@OpenWrt:~# ls -1 /etc/rc.d
K00xeninit
K10sysstat
K50dropbear
K89log
K98boot
K99umount
S00sysfixtime
S05xeninit
S09realtek
S10boot
S10system
S11sysctl
S12log
S12rpcd
S15lvm2
S19btrfs-scan
S40fstab
S50cron
S50dropbear
S50telnet
S50uhttpd
S60dbus
S60samba
S60xl2tpd
S61avahi-daemon
S90sysstat
S95done
S95wsdd
S96led
S98sysntpd
S99aria2
S99igmpproxy
S99transmission

That's weird, but you still need to clarify which method is utilized to create the routing rules.
Properly configured PBR should prioritize routing for local subnets as explained here:
https://openwrt.org/docs/guide-user/network/routing/basics#policy-based_routing

Be aware that neither this device, nor its SOC as a whole are supported by OpenWrt, needing considerable changes to support the hardware (probably relying on proprietary kernel modules) and to add all the 'media box' userspace (OpenWrt doesn't ship with anything akin to a local GUI or media players). So whatever you're working with, it only has very little (close to nothing) in common with OpenWrt as we know it, accordingly we are not the correct support forum to help you with issues about this hardware and its Frankenstein firmware.

Your post does not appear to be related to an officially released OpenWrt version, package or supported operation.

It is unlikely that you will receive useful input here.

Please seek advise from the relevant maintainer.

OK, I undersatnd. Thanks for rely.

Yes, that's right. This is a very weir case.
The condition of Android and Openwrt is being shared in real time.
And thanks for the advice. :grinning:
I was able to find a solution after reading the document.

Solution:

ip ro del default
ip ru add lookup main
root@localhost:~# ip ro get to 192.168.0.1
192.168.0.1 dev eth0  src 192.168.0.5

root@localhost:~# ip ro get to 8.8.8.8
8.8.8.8 dev tun0  src 10.*.*.40

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.