vpn - Android VpnService with multiple addresses and routes? -
i'm working on android version of app connect software defined networks. native code behind supports connecting multiple virtual networks @ time, , i'm adapting android's vpnservice.
since android limits single vpn interface, call vpnservice.builder.addaddress()
, vpnservice.builder.addroute()
once each virtual network, call establish()
. once establish()
called, can ping android device on each of assigned addresses other devices on 2 virtual networks, can routing 1 of virtual networks within android os.
is possible using vpnservice.builder assign multiple addresses , routes tun interface?
update: jun 15, 2015
things appear getting configured correctly. looking around in logs , via adb shell, have tun0 , tun0:1
# ifconfig tun0 tun0: ip 10.248.13.87 mask 255.255.240.0 flags [up point-to-point running] # ifconfig tun0:1 tun0:1: ip 29.182.13.87 mask 254.0.0.0 flags [up point-to-point running]
and both tun entries in routing table
iface destination gateway flags refcnt use metric mask mtu window irtt eth0 00000000 0202000a 0003 0 0 0 00000000 0 0 0 eth0 0002000a 00000000 0001 0 0 0 00ffffff 0 0 0 tun0 0000f80a 00000000 0001 0 0 0 00f0ffff 0 0 0 tun0 0000001c 00000000 0001 0 0 0 000000fe 0 0 0
however 1 of 2 routes accessible. here's ping 2 hosts on other end of vpn connection:
ping -c 4 10.248.4.247 ping 10.248.4.247 (10.248.4.247) 56(84) bytes of data. 64 bytes 10.248.4.247: icmp_seq=1 ttl=128 time=126 ms 64 bytes 10.248.4.247: icmp_seq=2 ttl=128 time=93.5 ms 64 bytes 10.248.4.247: icmp_seq=3 ttl=128 time=73.5 ms 64 bytes 10.248.4.247: icmp_seq=4 ttl=128 time=53.4 ms --- 10.248.4.247 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3029ms rtt min/avg/max/mdev = 53.492/86.826/126.702/27.026 ms root@generic_x86:/proc/net # ping -c 4 29.95.148.247 ping -c 4 29.95.148.247 ping 29.95.148.247 (29.95.148.247) 56(84) bytes of data. --- 29.95.148.247 ping statistics --- 4 packets transmitted, 0 received, 100% packet loss, time 3013ms
it appears i've run bug in android.
after digging through tcpdump logs on both ends of connection, found packets routed tun0:1 have source ip in ip header set ip address of tun0.
after writing code replace source ip , checksum in ip packets, icmp pings work. i'll need same tcp , udp packets.
Comments
Post a Comment