join ad hoc network - Android Apps and Games

Hello all,
I have android 4.2.2 ,Nexus 4
I would like to setup adhoc network .
Firstly I rooted the device,
secondly I tried to create adhoc network in android phone :
I create ad hoc network in an android smartphone with this:
-------------------
[email protected]:/ # ip link set dev wlan0 down
[email protected]:/ # iwconfig wlan0 mode ad-hoc
[email protected]:/ # iwconfig wlan0 channel 6
[email protected]:/ # iwconfig wlan0 essid 'Test1'
[email protected]:/ # ip link set dev wlan0 up
[email protected]:/ # ifconfig wlan0 192.168.65.129
---------------
when I typed iwconfig wlan0:
the result is:
result1:
-----------------
Qcom:802.11n ESSID:"Test1"
Mode:Ad-Hoc Frequency:2.437 GHz Cell: 02:82:5F:C1:4B:C1
Bit Rate=0 kb/s Tx-Power=0 dBm
RTS thr=2347 B Fragment thr=8000 B
Encryption keyff
--------------
Secondly, in my laptop ,I could see "Test1",so I did connect to "Test1" and I configure static ip address 192.168.65.128.
in this case ,the smartphone create the ad hoc network and my laptop join it,then I can ping from my laptop to mobile and vice-versa.
However,in other case when :
my laptop create ad hoc network
and later in an android mobile ,I tried to join it :
-----------------
[email protected]:/ # iwconfig wlan0 mode ad-hoc
[email protected]:/ # iwconfig wlan0 channel 6
[email protected]:/ # iwconfig wlan0 essid 'Test1'
------------
But,when I type iwconfig wlan0 ,essid still off/any
result2:
Qcom:802.11n ESSIDff/any
Mode:Ad-Hoc Frequency:2.437 GHz Cell: Not-Associated
Bit Rate:0 kb/s Tx-Power=0 dBm
RTS thr=2347 B Fragment thr=8000 B
Encryption keyff
it seems that android mobile can create ad hoc network but can not join existing one.
so the same result I found when I try to setup adhoc network between two android mobiles:
in both android mobiles I typed :
--------------
[email protected]:/ # ip link set dev wlan0 down
[email protected]:/ # iwconfig wlan0 mode ad-hoc
[email protected]:/ # iwconfig wlan0 channel 6
[email protected]:/ # iwconfig wlan0 essid 'Test1'
[email protected]:/ # ip link set dev wlan0 up
-------------------
for the first one I configure
[email protected]:/ # ifconfig wlan0 192.168.65.129
the second one:
[email protected]:/ # ifconfig wlan0 192.168.65.127
so the result of iwconfig wlan0:
in the first one: like result1
in the second android smartphone :like result2
and of course ,I can't ping from one to other.
in brief,it seems that in android smartphone I can create adhoc network but I can't join existing one.
can anybody tell me what it's wrong here,and if there is any possible solution,
I tried many methods to setup ad hoc network in my android mobiles,and only this method that it seems work,but it still something wrong that prevent android phone to join existing ad hoc network.

Related

[Q] wifi 3g/4g simultaneously

I want to do MPTCP.
I've tried many ways to let them work at the same time.
But I still can't use them.
I use adb shell.
First, I let 3g always on, and turn off the wifi
then,
netcfg wlan0 up
wpa_supplicant -B -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
but in here, i use 'netcfg' to see the network informantion
I can't get the WiFi's IP address, I only can get 3G IP or WiFi IP
http://forum.xda-developers.com/showthread.php?t=2197776
http://forum.xda-developers.com/showthread.php?t=1640472
Code:
# enable dual-networking:
pkill dhcpcd
svc wifi disable
svc data enable
netcfg wlan0 up
cd /data/misc/wifi/.
wpa_supplicant -B -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
dhcpcd wlan0
ip route add x.x.x.x via x.x.x.y # add any desired local route
I use dhcpcd wlan0
「Version 5.5.6 Starting,
wlan0: waiting for carrier
timed out
allowing 8 seconds for IPv4LL timeout
timed out 」
so, how can I get the dual networks IP address?

wired networking without DHCP

I suspect I'm not the only person with a wired network adapter - and some of us may be trying to do things like configure routers, etc, where there's no active DHCP server.
I was in this situation a couple of days ago, configuring a dd-wrt box with DHCP turned off.
The best how-to I found was at this entry at HeadlessAndroid
This could be "old hat" to everybody here (other than me), but, for most of my android devices, if I'm in the terminal, I'm connected via "adb terminal" so I've never needed to do this - and ifcfg does not work the way I'd have expected.
Hope this helps someone...
Networking on a Headless Android System
Android isn't the most intuitive environment for setting up networking on the command line. After playing with several different options here's what I've found.
Summary
# netcfg eth0 dhcp
# route add default gw 192.168.0.1 dev eth0
# setprop net.dns1 208.67.222.222
# setprop net.dns2 208.67.222.220
Details
The Android tools are quite different from the tools found on other embedded Linux systems, so most people I've talked to have had difficulty figuring out what utilities to use and how to use them. The most interesting one is ifconfig. When you type ifconfig on an Android system nothing happens. On a standard busybox or gnu based Linux system you will see the available networking interfaces and their associated settings (ok, technically ifconfig -a will show you that information). Since ifconfig doesn't show anything, most people assume (incorrectly) that it doesn't work.
On my development platform, to set a static IP address, I did the following:
# ifconfig eth0 192.168.0.84 netmask 255.255.255.0
Which didn't give any response, but DID show the following when I did netcfg.
# netcfg
lo UP 127.0.0.1 255.0.0.0 0x00000049
eth0 UP 192.168.0.84 255.255.255.0 0x00001043
usb0 DOWN 0.0.0.0 0.0.0.0 0x00001002
tunl0 DOWN 0.0.0.0 0.0.0.0 0x00000080
gre0 DOWN 0.0.0.0 0.0.0.0 0x00000080
sit0 DOWN 0.0.0.0 0.0.0.0 0x00000080
So what about DHCP you may ask?
# netcfg eth0 dhcp
Which yields the following.
# netcfg
lo UP 127.0.0.1 255.0.0.0 0x00000049
eth0 UP 192.168.0.227 255.255.255.0 0x00001043
usb0 DOWN 0.0.0.0 0.0.0.0 0x00001002
tunl0 DOWN 0.0.0.0 0.0.0.0 0x00000080
gre0 DOWN 0.0.0.0 0.0.0.0 0x00000080
sit0 DOWN 0.0.0.0 0.0.0.0 0x00000080
Just because you have an IP address now doesn't mean the applications on your Android device can get to the network. For that you have to set a default route and set the DNS resolver addresses. Again, with route keep in mind it won't show the usual output that a standard busybox or gnu based embedded Linux system would show.
To set the default route:
# route add default gw 192.168.0.1 dev eth0
And to set the DNS (I'm using OpenDNS addresses here):
# setprop net.dns1 208.67.222.222
# setprop net.dns2 208.67.222.220
And that allows the holy grail of a DNS resolved ping to a domain on the Internet.
# ping google.com
PING google.com (74.125.224.134) 56(84) bytes of data.
64 bytes from nuq04s09-in-f6.1e100.net (74.125.224.134): icmp_seq=1 ttl=57 time=41.5 ms
64 bytes from nuq04s09-in-f6.1e100.net (74.125.224.134): icmp_seq=2 ttl=57 time=43.2 ms
References
I found some great information in the following links.
http://www.anddev.org/advanced_networking_with_android-linux-t155.html
http://elinux.org/Android_Networking
Click to expand...
Click to collapse

Nexus 5 - Android L wifi tethering fix

Thanks to @buraktamturk here
Here is solution for tethering (both usb and wireless).
Tether just as usual. Then disable tethering and re-enable it. (this step is important otherwise dhcp server is not started)
After doing that both your phone and computer will not connect internet, because of invalid routing table. (internal bug from l preview)
just connect to the phone shell with 'adb shell', or terminal software on android (connectbot or android terminal emulator will fine)
Code:
[email protected]:/ $ su
[email protected]:/ # ip route | grep rmnet0 | grep link
10.64.70.120/29 dev rmnet0 proto kernel scope link src 10.64.70.124
Note the gateway here (10.64.70.124), and set this default gateway. (and yes, my provider gives me nat'ed private ip addresses)
Code:
[email protected]:/ # route add default gw 10.64.70.124 dev rmnet0
Enjoy the tethering!

[Q] USB Ethernet dongle on Samsung Lollipop

Hi,
I'm trying to run my USB Ethernet dongle with my S4 LTE+ (GT-I9506 Lollipop), but aplications in the phone and other computers on the network didn't see that connection.
My tryings:
[email protected]:/ # netcfg eth0 up
[email protected]:/ # netcfg eth0 dhcp
[email protected]:/ # netcfg|grep eth0
eth0 UP 10.0.0.12/24 0x00001043 f0:25:b7:20:af:75
[email protected]:/ # ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=1.96 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=2.05 ms
64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=1.87 ms
[email protected]:/ # ping www.google.com
ping: unknown host www.google.com
2|[email protected]:/ # nslookup www.google.com
Server: 8.8.4.4
Address 1: 8.8.4.4 google-public-dns-b.google.com
Name: www.google.com
Address 1: 2a00:1450:4013:c01::93 ea-in-x93.1e100.net
Address 2: 74.125.136.104 ea-in-f104.1e100.net
Address 3: 74.125.136.103 ea-in-f103.1e100.net
Address 4: 74.125.136.99 ea-in-f99.1e100.net
Address 5: 74.125.136.105 ea-in-f105.1e100.net
Address 6: 74.125.136.147 ea-in-f147.
I've found this but it also doesn't work:
ndc network create 100
ndc network interface add 100 eth0
ndc network route add 100 eth0 <GATEWAY>/24
ndc network route add 100 eth0 0.0.0.0/0 <DNS1> <DNS2>
ndc resolver setnetdns 100 localdomain <DNS1> <DNS2>
ndc network default set 100
Any suggestions?
Thx

setting up Ethernet connection (progress report)

Hello, I'm attempting to setup up ethernet on my G920F using bobjgear usb 2.0 ethernet adapter.
Here is my progress:
1. Rooted with Xtrestolite 5.1.1, Vindicator kernel, busybox.
2. app to turn on eth0 is called "Ethernet Droid":
-assigned IP (within range) (192.168.1.67)
-assigned default gateway (192.168.1.254)
-assigned subnetmask (255.255.255.0)
-NOT assigned DNS
3. terminal emulator shows eth0 as UP with the IP assigned.
4. my ATT U-verse router shows a device connected with the assigned IP.
in terminal emulator when typing:
# netcfg eth0 dhcp
I get:
# action 'dhcp' failed (operation not permitted)
in terminal emulator when typing:
# ifconfig eth0
I get:
# eth0: ip 192.168.1.254 mask 255.255.255.0 flags [up broadcast running multicast]
in terminal emulator when typing:
# ping -c 4 192.168.1.254
I get:
# connect: Network is unreachable
-----------------------------------------
This is as far as I've been able to get, any further progress would be greatly appreciated, as I'm really trying to set up ethernet chromecast with a portable router for display out. A lot of people have complained of the lack of MHL and HDMI support which was really a shock to me when I found out...
I'm not a coder, nor an export on linux, so any help please keep the instructions simple and clear, thank you really truly.
sergeivich said:
# ping -c 4 192.168.1.254
I get:
# connect: Network is unreachable
Click to expand...
Click to collapse
I guess this is a Android 5.x bug or missing permission.
Please try the following:
1. su (in your terminal)
2. netcfg eth0 dhcp (this should work as superuser)
3. exit
4. ping your IP of your mobile phone ping -c4 192.168.1.XXX (this should work)
5. su
6. ping your gateway ip ping -c 4 192.168.1.YYY (this should work as superuser)
7. exit
8. ping your gateway ip ping -c 4 192.168.1.YYY (do you get now: android connect network is unreachable ?)
Until CM11 (Android 4.4.4) I could use my eth0 interface as normal user for everything. In oder to switch between wlan0 and eth0 you can use the ethernet-2.XX.apk. Some APPs absolutely want wlan0. For these APPs you could install one of the xposed framework modules HACK CONNECTIVITY SERVICE 1.4 or Fake Wifi Connection
BUT obviously since CM12 (Android 5.x) I have the same problem as you:
BUG/missing permissions? eth0 (USB->LAN) interface only usable as root user in terminal since CM12
When I try to ping my router ping 192.168.1.1 or any internet IP I get a android connect network is unreachable.
The only IP-adrress I can ping as normal user is my own IP-adress of the eth0 interface (for expample 192.168.1.XX).
After login as root with the su command in the terminal I can ping the router IP and every internet IP.
Even disabling the iptables filters/firewall did not help.
When I switch to the wlan0 interface I can ping everything with my normal user and the internet connection is available for every app.
My configuration:
S3 i9300, asix USB-LAN adapter, kernel: boeffla 4.0-alpha-11-CM12.1, cm-12.1-20150825-UNOFFICIAL-i9300.zip
Hello, any progress on the ethernet connectivity? Would any of the M or N roms support this?
Try this:
Hi
Have you tried this (for Lollipop):
Code:
ndc resolver setnetdns eth0 "" 8.8.8.8 8.8.4.4
I had the same problem as you and this solved the problem on Galaxy Note 4 with 5.1.1 (was able to ping 8.8.8.8 and 8.8.4.4 but not google.com. after typing this in the terminal, the ping worked !)
However, I am stuck at a step further: Even with this, it seems all apps do not recognize the internet connection through ethernet (no problem with WiFi).
I am pretty sure that it's not a matter of ConnectivityHackService or Fake Wifi (that I have installed by the way), since I have the problem for all the apps I was able to check (many).
Does anyone know how to solve this ?

Categories

Resources