USB tethering and WIFI tethering problems - Android Q&A, Help & Troubleshooting

I have a desktop PC without wireless nic, so I connect my mobile phone XiaoMi Redmi4 prime to PC via usb cable enabling USB tethering .
I have a ipad, and I want to transfer some video from PC to ipad via WIFI, so I enabled wifi tethering on Redmi4. But I just can ping ipad from PC.
IP:
Redmi4 - 192.168.42.129 / 192.168.43.1
PC - 192.168.42.241
iPad - 192.168.43.14
I have the root shell access on Redmi4, here is route table in Redmi4 :
[email protected]:/ # route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.177.95.72 * 255.255.255.248 U 0 0 0 rmnet_data0
192.168.42.0 * 255.255.255.0 U 0 0 0 rndis0
192.168.43.0 * 255.255.255.0 U 0 0 0 wlan0
I tried to add static route on Redmi4 as default gateway, but still not working.
I also tried to clear all iptables rules by typing : iptables -F, still not working.
So anyone who knows how to fix this?

Any one who can help me ?

Related

[Q] Android USB reverse tethering: How to fool the apps

USB reverse tethering = Cellphone gets network connection from PC via USB.
I know how to do USB reverse tethering except for one problem: Many Android apps will check network connection using the code below before doing any useful work:
Code:
ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = connectivityManager.getActiveNetworkInfo();
The problem is that, when using USB reverse tethering, the above code will report no network connection. However, there IS a network connection (which is the USB reverse tethering itself), and ping, wget and all programs not doing this stupid check work well.
So the question is: How can I hack the system to let this network connection check return success (so that I can fool these apps)?
BTW. I use Cyanogenmod 7. And any solution specific to this MOD is also welcome.
Hello,
Could you please tell me how did you do the USB reverse tethering? Since on USB connection there is no option to do that under CM 7.1?
...
Thank you. Unfortunately the binary /system/bin/netsharing is not part of CM7.1, apparently it exists with Sense ROM. How do you manage to run it under CM7.1?
Sense ROM has the reverse USB tether built-in ("Internet passthrough"), maybe if the 2 commands could be executed, thanks to existing HTC NDIS driver doing NAT inside the PC it will work?
I've tested in CM7 that netsharing is not needed. Just execute the rest of the commands will be OK. Of course you need to do NAT on the PC because what you've setup is just a small LAN with private IP addresses.
Thank you for your input.
What I understand:
1- connect the phone via USB cable, choose charge only
2- Assuming my router has IP 192.168.1.1:
So I have to type these commands, could you confirm?
Code:
echo 4 > /sys/devices/platform/msm_hsusb/usb_function_switch
route add default gw 192.168.1.1
ifconfig usb0 192.168.1.1 mtu 500 up
But then how to do the NAT thing is out of my knowledge!
In fact what I want is when there is no router (since mine is wireless) with available Internet connetion
(ADSL line down). So I have to use USB 56kbps modem with telephone line to access Internet from the PC (running XP).
And I would like to plug the Android phone with USB cable and allow the phone to access Internet (Internet sharing
with the PC). I am not sure of the operations to do then.
Sorry but I don't know how to set up NAT on Windows XP... I use Linux and a simple iptables command suffices:
Code:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Issue on inetd for N1

I add and configured /etc/inetd.conf, line data like:
8888 stream tcp nowait root micro_httpd /sdcard/www/
then run inetd.
#netstat -an |grep LIS
tcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN
but when i telnet 127.0.0.1 8888, i got "Connection closed by foreign host".
micro_httpd standalone run is ok.
what's the problem?
Thanks
Eagle

[Q] openvpn issues

Hey everybody,
on my "normal" linux computer, I am using openvpn with the following config file:
Code:
port 1194
proto tcp-client
dev tap
tls-client
remote xxxxxxxx.dyndns.org 1194
ca /some/path/to/ca-certificate.crt
cert /some/path/to/certificate.crt
key /some/path/to/key.pem
cipher AES-256-CBC
comp-lzo
pull
ping 15
ping-restart 120
resolv-retry 60
verb 4
Now, from my computer, everything works fine.
Having applied the exact same config file to my Flyer, I am getting routing issues:
(Of course, I have changed the paths to the certificates)
Code:
[COLOR="Blue"]openvpn.log[/COLOR]:
Sun Jan 1 10:51:38 2012 us=60137 ROUTE default_gateway=192.168.150.1
Sun Jan 1 10:51:38 2012 us=72222 TUN/TAP device tap0 opened
Sun Jan 1 10:51:38 2012 us=72374 TUN/TAP TX queue length set to 100
Sun Jan 1 10:51:38 2012 us=72496 /system/xbin/bb/ifconfig tap0 10.0.0.2 netmask 255.255.255.0 mtu 1500 broadcast 10.0.0.255
Sun Jan 1 10:51:38 2012 us=75426 OpenVPN ROUTE: omitted no-op route: 10.0.0.1/255.255.255.255 -> 10.0.0.1
Sun Jan 1 10:51:38 2012 us=75731 [COLOR="Red"]/system/xbin/bb/route add -net 192.168.0.0 netmask 255.255.255.0 gw 10.0.0.1[/COLOR]
Sun Jan 1 10:51:38 2012 us=79393 Initialization Sequence Completed
Code:
/system/xbin/bb # [COLOR="Blue"]route[/COLOR]
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.150.1 * 255.255.255.255 UH 0 0 0 eth0
[COLOR="Red"]10.0.0.0 * 255.255.255.0 U 0 0 0 tap0[/COLOR]
192.168.150.0 * 255.255.255.0 U 311 0 0 eth0
[COLOR="Red"]192.168.0.0 10.0.0.1 255.255.255.0 UG 0 0 0 tap0[/COLOR]
default 192.168.150.1 0.0.0.0 UG 0 0 0 eth0
default 192.168.150.1 0.0.0.0 UG 311 0 0 eth0
Code:
/system/xbin/bb # [COLOR="Blue"]ip route[/COLOR]
192.168.150.1 dev eth0
[COLOR="Red"]10.0.0.0/24 dev tap0 src 10.0.0.2[/COLOR]
192.168.150.0/24 dev eth0 src 192.168.150.193 metric 311
[COLOR="Red"]192.168.0.0/24 via 10.0.0.1 dev tap0[/COLOR]
default via 192.168.150.1 dev eth0
default via 192.168.150.1 dev eth0 metric 311
Code:
/system/xbin/bb # [COLOR="Blue"]traceroute 10.0.0.1[/COLOR]
traceroute to 10.0.0.1 (10.0.0.1), 30 hops max, 38 byte packets
1 192.168.150.1 (192.168.150.1) 7.935 ms 5.737 ms 4.852 ms
2 * * *
3 92.72.0.1 (92.72.0.1) 21.607 ms !A 21.424 ms !A 21.668 ms !A
Code:
/system/xbin/bb # [COLOR="Blue"]traceroute 192.168.0.1[/COLOR]
traceroute to 192.168.0.1 (192.168.0.1), 30 hops max, 38 byte packets
1 192.168.150.1 (192.168.150.1) 6.012 ms 9.369 ms 5.554 ms
2 * 92.72.0.1 (92.72.0.1) 25.727 ms !A 21.209 ms !A
Anyone able to give me a hand? Much appreciated!

[Q] Ethernet permission

Hi. I have this devices HW:
My Devices: goo.gl/gz4BDs
Adapter: goo.gl/Zhfvpz
I have manualy installed driver for USB adapter to the my MiniPC. Ethernet is launched after boot over new script file: system/etc/eth1.sh
Code:
#!/system/bin/sh
netcfg eth1 dhcp
setprop net.dns1 8.8.8.8
setprop net.dns2 4.4.4.4
route add default gw 1.0.0.1 dev eth1
Android write message ( internet not connection) but internet is working ok. I can browse on the web and applications like speedtest are working ok.
BUT!
I can't download apps from google play (waiting for network), Google Maps don't work and web browser cannot save any files (pdf, zip,...). Over WiFi is everything ok, problems are only over adapter eth1.
Any ideas about problem?
Maybe some permission for eth1 device?

Android usbnet networking setup

Hello there!
I have android 10 based device and I have troubles with configuring usbnet device automatically.
I've modified kernel config, added `CONFIG_USB_USBNET=y` etc. Now I have usb0 device, and I can assign ip and routing to it, but it seems that there is another layer of networking setup in android: utility named ndc.
I tried next script:
```
ip link set usb0 up
ip addr add 192.168.1.2/24 dev usb0
ndc network create 101
ndc network interface add 101 usb0
ndc network route add 101 usb0 192.168.1.0/24
ndc network default set 101
```
Now I can ping device on the other side of usb0 interface but I'm losing wlan0 connection. Sure I can do next:
```
ndc network interface add 101 wlan0
ndc network route add 101 wlan0 0.0.0.0/0 10.0.0.1
ndc resolver setifdns wlan0 8.8.8.8 8.8.4.4
```
I also tried to modify default ROM:
uncomment in frameworks/base/core/res/res/values/config.xml
```
<string translatable="false" name="config_usb_ethernet_iface_regex">usb\\d</string>
<!-- Configuration of Ethernet interfaces in the following format:
<interface name|mac address>;[Network Capabilities];[IP config];[Override Transport]
Where
[Network Capabilities] Optional. A comma seprated list of network capabilities.
Values must be from NetworkCapabilities#NET_CAPABILITIES_* constants.
[IP config] Optional. If empty or not specified - DHCP will be used, otherwise
use the following format to specify static IP configuration:
ip=<ip-address/mask> gateway=<ip-address> dns=<comma-sep-ip-addresses>
domains=<comma-sep-domains>
[Override Transport] Optional. An override network transport type to allow
the propagation of an interface type on the other end of a local Ethernet
interface. Value must be from NetworkCapabilities#TRANSPORT_* constants. If
left out, this will default to TRANSPORT_ETHERNET.
-->
<string-array translatable="false" name="config_ethernet_interfaces">
<!--
<item>eth1;12,13,14,15;ip=192.168.0.10/24 gateway=192.168.0.1 dns=4.4.4.4,8.8.8.8</item>
<item>eth2;;ip=192.168.0.11/24</item>
<item>eth3;12,13,14,15;ip=192.168.0.12/24;1</item>
-->
<item>usb0;13,14,15;ip=192.168.1.2/24;8</item> #this line
</string-array>
```
But no luck usb0 interface remain unconfigured after boot.
After that I can ping both usb0 peer and wlan0 direct gateway but default route(0.0.0.0/0) not working. Don't understand why...
In general, I have 2 questions:
1. how to automate IP configuration for usb0 network in time of building ROM?
2. how to make usb0 and wlan0 play well together? Ideally without creating new network via ndc etc.
3. Are there any manuals about network configuration?

Categories

Resources