I just read this article,
http://blog.mycila.com/2010/06/reverse-usb-tethering-with-android-22.html
and I'm stuck on step 3. I don't have Ubuntu. How can I Bridge the 2 network interfaces?
STEP 3:
On Linux Computer, setup a bridge:
# usb0 is the new network intreface
# eth0 is the main interface connected to internet (or a gateway)
sudo ifconfig eth0 0.0.0.0
sudo ifconfig usb0 0.0.0.0
sudo brctl addbr br0
sudo brctl addif br0 eth0
sudo brctl addif br0 usb0
sudo ifconfig br0 up
sudo dhclient br0
See https://help.ubuntu.com/community/NetworkConnectionBridge to setup bridges
On windows, Bridge the 2 network interfaces
Click to expand...
Click to collapse
Related
I've searched the Forums but couldn't find anything interesting which could solve my problem. I've installed Ubuntu on my Device and now I'd like to get my WiFi working. I have made the wpa_supplicant.conf file and pasted it in /etc/wpa_supplicant.
Now when I run
sudo wpa_supplicant -i eth0 -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf
It says:
Could not read interface eth0 flags: No such device.
Also, when I try to connect to an open network, typing:
sudo ifconfig eth0 down
The result is the same.
So what does
"Could not read interface eth0 flags: No such device."
mean and how can I get into the internet?
Thank You, I hope You can help me
Mr.Ox said:
I've searched the Forums but couldn't find anything interesting which could solve my problem. I've installed Ubuntu on my Device and now I'd like to get my WiFi working. I have made the wpa_supplicant.conf file and pasted it in /etc/wpa_supplicant.
Now when I run
sudo wpa_supplicant -i eth0 -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf
It says:
Could not read interface eth0 flags: No such device.
Also, when I try to connect to an open network, typing:
sudo ifconfig eth0 down
The result is the same.
So what does
"Could not read interface eth0 flags: No such device."
mean and how can I get into the internet?
Thank You, I hope You can help me
Click to expand...
Click to collapse
maybe it's not 'eth0'.
type:
sudo ifconfig -a
to see all interfaces.
fserve said:
maybe it's not 'eth0'.
type:
sudo ifconfig -a
to see all interfaces.
Click to expand...
Click to collapse
Ok, I'm going to give it a try, thank You!
Now is the problem, that I have to open the WICD Manager, but I haven't got it installed... How do i get it now? Without internet?
Hi guys,
I want to use my PC running on Ubuntu 12.04 64Bit to access the internet.
Usually in Windows i use the HTC tool.
my phone is not rooted.
thanks for help
??
39 views, 0 reply !!!!
Coz maybe the ones who viewed the thread didn't know a solution hence not answered
May be someone who uses Ubuntu world know...
Most of us user windows...
Sent from a Desire S waiting for Kernel 3. WAKE UP HTC!!!!
if u hv HTC sense on ur device, just tick the INTERNET PASS THROUGH option from the notification tab
and the system will do the rest
cheers
check out screenshot below
thanks for your replies
lynxnoon : yes I'v tried to do that, it will be connected to the PC but without internet connection.
ensure the adapters (esp the wired) are updated online and then try again.
Also ensure theres is pass through connection on ur fone and then try to browse with the in-built browser.
If all these still doesnt work then u have to find out if the internet service provider alllows tethering or the modem u r using.
cheers
Rabih-Sy said:
Hi guys,
I want to use my PC running on Ubuntu 12.04 64Bit to access the internet.
Usually in Windows i use the HTC tool.
my phone is not rooted.
thanks for help
Click to expand...
Click to collapse
When I connect my phone and choose internet passthrough, the phone chooses ip address in the 192.168.99.0/24. If yours creates a different subnet you will have to change below accordingly.
I hope this solves your problem.
Edit /etc/rc.local sudo nano /etc/rc.local and add the following:
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null
iptables -P FORWARD ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.99.0/24
iptables -A FORWARD -i eth0 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT
#forward all dns queries from usb0 to google's dns server
iptables -t nat -I PREROUTING -i usb0 -p udp --dport 53 -j DNAT --to 8.8.8.8
then at terminal type:
sudo /etc/rc.local
that will get you connectivity, but it will be short lived because htc is stupid and will disconnect if it doesn't detect the winblows htc software crap.
So you will need to fake it out. Turns out the phone is listening for htc software on port 6000 for 00 02 00 00 hex.
first you have to find the ip address of your phone (if arp doesn't work or you get command not found, you probably need to sudo arp):
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')
then you tell the phone that htc software is listening:
echo -n -e "\x00\x02\x00\x00" | nc $phoneip 6000 > /dev/null
To make that automagic each time us a script. Call it htcfaker or whatever:
#!/bin/bash
while :; do
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')
while [ -z $phoneip ]; do
sleep 15
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')
done
echo -n -e "\x00\x02\x00\x00" | nc $phoneip 6000 > /dev/null
while [ "$phoneip" != "" ]; do
sleep 15
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')
done
done
Then in your startup applications, point to that script.
Hope it helps!
I'm using unrooted HTC Sensation XE and Ubuntu 12.04 64-Bits, with these scripts Internet Pass Through works beautifully!:laugh::good:
haz3lnut said:
When I connect my phone and choose internet passthrough, the phone chooses ip address in the 192.168.99.0/24. If yours creates a different subnet you will have to change below accordingly.
I hope this solves your problem.
Edit /etc/rc.local sudo nano /etc/rc.local and add the following:
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null
iptables -P FORWARD ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.99.0/24
iptables -A FORWARD -i eth0 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT
#forward all dns queries from usb0 to google's dns server
iptables -t nat -I PREROUTING -i usb0 -p udp --dport 53 -j DNAT --to 8.8.8.8
then at terminal type:
sudo /etc/rc.local
that will get you connectivity, but it will be short lived because htc is stupid and will disconnect if it doesn't detect the winblows htc software crap.
So you will need to fake it out. Turns out the phone is listening for htc software on port 6000 for 00 02 00 00 hex.
first you have to find the ip address of your phone (if arp doesn't work or you get command not found, you probably need to sudo arp):
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')
then you tell the phone that htc software is listening:
echo -n -e "\x00\x02\x00\x00" | nc $phoneip 6000 > /dev/null
To make that automagic each time us a script. Call it htcfaker or whatever:
#!/bin/bash
while :; do
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')
while [ -z $phoneip ]; do
sleep 15
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')
done
echo -n -e "\x00\x02\x00\x00" | nc $phoneip 6000 > /dev/null
while [ "$phoneip" != "" ]; do
sleep 15
phoneip=$(arp -n | grep usb0 | awk 'BEGIN {FS=" "} {print $1}')
done
done
Then in your startup applications, point to that script.
Hope it helps!
Click to expand...
Click to collapse
Did anyone experienced the problem that this stopped working after a day or so?
When I plug into the phone now it just wont give a ipv4 address therefore theres nothing to re-route through the pc?
Mine still working without any problem after 2 months. I can only suggest you to check 2 things:
Ensure your /etc/rc.local file is not changed due to any Ubuntu update
You have to run the "htcfaker" script in Terminal before plugging in your phone. Do not close this Terminal until you want to disconnect.
fruity12 said:
Did anyone experienced the problem that this stopped working after a day or so?
When I plug into the phone now it just wont give a ipv4 address therefore theres nothing to re-route through the pc?
Click to expand...
Click to collapse
iptables table 'nat' not found while running sudo /etc/rc.local script
ykkhern said:
Mine still working without any problem after 2 months. I can only suggest you to check 2 things:
Ensure your /etc/rc.local file is not changed due to any Ubuntu update
You have to run the "htcfaker" script in Terminal before plugging in your phone. Do not close this Terminal until you want to disconnect.
Click to expand...
Click to collapse
I have updated /etc/rc.local file but I'm getting below error what needs to be done? I'm newbie to Linux, neverthless tried to look into many forums but couldn't get it resolved.. Please help !!
Code:
[email protected]:~$ sudo /etc/rc.local
[sudo] password for anvyal:
iptables v1.4.18: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
Please let me know if any other info needs to be provided. Thanks in advance for your help !!
anvyal said:
I have updated /etc/rc.local file but I'm getting below error what needs to be done? I'm newbie to Linux, neverthless tried to look into many forums but couldn't get it resolved.. Please help !!
Code:
[email protected]:~$ sudo /etc/rc.local
[sudo] password for anvyal:
iptables v1.4.18: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
Please let me know if any other info needs to be provided. Thanks in advance for your help !!
Click to expand...
Click to collapse
Please check the following line in your /etc/rc.local:
iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.99.0/24
You have to change the IP subnet (highlighted in red font above) to match your phone's IP address. If your phone use 192.168.1.2 for example, then you'll have to change the IP subnet to 192.168.1.0/24.
To find your phone's IP address, first connect your phone to your PC in USB Tethering mode. Then on your PC side open a Terminal and issue the command "arp" (without the quotes) which shall give you the IP address of your phone.
Good luck!:laugh:
Script update required for recent phones?
This script didn't work for me on my M8 - the Sync hex data seems to have grown, and just passing the \x00\x02\x00\x00 string caused the pass through to immediately disconnect with failure message "Either you do not have the latest version of HTC Sync Manager installed, or another phone is already using Internet pass-through on your PC".
Changing the line in the script as below fixes it:
Code:
echo -n -e "\x00\x02\x00\x00" | nc $phoneip 6000 > /dev/null
Code:
echo -n -e "\x00\x02\x00\x00\x00\x03\x00\x00\x00\x05\x00\x00" | nc $phoneip 6000 > /dev/null
I got this from vc0528.tumblr.com/post/71168788542/simulate-htc-sync-manager-via-usb-on-linux-os, which also has the alternative Perl script, which works a treat too:
Code:
#!/usr/bin/perl
use IO::Socket::INET;
#6000/tcp open X11
do{
open IN,”/proc/net/arp”; @arp=<IN>; close IN;
@d=grep ! /00:00:00:00:00:00/,grep /0x2.*usb0/,@arp;
} until($d[0]);
$_=$d[0]; s/\ .*//; chomp; print “sock:\t$_\n”;
my $sock = IO::Socket::INET->new(PeerAddr => $_ , PeerPort => 6000, Type=>SOCK_STREAM, Proto=>”tcp”) or die “Can not create socket [email protected]\n”;
print $sock “\x00\x02\x00\x00”;
print $sock “\x00\x03\x00\x00”;
print $sock “\x00\x05\x00\x00”;
close $sock;
Finally, if it helps anyone, I was wanting to set up a wifi range extender and so my IPtables was:
Code:
-A FORWARD -i wlan1 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i usb0 -o wlan1 -j ACCEPT
This might be a little whack, but I am pretty tired that Google hasn't released an ARM version of google voice and video chat that allows dialing out and making telephone calls over a data-only connection.
What I have done so far, is using a micro instance on Amazon AWS, is to set up a virtual machine that has a virtual sound card.
Right now I am using a VLC session to dial out.. I think with a greasemonkey script or something this could be improved.
There are 4 things that need to work.
1: User A (android) --Audio--> [VM]
2: User A (android) <--Audio-- [VM]
3: [VM] --Audio--> User B
4: [VM] <--Audio-- User B
Progress:
1. This is the big one right now, I'm not great with android dev but what I want to do is encode the audio out from the mic to SIP and transfer it to the VM using RDP and then reroute that audio to the virtual microphone. Will utilize some combination of ffmpeg/vlc/arecord/aplay
2: This works (sorta), the VM is generating a VLC stream that I can access on android through RTP
3: This works, Using the virtual sound card (aloop module) "arecord -D hw:0,1,0 -f cd -t raw | aplay -D hw:0,1,0 -f cd &" creates a loop back
4: This works, with the command above, the audio in from User B(4) is heard by User B(3)
Here are my notes (sorry they are a mess). I hope to turn this into a step-by-step walkthrough once I get it going a bit more. It would be great if someone could look it over. I know a ton can be optimized (lower latency, less bandwidth for codecs, etc)
PHP:
sudo add-apt-repository ppa:chromium-daily/ppa && sudo apt-get update
sudo add-apt-repository ppa:chromium-daily
sudo apt-get install build-essential alsa xorg chromium-browser tightvncserver pulseaudio
sudo apt-get install libmp3lame0(?) lame gnome-term(not sure if this is still needed, installed for rygel attempt at config)
# FROM
apt-get install libncursesw5-dev gettext xmlto
adduser phone
login vnc: install voice and video chat
# FROM
wget ht[xdanolikelinks]tps://dl.google.com/linux/direct/google-talkplugin_current_amd64.deb
dpkg -i --force-depends google-talkplugin_current_amd64.deb
apt-get -f install
cd /usr/src/modules
wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.25.tar.bz2
tar xjvf alsa-driver-1.0.25.tar.bz2
cd alsa-driver-1.0.25
./configure --with-cards=aloop --with-sequencer=yes ; make ; make install
wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.26.tar.bz2
tar xjvf alsa-lib-1.0.25.tar.bz2
cd alsa-lib-1.0.25
./configure ; make ; make install
wget ftp://ftp.alsa-project.org/pub/firmware/alsa-firmware-1.0.25.tar.bz2
tar xjvf alsa-firmware-1.0.25.tar.bz
./configure ; make ; make install
wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.26.tar.bz2
tar xjvf alsa-utils-1.0.26.tar.bz2
./configure ; make ; make install
modprobe snd-aloop ; modprobe snd-pcm-oss ; modprobe snd-mixer-oss ; modprobe snd-seq-oss
/etc/modprobe
# ALSA portion
alias char-major-116 snd
alias snd-card-0 snd-aloop
# module options should go here
# OSS/Free portion
alias char-major-14 soundcore
# OSS/Free portion - card #1
alias sound-slot-0 snd-card-0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
# OSS/Free portion - card #2 (cmipci)
alias sound-slot-1 snd-card-1
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-12 snd-pcm-oss
update-initramfs -u
#loopback audio
arecord -D hw:0,1,0 -f cd -t raw | aplay -D hw:0,1,0 -f cd &
-
Add pulseaudio headless to system startup
/etc/rc.local
su phone -c "vncserver :1 -geometry 800x600 -depth 8"
Configure xstartup for vnc server to start pulseaudio
nano /home/phone/.vnc/xstartup
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
pulseaudio -D
/etc/X11/Xsession
bashrc
pulseaudio -D
apt-get install vlc
edit vlc hosts file
nano /etc/vlc/lua/http/.hosts
Script: Screen server for cvlc audio routing
#!/bin/bash
screen -A -m -d -S cvlcserver cvlc -vvv pulse://alsa_output.0.analog-stereo.monitor --sout \
'#transcode{acodec=mpga,ab=32,channels:1}:rtp{sdp=rtsp://0.0.0.0:8080/test.sdp}'
echo 'Started, type screen -x to monitor'
Hi,
I have a problem on Android 4.3 and 4.4 phone (Samsung GT-I9500 and Google Nexus 10)
Phone sends DNS requests to DNS server address obtained via DHCP. But it ignores setup changes in setprorp 1 and setprorp 2.
do it:
Code:
adb shell
# setprop net.dns1 <ip1>
# setprop net.dns2 <ip2>
How to change DNS server?
How to add DNS server?
Info:
Code:
[email protected]:/ # getprop |grep dns
getprop |grep dns
[dhcp.wlan0.dns1]: [192.168.1.1]
[dhcp.wlan0.dns2]: []
[dhcp.wlan0.dns3]: []
[dhcp.wlan0.dns4]: []
[net.change]: [net.dns1]
[net.dns.search]: []
[net.dns1]: [192.168.1.1]
[email protected]:/ # setprop net.dns1 8.8.8.8
setprop net.dns1 8.8.8.8
[email protected]:/ # setprop net.dns2 4.4.4.4
setprop net.dns2 4.4.4.4
[email protected]:/ # setprop dhcp.wlan0.dns1 8.8.8.8
setprop dhcp.wlan0.dns1 8.8.8.8
[email protected]:/ # getprop |grep dns
getprop |grep dns
[dhcp.wlan0.dns1]: [8.8.8.8]
[dhcp.wlan0.dns2]: []
[dhcp.wlan0.dns3]: []
[dhcp.wlan0.dns4]: []
[net.change]: [net.dns2]
[net.dns.search]: []
[net.dns1]: [8.8.8.8]
[net.dns2]: [4.4.4.4]
[email protected]:/ # ping google.com
[email protected]:/ # tcpdump -ns0 -i wlan0 'port 53'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on br0, link-type EN10MB (Ethernet), capture size 65535 bytes
14:37:40.246226 IP 192.168.1.177.3551 > 192.168.1.1.53: 52272+ A? google.com. (28)
--
Thanks
Alexander
[Resolved]
Change your DNS servers in Android.
You can change the same thing on your rooted Android Device.
[email protected]:/ # ndc resolver flushif -- flushes old DNS servers
[email protected]:/ # ndc resolver flushdefaultif -- flush resolver
[email protected]:/ # ndc resolver setifdns <iface> <domains> <dns1> <dns2> ... -- Add the new servers
[email protected]:/ # ndc resolver setdefaultif -- Set as the default device
KASRU said:
Change your DNS servers in Android.
You can change the same thing on your rooted Android Device.
[email protected]:/ # ndc resolver flushif -- flushes old DNS servers
[email protected]:/ # ndc resolver flushdefaultif -- flush resolver
[email protected]:/ # ndc resolver setifdns <iface> <domains> <dns1> <dns2> ... -- Add the new servers
[email protected]:/ # ndc resolver setdefaultif -- Set as the default device
Click to expand...
Click to collapse
Hi Kasru, to set your prefered DNS automatcailly and every time, you may want to have a look at this file in /system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf, in there, you can add lines like below:
setprop dhcp.eth0.dns1 8.8.8.8
setprop dhcp.eth0.dns2 8.8.8.4
i found this out from here: github.com/varunkumar/scratchpad/blob/master/static/20-dns.conf
cheers.
d8d8up said:
Hi Kasru, to set your prefered DNS automatcailly and every time, you may want to have a look at this file in /system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf, in there, you can add lines like below:
setprop dhcp.eth0.dns1 8.8.8.8
setprop dhcp.eth0.dns2 8.8.8.4
i found this out from here: github.com/varunkumar/scratchpad/blob/master/static/20-dns.conf
cheers.
Click to expand...
Click to collapse
i can note copy the link over, but here it is the file, note line 20 and 20, if you # it out, it should use the default gateway, or change it so it use one you prefer:
<code>
# Set net.<iface>.dnsN properties that contain the
# DNS server addresses given by the DHCP server.
set_dns_props()
{
case "${new_domain_name_servers}" in
"") return 0;;
esac
count=1
for i in 1 2 3 4; do
setprop dhcp.${interface}.dns${i} ""
done
count=1
for dnsaddr in ${new_domain_name_servers}; do
setprop dhcp.${interface}.dns${count} ${dnsaddr}
count=$(($count + 1))
done
setprop dhcp.eth0.dns1 8.8.8.8
setprop dhcp.eth0.dns2 8.8.8.4
}
unset_dns_props()
{
for i in 1 2 3 4; do
setprop dhcp.${interface}.dns${i} ""
done
}
case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT) set_dns_props;;
EXPIRE|FAIL|IPV4LL|RELEASE|STOP) unset_dns_props;;
esac
</code>
I long time search way, how to to communicate directly the daemon via the /dev/socket/netd
Besause the getprop/setprop method used by all the DNS changer apps does not work anymore (on Android 4.3+).
Application "Override DNS for KitKat" is cool!
For change DNS manually, use command for add new DNS server:
[email protected]:/ # ndc resolver setifdns <iface> <domains> <dns1> <dns2>
[email protected]:/ # ndc resolver setdefaultif <iface>
For example:
Code:
[email protected]:/ # ndc resolver setifdns eth0 "" 8.8.8.8 8.8.8.4 192.168.1.1
[email protected]:/ # ndc resolver setdefaultif eth0
---
If you liked my post, then don't hesitate to hit the thanks button
I have tried using other "dns changer" apps post 4.3, they successfully change the dns to public ones but they have no option to revert back to DHCP assigned. SetDNS used to have this function but now longer works on Lollipop. How can i get the DNS servers back to DHCP assigned for both celluar and wifi?
I've a Samsung S5 with CM12.1 + FakeWifi (Xposed).
I use the following script to reverse tether with ubuntu.
Code:
#!/bin/bash
ADB="adb"
# We need root on the host to mess with networking
if [[ $(whoami) != "root" ]]; then
echo "You must be root to run this script!"
exit 1
fi;
# We need root on the device to mess with networking
$ADB -d root
# Keep NetworkManager from messing with the adapter
grep 'usb0 inet manual' /etc/network/interfaces
if [ ! $? ]; then
echo 'Configuring usb0 for manual control'
echo 'iface usb0 inet manual' >> /etc/network/interfaces
restart network-manager
fi
echo 'Setting up usb networking on device'
$ADB -d shell 'ip addr add 192.168.200.2/30 dev rndis0;\
ip link set rndis0 up; \
ip route delete default; \
ip route add default via 192.168.200.1; \
setprop net.dns1 192.168.200.1'
echo 'Setting up usb interface on the host'
ip addr flush dev usb0
ip addr add 192.168.200.1/30 dev usb0
ip link set usb0 up
# Turn off the firewall if one is active
echo 'Checking for ufw firewall'
which ufw && ufw status || ufw disable
echo 'Enabling NAT and IP Forwarding'
# Start forwarding and nat (use existing default gw)
iptables -F -t nat
iptables -A POSTROUTING -t nat -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 'Starting dnsmasq'
dnsmasq --interface=usb0 --no-dhcp-interface=usb0
echo 'Connection is active! Press any key to shutdown.'
read
echo 'Attempting to shut down reverse tethering'
killall dnsmasq
ip link set usb0 down
iptables -F -t nat
echo 0 > /proc/sys/net/ipv4/ip_forward
echo 'Disabling usb networking on host'
$ADB shell ip route delete default
echo 'Disable and re-enable Wifi to return the device to normal'
Now the problem is that if I ping a public IP it works, but if I ping or curl the corresponding domain it fails "unknown host", "could not resolve".
What the heck should I do in order to make DNS working?
Thanks a lot for your help
Tsktsk said:
I've a Samsung S5 with CM12.1 + FakeWifi (Xposed).
I use the following script to reverse tether with ubuntu.
Code:
#!/bin/bash
ADB="adb"
# We need root on the host to mess with networking
if [[ $(whoami) != "root" ]]; then
echo "You must be root to run this script!"
exit 1
fi;
# We need root on the device to mess with networking
$ADB -d root
# Keep NetworkManager from messing with the adapter
grep 'usb0 inet manual' /etc/network/interfaces
if [ ! $? ]; then
echo 'Configuring usb0 for manual control'
echo 'iface usb0 inet manual' >> /etc/network/interfaces
restart network-manager
fi
echo 'Setting up usb networking on device'
$ADB -d shell 'ip addr add 192.168.200.2/30 dev rndis0;\
ip link set rndis0 up; \
ip route delete default; \
ip route add default via 192.168.200.1; \
setprop net.dns1 192.168.200.1'
echo 'Setting up usb interface on the host'
ip addr flush dev usb0
ip addr add 192.168.200.1/30 dev usb0
ip link set usb0 up
# Turn off the firewall if one is active
echo 'Checking for ufw firewall'
which ufw && ufw status || ufw disable
echo 'Enabling NAT and IP Forwarding'
# Start forwarding and nat (use existing default gw)
iptables -F -t nat
iptables -A POSTROUTING -t nat -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 'Starting dnsmasq'
dnsmasq --interface=usb0 --no-dhcp-interface=usb0
echo 'Connection is active! Press any key to shutdown.'
read
echo 'Attempting to shut down reverse tethering'
killall dnsmasq
ip link set usb0 down
iptables -F -t nat
echo 0 > /proc/sys/net/ipv4/ip_forward
echo 'Disabling usb networking on host'
$ADB shell ip route delete default
echo 'Disable and re-enable Wifi to return the device to normal'
Now the problem is that if I ping a public IP it works, but if I ping or curl the corresponding domain it fails "unknown host", "could not resolve".
What the heck should I do in order to make DNS working?
Thanks a lot for your help
Click to expand...
Click to collapse
Hi! Unfortunately, I have no idea on how to fix these issues, but if you'd be willing to try a different reverse tethering solution, you might want to try ReverseTethering NoRoot, an app I have developed. I have opened a dedicated thread over here: http://forum.xda-developers.com/android/apps-games/app-reversetethering-noroot-t3316716
Tsktsk said:
I've a Samsung S5 with CM12.1 + FakeWifi (Xposed).
I use the following script to reverse tether with ubuntu.
Code:
#!/bin/bash
ADB="adb"
# We need root on the host to mess with networking
if [[ $(whoami) != "root" ]]; then
echo "You must be root to run this script!"
exit 1
fi;
# We need root on the device to mess with networking
$ADB -d root
# Keep NetworkManager from messing with the adapter
grep 'usb0 inet manual' /etc/network/interfaces
if [ ! $? ]; then
echo 'Configuring usb0 for manual control'
echo 'iface usb0 inet manual' >> /etc/network/interfaces
restart network-manager
fi
echo 'Setting up usb networking on device'
$ADB -d shell 'ip addr add 192.168.200.2/30 dev rndis0;\
ip link set rndis0 up; \
ip route delete default; \
ip route add default via 192.168.200.1; \
setprop net.dns1 192.168.200.1'
echo 'Setting up usb interface on the host'
ip addr flush dev usb0
ip addr add 192.168.200.1/30 dev usb0
ip link set usb0 up
# Turn off the firewall if one is active
echo 'Checking for ufw firewall'
which ufw && ufw status || ufw disable
echo 'Enabling NAT and IP Forwarding'
# Start forwarding and nat (use existing default gw)
iptables -F -t nat
iptables -A POSTROUTING -t nat -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 'Starting dnsmasq'
dnsmasq --interface=usb0 --no-dhcp-interface=usb0
echo 'Connection is active! Press any key to shutdown.'
read
echo 'Attempting to shut down reverse tethering'
killall dnsmasq
ip link set usb0 down
iptables -F -t nat
echo 0 > /proc/sys/net/ipv4/ip_forward
echo 'Disabling usb networking on host'
$ADB shell ip route delete default
echo 'Disable and re-enable Wifi to return the device to normal'
Now the problem is that if I ping a public IP it works, but if I ping or curl the corresponding domain it fails "unknown host", "could not resolve".
What the heck should I do in order to make DNS working?
Thanks a lot for your help
Click to expand...
Click to collapse
Hi did you end up resolving this issue? I have the exact same problem. Can ping any site but DNS lookup fails. Then I installed DNSsetter app which allows me to change the dns server. Now I can do DNS lookups and it resolves correctly but none of the apps do not appear to be aware of the fact that the phone is using reverse USB tethering.