[Q] problem with network apps from busybox on prime 1.6 - Eee Pad Transformer Q&A, Help & Troubleshooting

Hello xda,
I have the problem with all networks apps from busybox like ping, wget etc. BTW, the same apps from android work fine:
Code:
bash-4.1# which ping
/system/xbin/ping
bash-4.1# ls -la /system/xbin/ping
lrwxrwxrwx 1 root 2000 20 Jul 26 07:49 /system/xbin/ping -> /system/xbin/busybox
bash-4.1# ping google.com
ping: bad address 'google.com'
bash-4.1# /system/xbin/busybox ping google.com
ping: bad address 'google.com'
bash-4.1# /system/xbin/busybox wget google.com
wget: bad address 'google.com'
bash-4.1# /system/bin/ping -c1 google.com
PING google.com (209.85.148.99) 56(84) bytes of data.
64 bytes from google.com (209.85.148.99): icmp_seq=1 ttl=53 time=44.2 ms
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 44.271/44.271/44.271/0.000 ms
bash-4.1#
Any solutions?
Thanks

using jping
I have terminal IDE, which includes jping, so I can use:
jping google.com | sed 's/.*: \(.*\)/\1/' | xargs ping
And I get the name resolved for me.

Related

Cricket autostart.sh not working

I've been trying all day to get my Huawei Ascend android phone to use Cricket's WAP proxy for apps like android marketplace, but it never seems to work. I still get some error stating that Data Connection is not working or has timed-out. All that works is the Browser and Cricket's built-in apps, though they worked before I was using the autostart.sh file anyways.
I tried different variations on the code and none of them seem to work.
This is the current code I have for my auotstart.sh file.
Code:
#!/system/bin/sh
export PROXYHOST=wap.mycricket.com
export PROXYPORT=8080
export MMSHOST=mms.mycricket.com
export MMSPORT=80
#you shouldn't have to edit anything below this line
export PATH="$PATH:/system/bin"
until netcfg|grep -v DOWN|awk '{print $1}'|grep -v wlan|grep -v lo >/dev/null 2>&1 ; do sleep 1 ; done
export INTERFACE=`netcfg|grep -v DOWN|awk '{print $1}'|grep -v wlan|grep -v lo`
export PROXYIP=`ping -c 1 $PROXYHOST|grep PING|cut -d\) -f1|cut -d\( -f2`
export MMSIP=`ping -c 1 $MMSHOST|grep PING|cut -d\) -f1|cut -d\( -f2`
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
iptables -t nat -F
iptables -X
iptables -t nat -A OUTPUT -o $INTERFACE -p tcp -d $MMSIP --dport $MMSPORT -j DNAT --to-destination $MMSIP:$MMSPORT
iptables -t nat -A OUTPUT -o $INTERFACE -p tcp --dport 80 -j DNAT --to-destination $PROXYIP:$PROXYPORT
iptables -t nat -A OUTPUT -o $INTERFACE -p tcp ! -d $PROXYIP -j REDIRECT --to-port 1025
u2nl $PROXYIP $PROXYPORT 127.0.0.1 1025 >/dev/null 2>&1 &
sh -c "sleep 5;kill `ps|grep nk.bla.android.autostart|grep -v grep|awk '{print $2}'`" >/dev/null 2>&1 &
exit 0
Is that any way to get it working?
ummm, why are you doing it that way? If you have the Android plan, all you need to do is set-up the APN if it's not working.
xlarkascendingx said:
ummm, why are you doing it that way? If you have the Android plan, all you need to do is set-up the APN if it's not working.
Click to expand...
Click to collapse
I'm not on the Android plan, so I need to use autostart.sh to get apps to work with cricket's WAP Proxy.
That sucks, why don't you just get the android plan haha.
xlarkascendingx said:
That sucks, why don't you just get the android plan haha.
Click to expand...
Click to collapse
Because I don't have $55 a month. DO you wanna give me $55/month?
Just suck it up, pay the extra $10, or continue to have problems. Your choice.
Well you obviously have 45 dollars a month, otherwise you wouldn't have internet period. It's really not that big of a difference in price. Plus, you paid for the phone lol.
tzbigworm said:
Just suck it up, pay the extra $10, or continue to have problems. Your choice.
Click to expand...
Click to collapse
How about giving a real answer to my question or not posting in this thread at all.
xlarkascendingx said:
Well you obviously have 45 dollars a month, otherwise you wouldn't have internet period. It's really not that big of a difference in price. Plus, you paid for the phone lol.
Click to expand...
Click to collapse
Well, actually the plan is much cheaper than that, lol.
I'm not sure how I'm getting Internet, but since I am getting it I'm going to use it.
try changing the ports to 8080, where it says tcp in the section you may not have to edit or whatever. i always use 8080
xlarkascendingx said:
try changing the ports to 8080, where it says tcp in the section you may not have to edit or whatever. i always use 8080
Click to expand...
Click to collapse
I tried that, but it still didn't work.
Did this problem ever get resolved?

Reverse USB Tether Successful - Root, Command Line, Linux

Hey All,
Hope this hasn't been covered. I did search a bit and found some clues, but not something that totally worked for me. I figured I'd put up a post telling y'all how I made it work. I suppose this post is just more clues for somebody else, but at least it seems like a different set of clues than what I was able to find.
I've wanted to use the phone's USB connection to use work's Internet connection to download updates to my phone and conserve my measly 2GB/month data.
Running Cyanogenmod 9.1.0. Don't know how this would translate to others.
The tricks to reverse USB tether are
A) Get the phone to connect to a Linux host over the USB as in a normal tether
B) Set up IP forwarding and NAT on the Linux host (which has a perfectly fine Ethernet connection to the Internet)
C) Change the phone's default route to point at the Linux host
D) Change the phone to use the same DNS servers visible to the Linux host
A-C were pretty easy. D was actually the hardest. Here's my notes I'm storing on the phone:
***********************************************************************
* On the linux host
# ip addr show
2: p2p1: ...
inet 10.2.59.107/18 brd 10.2.63.255 scope global p2p1
7: usb0: ...
inet 192.168.42.151/24 brd 192.168.42.255 scope global usb0
* This part is classic "setting up a NAT" which is easily googled.
# echo 1 > /proc/sys/net/ipv4/ip_forward
# iptables -t nat -A POSTROUTING -o p2p1 -j MASQUERADE
# iptables -A FORWARD -i p2p1 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
# iptables -A FORWARD -i usb0 -o p2p1 -j ACCEPT
* This tells us some IP addresses to use as nameservers.
cat /etc/resolv.conf
# nameserver 10.2.10.24
# nameserver 10.2.10.26
***********************************************************************
* On the android device disable all other methods of accessing the internet.
* That is, turn off Wi-Fi and System Settings, Wireless & networks, Mobile
* networks, Uncheck "Data enabled". This might not be necessary. I did it to
* make sure the rest of what I was doing worked.
* Try 'ip route' without other args and delete any existing default route if
* you have one.
# ip route add default via 192.168.42.151 dev rndis0
# getprop | grep dns
[net.change]: [net.dns2]
[net.dns1]: [172.26.38.1]
[net.dns2]: [172.26.38.2]
[net.dnschange]: [1]
[net.rmnet_sdio0.dns1]: []
# setprop net.dns1 10.2.10.24
# setprop net.dns2 10.2.10.26
* * Avoid the Primrose Path. This sort of acted like it would work, but then
* * didn't at all.
*
* # cat /emmc/resolv_work.conf
* nameserver 10.2.10.24
* nameserver 10.2.10.26
*
* # pkill dnsmasq
* # dnsmasq -d -r /emmc/resolv_work.conf

[Q] [ Reverse Tethering ] DNS is not working

When I did same thing on Galaxy S3, it's working fine.
But When it did it on Galaxy Note2, it some times works. once out of 10 times works.
If you look below, ping is working. but it's not working with the domain name.
I did nslookup and it's working.
I browsed to a website throught IP and it's working. but it's not working with domain.
I tried to adjust DNS info in ADB shell but still not working.
it's working some times. but most out of times it's not working.
Please some body gives me any hint.
thank you.
--------------------------------------------------------------
C:\Users\JaeHo>ipconfig
Ethernet adapter Local Area Connection 9:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::99d3:e644:18aa:c0fe%49
IPv4 Address. . . . . . . . . . . : 192.168.137.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
---------------------------------------------------------------
C:\Users\JaeHo>adb shell
[email protected]:/ $ su
su
[email protected]:/ # netcfg rndis0 dhcp
netcfg rndis0 dhcp
[email protected]:/ # route add default gw 192.168.137.1 dev rndis0
route add default gw 192.168.137.1 dev rndis0
[email protected]:/ # ping -c5 philgo.com
ping -c5 philgo.com
ping: unknown host philgo.com
2|[email protected]:/ # ping -c5 168.126.63.1
ping -c5 168.126.63.1
PING 168.126.63.1 (168.126.63.1) 56(84) bytes of data.
64 bytes from 168.126.63.1: icmp_seq=1 ttl=52 time=105 ms
64 bytes from 168.126.63.1: icmp_seq=2 ttl=52 time=100 ms
64 bytes from 168.126.63.1: icmp_seq=3 ttl=52 time=100 ms
64 bytes from 168.126.63.1: icmp_seq=4 ttl=52 time=132 ms
64 bytes from 168.126.63.1: icmp_seq=5 ttl=52 time=100 ms
--- 168.126.63.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 100.747/108.058/132.237/12.238 ms
[email protected]:/ # getprop net.dns1
getprop net.dns1
[email protected]:/ # nslookup philgo.com
nslookup philgo.com
nslookup: can't resolve '(null)': Name or service not known
Name: philgo.com
Address 1: 116.122.36.242
[email protected]:/ # ip route show
ip route show
default via 192.168.137.1 dev rndis0
192.168.137.0/24 dev rndis0 proto kernel scope link src 192.168.137.131
When setprop does not set the prop... :
Code:
iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination 8.8.8.8:53

[Guide][Root] Internet connection on Gear2 in 2 steps [Updated 2014.12.08]

I made attempt to share internet connection directly to Gear2 with quite big success. But first things first.
What you need:
- rooted gear 2 (neo)
- enabled network tethering over bluetooth on phone paired with gear 2 (tested on Galaxy S4)
Step 0: Enable sdb root
Code:
sdb root on
Step 1: using sdb copy required network tools to /tmp/ directory on gear and change permissions:
Code:
sdb push ifconfig /tmp/
sdb push pand /tmp/
sdb push route /tmp/
sdb push ping /tmp/
sdb shell chmod +x /tmp/ifconfig
sdb shell chmod +x /tmp/pand
sdb shell chmod +x /tmp/route
sdb shell chmod +x /tmp/ping
Step 2: open shell and run hcitool:
Code:
sdb shell
sh-3.2# hcitool con
Connections:
> ACL 5C:2E:xx:xx:xx:xx handle 12 state 1 lm SLAVE AUTH ENCRYPT
5C:2E:xx:xx:xx:xx - this is mac of your phone
Step 3: connect to phone
Code:
sh-3.2# cd /tmp/
sh-3.2# ./pand --connect 5C:2E:xx:xx:xx:xx
Now you should have new interface bnep0, you can run ./ifconfig -a to check
Step 4: Set IP and gateway
This part is bit tricky because I can't manage to get IP addres by dhcp so you have to check which addres you should assign. I've connected to S4 with other android phone and checked ip with IP Tools from Google Play.
Code:
sh-3.2# ./ifconfig bnep0 up
sh-3.2# ./ifconfig bnep0 192.168.44.200
sh-3.2# ./route add default gw 192.168.44.1
Step 5: Test connection
Code:
sh-3.2# ./ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=44 time=716.873 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=44 time=119.090 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=44 time=220.530 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=44 time=197.332 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=44 time=199.790 ms
64 bytes from 8.8.8.8: icmp_seq=7 ttl=44 time=136.653 ms
64 bytes from 8.8.8.8: icmp_seq=8 ttl=44 time=147.867 ms
^C--- 8.8.8.8 ping statistics ---
9 packets transmitted, 7 packets received, 22% packet loss
round-trip min/avg/max/stddev = 119.090/248.305/716.873/194.396 ms
As you can see connection isn't very stable.
What opportunities does that give to us?
XMLHttpRequest from watchface or application without bridge app on phone
Standalone webbrowser
...?
TODO:
dhclient
auto connection when paired with phone
DNS
Integration with ROM
Update 1:
dhclient now works (dirty hand made dhclient-script)
DNS works (thanks to Talon^)
Permanent write to rom (still no autoconnect)
I've crated tar package which should make all process more easy
To install gearnet.tar package do the following:
1. By adb
Code:
sdb push gearnet.tar /tmp/
sdb root on
sdb shell
In Gear shell prompt:
Code:
sh-3.2# mount -o remount,rw /
sh-3.2# tar --overwrite -xvf /tmp/gearnet.tar -C /
sh-3.2# reboot
now after reboot you should be able to run command as root:
Code:
sh-3.2# gearnet
sh-3.2# ping google.pl
PING google.pl (74.125.195.94): 56 data bytes
64 bytes from 74.125.195.94: icmp_seq=0 ttl=45 time=132.238 ms
64 bytes from 74.125.195.94: icmp_seq=1 ttl=45 time=184.377 ms
64 bytes from 74.125.195.94: icmp_seq=2 ttl=45 time=151.909 ms
64 bytes from 74.125.195.94: icmp_seq=3 ttl=45 time=104.898 ms
64 bytes from 74.125.195.94: icmp_seq=4 ttl=45 time=153.549 ms
64 bytes from 74.125.195.94: icmp_seq=5 ttl=45 time=181.517 ms
^C--- google.pl ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max/stddev = 104.898/151.415/184.377/27.474 ms
sh-3.2#
Oh what fun that was! This is really cool. It worked on my Gear 1 . I had 9% packet loss....... can't wait to see what's next and thanks for sharing!
Chris
Awesome!
I was searching for this FOREVER! This is awesome I really look forward to any updates for this.
When I first bought the watch I assumed this was already possible, but greatly disappointed that it wasn't possible. This now gives me hope, and makes me want to keep the watch!
any chance for dns?
following your guide, I snooped at other packages. I managed to get these installed for an attempt at perl:
gdbm-1.8.3-1.1.armv7l.rpm
perl-libs-5.12.1-1.4.armv7l.rpm
perl-Module-Pluggable-3.60-1.4.armv7l.rpm
perl-Pod-Simple-3.07-1.4.armv7l.rpm
perl-IO-Compress-Base-2.008-1.4.armv7l.rpm
perl-5.12.1-1.4.armv7l.rpm
still missing a few dependencies but it finally worked with --nodeps and now I have perl5 on my gear 2 neo
I wanted to test some sockets so I wrote a quick snippet for irc and it kept failing with my die message of can't connect. then I tried to "ping" a domain, and realized there's no DNS, so once I resolved the irc servers domain and used the IP, it connected flawlessly!
here's a screenshot of my sdb shell running a test perl file of the IRC client snippet.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
got any ideas how to get DNS working to resolve domains so you don't have to find the IP?
found how to get DNS
theres a file in /etc called resolv.conf, I just modified it to include googles nameservers 8.8.8.8 and 8.8.4.4, now DNS lookups are possible, you can now say: ./ping google.com
dumb question...but does web gear has standalone web browsing? Correct me if i'm wrong....
the GearWeb browser?
the GearWeb browser from the Samsung Galaxy APPS store uses the SAP for it's content. (Samsung accessory protocol) Without rooting and doing this networking trick, the gear 2 (gear 2 neo also) has no direct ties to the internet, nor do any available apps. They all use the phone itself for content and share that content via SAP.
This requires you to also know Java, as the nature of how this works is an android application running as a background process on your phone waiting for a SAP connection from your wearable device, then serving the content back to the device over bluetooth. I could be wrong but this appears to be a poll-only operation. You can't just send content from the host Java App without first having a fetch request from the wearable device, which to me makes it almost worthless, especially if you wanted to do any real protocol development for your gear like IRC, Facebook Messenger, etc.. that require a live streaming socket.
Btw, I have successfully tested this networking with the STOCK Tizen IDE for Wearable with the ECMA 3 Browser Support XMLHttpRequest() and can confirm that this does now work on the watch, as long as you initiated the network.
It didn't work at first but I figured out why. You must grant it internet privileges in your config.xml and also give it an access parameter under the Policy tab. Wildmatches DO work for access policy. I gave it a vague "*" with allow subdomain true, and it works just fine.
I don't know about auto-reconnect but I believe that I should be able to make a service descriptor for systemd to init your new gearnet script. The .service files are located in /usr/lib/systemd/system
I'm going to try modifying the sap.service file in there and making a new one called gearnet.service and seeing if I can get network to start upon boot.
If this works, upon starting your gear, it should automatically attempt to establish a network connection. Not sure about making it reconnect if you walked too far away from your phone and came back into range, but as long as you don't do that, networking should be possible on boot of your wearable device
successful networking upon boot
ok so I figured out how to get the watch to connect on first boot.
this is a linux operating system (tizen is a form of linux) you need some tool that can handle UTF-8 character encoding with the line ending of Unix/Linux. Typical windows notepad uses windows standard line ending which is CRLF (carrage return [ASCII CODE: 13], line feed [ASCII CODE: 10]) while I believe unix/linux just uses LF. I pulled a .service file and just modified it and saved it as a different name but I used a windows build of the popular gnome editor known as 'gedit'. WordPad will also work, but NotePad will NOT!
make a file (or pull one and modify it to keep the UNIX line endings if you plan on using wordpad), call it gearnet.service with the following code:
Code:
[Unit]
Description=GearNet service
After=weconn.service
[Service]
Type=forking
ExecStart=/sbin/gearnet
Restart=always
[Install]
WantedBy=multi-user.target
push the file to /usr/lib/systemd/system
then systemctl enable gearnet.service
shut down the watch. The problem with this is, if/when you disable bluetooth on your device (on my S4) the bluetooth tethering is turned off. you must re-enable it. make sure it's enabled before powering your watch on again. (S4 it's in settings > More Networks > Tethering and Portable Hotspot)
power on your watch, you'll see once it boots on your phone, connected to <device> then shortly after, Tethering/Portable Hotspot active.
NOTE: tested to see if the internet would come back if you walk too far away from your phone. As I suspected, this fails, while the bluetooth pairing comes back, the network does not :/ I'll have to see if I can figure a way to fix this issue, but for now, instant network access upon boot is GREAT! no more needing to connect your gear to the PC and manually start networking
EDIT
I'm looking for a better solution, but I have modified the gearnet shell script and pushed it to /sbin/gearnet. This will fix the issue of losing internet connection when walking too far away from your phone, once you come back in range, the network will also come back.
Code:
#!/bin/sh
while true; do #create a infinite loop to keep looking at your connection
NET=$(ifconfig bnep0 | grep "inet addr:") # verify if the interface has an assigned IP
if [ ! "$NET" != "" ]; then # If we don't already have an IP
btaddr=$(hcitool con | awk '{print $3}' | sort -rn | head -n 1)
if [ "$btaddr" != "" ]; then #verify there's a paired device to connect to
pand --connect $btaddr
sleep 5
dhclient bnep0
fi
fi
sleep 5
done

Connecting to OpenVPN running on OpenWrt from Android

Code:
OpenVPN 2.5.3 aarch64-openwrt-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]
library versions: OpenSSL 1.1.1l 24 Aug 2021, LZO 2.10
I installed OpenVPN on the latest OpenWrt 21.02.1
The client config and server conf files both have these lines at the top:
Code:
user nobody
group nogroup
dev tun
..
..
I installed the OpenVPN for Android app on my Android phone. When entering the client config file... am I supposed to comment out or delete the first two lines since there is no user called: nobody and no group called nogroup in my Android. At least I didn't see anything in /etc/group and /etc/passwd in Android OS.
I see in the OpenVPN manual that the --user option lets you:
"Change the user ID of the OpenVPN process to user after initialization, dropping privileges in the process. This option is useful to protect the system in the event that some hostile party was able to gain control of an OpenVPN session."
I can connect from the Android client to OpenVPN server by commenting out those two lines but is there a way to obtain the benefit of running as user "nobody" and group "nogroup", or some such unpriviledged user, when connecting to OpenVPN server on OpenWrt from an Android phone? From a Terminal to my phones Android OS if I do ls -l I can see user and group of all files is: u0_a252 so should I make a user an group of u0_a252 on the server running OpenVPN and then use that as the user and group inyou are dropping root privileges on the client with --user and/or --group the client and server config files? My phone is not rooted so I guess running as user u0_a252 will be the same thing as running OpenVPN unpriviledged?
Lastly do I NEED to define a user AND a group or is one or the other enough? The OpenVPN manual is a bit ambiguous on this point because it also states: "[if] you are dropping root privileges on the client with --user and/or --group.."
Cheers,
Flex
I asked the creator of the OpenVPN for Android app.
That app ignores the OpenVPN --user and --group options and it runs as an unpriviledged user which can be confirmed by installing Android Debug Bridge (ADB) on a computer to which the phone is attached via USB cable. Then run commands such as these:
Bash:
# adb shell
sunfish:/ $ top | grep openvpn
20901 shell 20 0 10G 2.8M 2.1M S 0.0 0.0 0:00.00 grep openvpn
20901 shell 20 0 10G 2.8M 2.1M S 0.0 0.0 0:00.00 grep openvpn
19186 u0_a253 20 0 14G 96M 49M S 0.6 1.7 0:02.23 de.blinkt.openvpn:openvpn
19186 u0_a253 20 0 14G 96M 49M S 0.3 1.7 0:02.25 de.blinkt.openvpn:openvpn
19186 u0_a253 20 0 14G 96M 49M S 0.6 1.7 0:02.26 de.blinkt.openvpn:openvpn
So in my case the client connecting to the OpenVPN server has user id: u0_a253 and not root.
Cheers,
Flex

Categories

Resources