[SOLVED] OpenVPN Full Tunnel - Samsung Galaxy Nexus

Short Version:
Got an OpenVPN server on my NAS. GN connects & works fine; remote resources are reachable. I now want to know how I can route all traffic through the tunnel. (Is this possible?)
Long Version:
For those times when I'm traveling (domestically and internationally) and/or using a questionable Internet connection, I'd like to secure the connection.
I've got a [stock] rooted GN running Jelly Bean with BusyBox installed. My NAS has two built-in VPN solutions one of which being OpenVPN so I got that setup which created an .ovpn file containing the following configuration:
Code:
dev tun
tls-client
remote YOUR_SERVER_IP 1194
# The "float" tells OpenVPN to accept authenticated packets from any address,
# not only the address which was specified in the --remote option.
# This is useful when you are connecting to a peer which holds a dynamic address
# such as a dial-in user or DHCP client.
# (Please refer to the manual of OpenVPN for more information.)
#float
# If redirect-gateway is enabled, the client will redirect it's
# default network gateway through the VPN.
# It means the VPN connection will firstly connect to the VPN Server
# and then to the internet.
# (Please refer to the manual of OpenVPN for more information.)
#redirect-gateway
# dhcp-option DNS: To set primary domain name server address.
# Repeat this option to set secondary DNS server addresses.
#dhcp-option DNS DNS_IP_ADDRESS
pull
proto udp
script-security 2
ca ca.crt
comp-lzo
reneg-sec 0
auth-user-pass
After installing OpenVPN Installer & OpenVPN Settings, I had to manually symlink busybox, ifconfig, and route from /system/bin to /system/xbin in order for OpenVPN to run properly.
Code:
#Note: In an attempt to be thorough, and for any Googlers or forum searchers (+1)...
#First I had to mount /system as read/write via:
mount -o -rw,remount /system
#Then create the symlinks via:
ln -s /system/bin/busybox /system/xbin/busybox
ln -s /system/bin/ifconfig /system/xbin/ifconfig
ln -s /system/bin/route /system/xbin/route
#Then remount /system as read-only via:
mount -o ro,remount /system
Once all of the above was setup, I initiated the connection, successfully authenticated, and was able to reach remote resources without issue.
What I would like to do at this point is get it setup so that I can have a second profile that routes all traffic through the VPN. I assume its a client-side configuration change but I really don't know at this juncture.
Many thanks!

Doesn't CyanogenMod ROM have native OpenVPN support? I think the OpenVPN client on CM has an option to route all traffic through the VPN. I think for what you want to do you should need a custom ROM or kernel that supports iptables.
iptables is a system file that allows the system to redirect network traffic usually for apps like tethering, firewalls, and proxies.
Sent from my Galaxy Nexus using Tapatalk 2

Thanks for taking the time to reply KemikalElite.
I've got BusyBox 1.20.2 installed and I do have an iptables binary (v1.4.11.1). With solutions like Hotspot Shield VPN that don't require root yet supports encryption for all traffic, I figured root + OpenVPN + BusyBox + iptables would be sufficient.
My initial assumption was that I would need to make some changes to my OpenVPN configuration to encrypt & route all traffic through the tunnel. But maybe I've been thinking about this all wrong and its less about OpenVPN and more about running a custom script once connected to route everything through the tunnel; and vice versa when I disconnect to restore the original configuration.
Perhaps I should be scouring OpenVPN forums?

Phylum said:
Thanks for taking the time to reply KemikalElite.
I've got BusyBox 1.20.2 installed and I do have an iptables binary (v1.4.11.1). With solutions like Hotspot Shield VPN that don't require root yet supports encryption for all traffic, I figured root + OpenVPN + BusyBox + iptables would be sufficient.
My initial assumption was that I would need to make some changes to my OpenVPN configuration to encrypt & route all traffic through the tunnel. But maybe I've been thinking about this all wrong and its less about OpenVPN and more about running a custom script once connected to route everything through the tunnel; and vice versa when I disconnect to restore the original configuration.
Perhaps I should be scouring OpenVPN forums?
Click to expand...
Click to collapse
You have the tun module as well right?
code.google.com/p/android-openvpn-settings/issues/list
Check through some of those issues. Something did say that the DNS servers may need to be manually set.
OpenVPN is so complex because of the config options. I find it easier to use native PPTP connections since there's no config only authentication and it routes all traffic automatically.
Sent from my Galaxy Nexus using Tapatalk 2

You need to enter "redirect-gateway" into your ovpn config file.... Just remove the # in the your config

Thanks for the reply ZiCoN!
I should have mentioned this sooner - terribly sorry for omitting this.
Once I got the VPN connected, I did the old 'what is my ip' to verify the route. It was still using the provider's network, but I could reach my NAS and other remote devices in the 192.168.x.x range - so the VPN itself was working. After reading the mini explanation in the config file I enabled 'redirect-gateway' and after reconnecting I could no longer access the Internet. I checked the OpenVPN Manual I added 'def1' after the 'redirect-gateway' statement, reconnected but still no go: I can no longer access the Internet. Remote resources are still accessible in both scenarios.

KemikalElite said:
You have the tun module as well right?
code.google.com/p/android-openvpn-settings/issues/list
Check through some of those issues. Something did say that the DNS servers may need to be manually set.
OpenVPN is so complex because of the config options. I find it easier to use native PPTP connections since there's no config only authentication and it routes all traffic automatically.
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
I somehow missed this when drafting my last reply. I think you're right about it being a DNS problem. I made a change to the config file (adding a few lines for 'dhcp-option DNS x.x.x.x') and within OpenVPN used the 'Fix DNS' button.
Thanks all for your time, thoughts, opinions and instructions!

Phylum said:
Thanks for the reply ZiCoN!
I should have mentioned this sooner - terribly sorry for omitting this.
Once I got the VPN connected, I did the old 'what is my ip' to verify the route. It was still using the provider's network, but I could reach my NAS and other remote devices in the 192.168.x.x range - so the VPN itself was working. After reading the mini explanation in the config file I enabled 'redirect-gateway' and after reconnecting I could no longer access the Internet. I checked the OpenVPN Manual I added 'def1' after the 'redirect-gateway' statement, reconnected but still no go: I can no longer access the Internet. Remote resources are still accessible in both scenarios.
Click to expand...
Click to collapse
You probably need to allow traffic to route back along the vpn film the internet. On your gateway, route vpn addresses to the VPN server and make sure forwarding is enabled on the vpn server.

Questions go in Q&A
Read forum rules and stickies before posting
Thread moved
FNM

Related

Tethering issue

I'm trying to tether my Evo with my HP netbook that's currently running Blackbuntu which is a pen test distro based on Ubuntu 10.10 and using Wicd as my network manager. With the default network manager usb tethering worked "out of the box" but unfortunately I was unable to use WiFi with it which forced me to use Wicd. In order for Wicd to function properly I had to fully remove the original network manager. Now I can't figure out how to configure Wicd to work with tethering. Somewhere I read all I have to do is change the wired interface in Wicd from eth0 to usb0, or something along those lines, so I tried ifconfig to verify and nothing showed up other than eth0, lo, and wlan0 - the 3 that always show up. I can't seem to find the tethering tutorial I read before to double-check it. Any help/ideas would be great.
EDIT: I figured it out on my own. I just had a brain fart for a bit. For anyone wondering how to do it, here's how:
On your Evo open a terminal and do the following.
su
busybox ifconfig
Write down the IP address given.
Connect your phone to your Linux box and start USB Tethering.
On the Linux box open a terminal and type:
sudo ifconfig usb0 up
Open Wicd, click preferences, and change the wired interface to usb0. You may have to set DNS1 to the IP you copied earlier.
Sent from my PC36100 using XDA App

[GUIDE] Making infrastructure wifi hotspot on ubuntu 12.04/12.10

As many of you know, most of our android(not only android) devices can't connect to ad hoc hotspots. There's a solution for win7/8 users to set up infrastructure hotspot on their laptop using software like connectify and so on. Ubuntu also allows to create wifi hotspot to share internet, but it will be ad hoc one.
So here's the guide how to set up infrastructure hotspot on ubuntu 12.04/12.10. Unlike some other methods described on the internet, this one will not break default network manager.
1. First of all you should make sure, that your wifi adapter supports infrastructure hotspots. If you used connectify on your windows system and it worked, skip this step.
open terminal and type: sudo lshw | less
find -network section and make sure that driver is ath5k or ath9k, this solution will only work for those drivers, but should fit the needs for the most laptop users.
2. We now need to install 2 additional tools to make out hotspot, 1st one is hostapd(hotspot server), 2nd one is dnsmasq(dns dhcp server)
in terminal type: sudo apt-get install hostapd dnsmasq
3. stop those services if started already, and prevent them from starting on system start up.
in terminal type:
sudo service hostapd stop
sudo service dnsmasq stop
sudo update-rc.d hostapd disable
sudo update-rc.d dnsmasq disable
4. Now we need to set up config files.
in terminal type: sudo gedit /etc/dnsmasq.conf
or sudo kate /etc/dnsmasq.conf if you use kde
add those lines to the config file
Code:
# Bind to only one interface
bind-interfaces
# Choose interface for binding
interface=wlan0
# Specify range of IP addresses for DHCP leasses
dhcp-range=192.168.150.2,192.168.150.10
5. hostapd config
in terminal type: sudo gedit /etc/hostapd.conf
and add those lines
Code:
# Define interface
interface=wlan0
# Select driver
driver=nl80211
# Set access point name
ssid=myhotspot
# Set access point harware mode to 802.11g
hw_mode=g
# Set WIFI channel (can be easily changed)
channel=6
# Enable WPA2 only (1 for WPA, 2 for WPA2, 3 for WPA + WPA2)
wpa=2
wpa_passphrase=mypassword
You can change ssid name and password for anything you want here. Current config will create hotspot named myhotspot with mypassword password.
6. Now create anywhere you want a file named start.sh
edit it with any text editor like this:
Code:
#!/bin/bash
# Start
# Configure IP address for WLAN
sudo ifconfig wlan0 192.168.150.1
# Start DHCP/DNS server
sudo service dnsmasq restart
# Enable routing
sudo sysctl net.ipv4.ip_forward=1
# Enable NAT
sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
# Run access point daemon
sudo hostapd /etc/hostapd.conf
# Stop
# Disable NAT
sudo iptables -D POSTROUTING -t nat -o ppp0 -j MASQUERADE
# Disable routing
sudo sysctl net.ipv4.ip_forward=0
# Disable DHCP/DNS server
sudo service dnsmasq stop
sudo service hostapd stop
You will probably need to change ppp0 in this to eth0 (or any other number which refers to your wired connection.
7. Last step. Now you can start your hotspot by starting our script. just run it using sudo sh
for me it looks like this sudo sh /home/ogyct/Desktop/start.sh because I have it on my desktop
I am not sure who is the author of this guide, I only translated it to english. But anyway if this helped, hit the thanks button. Good day
Android device having issues connecting to AP
I have an eth0 connection running behind an authenticated proxy server.
I followed the steps and managed to create a hotspot which my google nexus 7 detects. However, it seems stuck at "obtaining an ip address" and is not able to connect to the internet.
I initially received the following error message when running your script in the terminal:
dnsmasq: failed to create listening socket for 127.0.0.1: Address already in use [fail]​
I figured it is because of a conflict with the network manager, I commented out the "dns=dnsmasq" line in the nm configuration file. After a network-manager restart, the first error doesn't show up but I get the following:
Configuration file: /etc/hostapd.conf
Failed to create interface mon.wlan0: -23 (Too many open files in system)
Try to remove and re-create mon.wlan0​
In both cases, however, the hotspot is created and is detected by my android device. only that it cannot "obtain an ip address" and connect to it.
Is it because my eth0 connects via a proxy server?
Or could there be something wrong with the dnsmasq config? Any help would be appreciated.
anandkarthikeyan said:
I have an eth0 connection running behind an authenticated proxy server.
I followed the steps and managed to create a hotspot which my google nexus 7 detects. However, it seems stuck at "obtaining an ip address" and is not able to connect to the internet.
I initially received the following error message when running your script in the terminal:
dnsmasq: failed to create listening socket for 127.0.0.1: Address already in use [fail]​
I figured it is because of a conflict with the network manager, I uncommented "dns=dnsmasq" line in the nm configuration file. After a network-manager restart, the first error doesn't show up but I get the following:
Configuration file: /etc/hostapd.conf
Failed to create interface mon.wlan0: -23 (Too many open files in system)
Try to remove and re-create mon.wlan0​
In both cases, however, the hotspot is created and is detected by my android device. only that it cannot "obtain an ip address" and connect to it.
Is it because my eth0 connects via a proxy server?
Or could there be something wrong with the dnsmasq config? Any help would be appreciated.
Click to expand...
Click to collapse
I've never worked with a proxy server, but from what I see, it seems like your problem has nothing to do with a proxy server. Something's wrong with configuration on wifi side. Try to disable network manager first, if it doesn't help, try to completely clean dnsmaq and hostapd configs and paste code from this thread again. Unfortunately I can not provide any further help, since I have a different configuration on my side.
My galaxy s2 is able to see the "myhotspot" network created following this guide. I set a static ip and gateway to make it obtain an ip address.
Now it seems to be connected, but I have no internet access on my phone...
Could anyone help me?
gio182 said:
My galaxy s2 is able to see the "myhotspot" network created following this guide. I set a static ip and gateway to make it obtain an ip address.
Now it seems to be connected, but I have no internet access on my phone...
Could anyone help me?
Click to expand...
Click to collapse
I am using ubuntu 12.04 and I just figured out the instructions on ".../questions/180733/how-to-setup-a-wi-fi-hotspot-access-point-mode/" (askubuntu) thread worked like a charm for me. It uses the isc-dhcp-server instead of dnsmasq and a different dhcp range I guess. I really don't know enough to tell the difference but it worked. Maybe ogyct can explain it to us.
gio182 said:
My galaxy s2 is able to see the "myhotspot" network created following this guide. I set a static ip and gateway to make it obtain an ip address.
Now it seems to be connected, but I have no internet access on my phone...
Could anyone help me?
Click to expand...
Click to collapse
If everything's made right, there'll be no need for setting static ip adress, dhcp will do it for you.
Try to check if your devices are called wlan0 and eth0, if not, change configs accordingly. Simply type in console iwconfig to see the names. Remember, you may have a different configuration of your system, so be aware of that
HI ogyct,
This is the error i received.
Code:
wlan0: ERROR while getting interface flags: No such device
* Restarting DNS forwarder and DHCP server dnsmasq
dnsmasq: unknown interface wlan0
[fail]
net.ipv4.ip_forward = 1
Configuration file: /etc/hostapd.conf
Could not read interface wlan0 flags: No such device
Could not read interface wlan0 flags: No such device
nl80211 driver initialization failed.
net.ipv4.ip_forward = 0
* Stopping DNS forwarder and DHCP server dnsmasq * (not running)
And my wifi config reads this
Code:
*-network
description: Wireless interface
product: BCM4313 802.11b/g/n Wireless LAN Controller
vendor: Broadcom Corporation
physical id: 0
bus info: [email protected]:03:00.0
logical name: eth1
version: 01
serial: cc:af:78:78:44:03
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=wl0 driverversion=5.100.82.112 latency=0 multicast=yes wireless=IEEE 802.11
resources: irq:17 memory:f1500000-f1503fff
I guess I need to update the interfaces file in /etc/network....??
Any suggestions?
BCM4313 doesn't support AP
You wireless card doesn't support the AP operation mode. You can look up on the hostapd support website and there is a list of suppored devices. The BCM 4313 is part of brcmsmac which is in the NO section for AP. You would need to get a new card or purchase an external wifi card. Hope this helps.
bad_asteroid said:
HI ogyct,
This is the error i received.
Code:
wlan0: ERROR while getting interface flags: No such device
* Restarting DNS forwarder and DHCP server dnsmasq
dnsmasq: unknown interface wlan0
[fail]
net.ipv4.ip_forward = 1
Configuration file: /etc/hostapd.conf
Could not read interface wlan0 flags: No such device
Could not read interface wlan0 flags: No such device
nl80211 driver initialization failed.
net.ipv4.ip_forward = 0
* Stopping DNS forwarder and DHCP server dnsmasq * (not running)
And my wifi config reads this
Code:
*-network
description: Wireless interface
product: BCM4313 802.11b/g/n Wireless LAN Controller
vendor: Broadcom Corporation
physical id: 0
bus info: [email protected]:03:00.0
logical name: eth1
version: 01
serial: cc:af:78:78:44:03
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=wl0 driverversion=5.100.82.112 latency=0 multicast=yes wireless=IEEE 802.11
resources: irq:17 memory:f1500000-f1503fff
I guess I need to update the interfaces file in /etc/network....??
Any suggestions?
Click to expand...
Click to collapse
a little help
I made the hotspot successfully but its not sharing the internet connection
im using linuxmint 14 and HUAWEI EC1261-2 (EVDO)
unkown interface error
it says unknown interface wlan1 [fail]
.....phone detects the network but gets stuck during authentication, and then disabled, and keeps on trying...
stuck at # what to do please help
getting an error
here's the error i'm getting
Code:
SIOCSIFFLAGS: Operation not possible due to RF-kill
* Restarting DNS forwarder and DHCP server dnsmasq
dnsmasq: failed to create listening socket for 127.0.0.1: Address already in use
[fail]
net.ipv4.ip_forward = 1
Configuration file: /etc/hostapd.conf
Could not set interface wlan0 flags: Operation not possible due to RF-kill
nl80211: Failed to set interface wlan0 into AP mode
nl80211 driver initialization failed.
ELOOP: remaining socket: sock=4 eloop_data=0x8e20908 user_data=0x8e20e88 handler=0x807c5e0
ELOOP: remaining socket: sock=6 eloop_data=0x8e22ca0 user_data=(nil) handler=0x8086770
net.ipv4.ip_forward = 0
* Stopping DNS forwarder and DHCP server dnsmasq * (not running)
It doesn't work!
It's a pity!
Thanks
THANKS BRO IT REALLY WORKED LIKE A CHRAM!!!!! :highfive:
Thanks!
ogyct said:
As many of you know, most of our android(not only android) devices can't connect to ad hoc hotspots. There's a solution for win7/8 users to set up infrastructure hotspot on their laptop using software like connectify and so on. Ubuntu also allows to create wifi hotspot to share internet, but it will be ad hoc one.
So here's the guide how to set up infrastructure hotspot on ubuntu 12.04/12.10. Unlike some other methods described on the internet, this one will not break default network manager.
1. First of all you should make sure, that your wifi adapter supports infrastructure hotspots. If you used connectify on your windows system and it worked, skip this step.
open terminal and type: sudo lshw | less
find -network section and make sure that driver is ath5k or ath9k, this solution will only work for those drivers, but should fit the needs for the most laptop users.
2. We now need to install 2 additional tools to make out hotspot, 1st one is hostapd(hotspot server), 2nd one is dnsmasq(dns dhcp server)
in terminal type: sudo apt-get install hostapd dnsmasq
3. stop those services if started already, and prevent them from starting on system start up.
in terminal type:
sudo service hostapd stop
sudo service dnsmasq stop
sudo update-rc.d hostapd disable
sudo update-rc.d dnsmasq disable
4. Now we need to set up config files.
in terminal type: sudo gedit /etc/dnsmasq.conf
or sudo kate /etc/dnsmasq.conf if you use kde
add those lines to the config file
Code:
# Bind to only one interface
bind-interfaces
# Choose interface for binding
interface=wlan0
# Specify range of IP addresses for DHCP leasses
dhcp-range=192.168.150.2,192.168.150.10
5. hostapd config
in terminal type: sudo gedit /etc/hostapd.conf
and add those lines
Code:
# Define interface
interface=wlan0
# Select driver
driver=nl80211
# Set access point name
ssid=myhotspot
# Set access point harware mode to 802.11g
hw_mode=g
# Set WIFI channel (can be easily changed)
channel=6
# Enable WPA2 only (1 for WPA, 2 for WPA2, 3 for WPA + WPA2)
wpa=2
wpa_passphrase=mypassword
You can change ssid name and password for anything you want here. Current config will create hotspot named myhotspot with mypassword password.
6. Now create anywhere you want a file named start.sh
edit it with any text editor like this:
Code:
#!/bin/bash
# Start
# Configure IP address for WLAN
sudo ifconfig wlan0 192.168.150.1
# Start DHCP/DNS server
sudo service dnsmasq restart
# Enable routing
sudo sysctl net.ipv4.ip_forward=1
# Enable NAT
sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
# Run access point daemon
sudo hostapd /etc/hostapd.conf
# Stop
# Disable NAT
sudo iptables -D POSTROUTING -t nat -o ppp0 -j MASQUERADE
# Disable routing
sudo sysctl net.ipv4.ip_forward=0
# Disable DHCP/DNS server
sudo service dnsmasq stop
sudo service hostapd stop
You will probably need to change ppp0 in this to eth0 (or any other number which refers to your wired connection.
7. Last step. Now you can start your hotspot by starting our script. just run it using sudo sh
for me it looks like this sudo sh /home/ogyct/Desktop/start.sh because I have it on my desktop
I am not sure who is the author of this guide, I only translated it to english. But anyway if this helped, hit the thanks button. Good day
Click to expand...
Click to collapse
This is running awesome. Just one question. How do I stop the script?
I find disabling and enabling wifi works. But is there any other way?
Hi, this script works perfectly. I was having issues with ubuntu shared wifi not being visible with android.
Now the hard question. I have a box that is already acting as a router sharing ip with dnsmasq over eth1
i added a wifi card wlan0 and i want to share not only internet but also the services running on my box
the problem is this script uses a different ip range and i cannot access my nfs shares.
my network is 192.168.128.x and i have set up this script in other range.
Setting it up in 192.168.128.10x for instance will not work
Is it possible to make this wifi share part of my network?
regards.
worked !!!
ogyct said:
As many of you know, most of our android(not only android) devices can't connect to ad hoc hotspots. There's a solution for win7/8 users to set up infrastructure hotspot on their laptop using software like connectify and so on. Ubuntu also allows to create wifi hotspot to share internet, but it will be ad hoc one.
So here's the guide how to set up infrastructure hotspot on ubuntu 12.04/12.10. Unlike some other methods described on the internet, this one will not break default network manager.
1. First of all you should make sure, that your wifi adapter supports infrastructure hotspots. If you used connectify on your windows system and it worked, skip this step.
open terminal and type: sudo lshw | less
find -network section and make sure that driver is ath5k or ath9k, this solution will only work for those drivers, but should fit the needs for the most laptop users.
2. We now need to install 2 additional tools to make out hotspot, 1st one is hostapd(hotspot server), 2nd one is dnsmasq(dns dhcp server)
in terminal type: sudo apt-get install hostapd dnsmasq
3. stop those services if started already, and prevent them from starting on system start up.
in terminal type:
sudo service hostapd stop
sudo service dnsmasq stop
sudo update-rc.d hostapd disable
sudo update-rc.d dnsmasq disable
4. Now we need to set up config files.
in terminal type: sudo gedit /etc/dnsmasq.conf
or sudo kate /etc/dnsmasq.conf if you use kde
add those lines to the config file
Code:
# Bind to only one interface
bind-interfaces
# Choose interface for binding
interface=wlan0
# Specify range of IP addresses for DHCP leasses
dhcp-range=192.168.150.2,192.168.150.10
5. hostapd config
in terminal type: sudo gedit /etc/hostapd.conf
and add those lines
Code:
# Define interface
interface=wlan0
# Select driver
driver=nl80211
# Set access point name
ssid=myhotspot
# Set access point harware mode to 802.11g
hw_mode=g
# Set WIFI channel (can be easily changed)
channel=6
# Enable WPA2 only (1 for WPA, 2 for WPA2, 3 for WPA + WPA2)
wpa=2
wpa_passphrase=mypassword
You can change ssid name and password for anything you want here. Current config will create hotspot named myhotspot with mypassword password.
6. Now create anywhere you want a file named start.sh
edit it with any text editor like this:
Code:
#!/bin/bash
# Start
# Configure IP address for WLAN
sudo ifconfig wlan0 192.168.150.1
# Start DHCP/DNS server
sudo service dnsmasq restart
# Enable routing
sudo sysctl net.ipv4.ip_forward=1
# Enable NAT
sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
# Run access point daemon
sudo hostapd /etc/hostapd.conf
# Stop
# Disable NAT
sudo iptables -D POSTROUTING -t nat -o ppp0 -j MASQUERADE
# Disable routing
sudo sysctl net.ipv4.ip_forward=0
# Disable DHCP/DNS server
sudo service dnsmasq stop
sudo service hostapd stop
You will probably need to change ppp0 in this to eth0 (or any other number which refers to your wired connection.
7. Last step. Now you can start your hotspot by starting our script. just run it using sudo sh
for me it looks like this sudo sh /home/ogyct/Desktop/start.sh because I have it on my desktop
I am not sure who is the author of this guide, I only translated it to english. But anyway if this helped, hit the thanks button. Good day
Click to expand...
Click to collapse
Thank you.
Its worked successfully in Xperia J.
Worked in Linux Mint v15 (based on Ubuntu 13.04)
johnp
A little update, I am glad if this guide helped. but in case it didn't try this one http://www.webupd8.org/2013/06/how-to-set-up-wireless-hotspot-access.html. I didn't check this myself, but that script seems to be smart.

Will this work for VPN...?

Install openvpn and then place your edited client vpn config files and certificate files on the storage of FireTV similar to the raspberry pi method in the thread below:
h**p xbmchub.com/forums/threads/24769-How-to-set-up-your-VPN-on-raspberry-pi-using-Brain-Hornsby-Openvpn-for-XBMC
Thanks for anyone that may know more than me that could maybe get this to work...
Hmm would be nice if that worked. Did u get a chance to try it?
Sent from my Nexus 5 using XDA Free mobile app
tdfsu said:
h**p xbmchub.com/forums/threads/24769-How-to-set-up-your-VPN-on-raspberry-pi-using-Brain-Hornsby-Openvpn-for-XBMC
Click to expand...
Click to collapse
I'm working on something like this just now. Here's the thing: in my logs for the simplest openvpn app to install (not straight openvpn, it turns out, as there's a windowing issue there that makes it difficult / impossible to navigate through setup, even with a keyboard and Droidmote) once I have a config, I get errors in logcat informing me
"Your image does not support the VPNService API, sorry "
There is a manually installable openvpn binary that I've looked at a bit but not yet configured. It is going to require adding a binary to /system/xbin directly, as the installer (at least on my phone) does not understand where /system/xbin really lives and issues a remount command to a nonexistent partition.
If you're running dd-wrt or similar configurable firewall, another option is to get an account with a provider who is set up to let you do a firewall to firewall connection, and then route either all of your traffic or the traffic from your firetv through that firewall-to-firewall connection.
I have a Private Internet Access vpn account.
Installed openvpn on FireTV--
http play.google.com/store/apps/details?id=de.schaeuffelhut.android.openvpn.installer&hl=en
Installed busybox on FireTV--
http play.google.com/store/apps/details?id=stericson.busybox&hl=en
I created a pass.txt file with my PIA username on the first line and password on the second line, nothing else, then saved the file as a text file (pass.txt).
Download the following to PC--
http privateinternetaccess.com/openvpn/openvpn.zip
Extracted the zip file.
Edited the location specific .ovpn file (see below), changing the 'remote', 'ca', 'crl' and 'auth' lines to the following--
client
dev tun
proto udp
remote us-florida.privateinternetaccess.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca /storage/sdcard0/openvpn/ca.crt
tls-client
remote-cert-tls server
auth-user-pass /storage/sdcard0/openvpn/pass.txt
comp-lzo
verb 1
reneg-sec 0
crl-verify /storage/sdcard0/openvpn/crl.pem
Then, save the USFlorida.ovpn file.
Upload ca.crt, crl.pem, pass.txt, and .ovpn file to FireTV to /storage/sdcard0/openvpn/
Open terminal on FireTV. I use jackpal's terminal app below, but you can also use adb.
http play.google.com/store/apps/details?id=jackpal.androidterm
In terminal, type the following--
su
openvpn cd /storage/sdcard0/openvpn/USFlorida.ovpn
But I get several errors. Anyway, that's where I'm at. Maybe someone else more knowledgeable than me can figure it out. Sorry about the links, my low post-count will not allow me to post url's.
Also, you can sideload the following app to verify your external ip address, and it works great with the FireTV remote--
http play.google.com/store/apps/details?id=igit.WhatIsMyIp
The approach you've taken is where I'd be headed next on the client side.
One thing you might want to try is to do the same setup a less locked-down device and confirm that the config files work as expected there.
There's also a good discussion of the hardware approach (setting up a tunnel from your edge to a VPN provider) in the other VPN thread, http://forum.xda-developers.com/showthread.php?t=2797005
also, private internet access will sell a preconfigured router for this purpose!

VPN + Wifi Tethering = Extremely Slow

I have a vpn service that I connect to on a regular basis. I want to wifi tether to two other android devices with this VPN connection. However, when I have the VPN connected and wifi tether on my G4, the clients connect at a VERY slow rate (>1 kb/s). I can't even pull up a Google in Chrome because it's so slow.
I have seen on the interwebs that I need to run some iptables commands like so...
Code:
iptables -t filter -F FORWARD
iptables -t nat -F POSTROUTING
iptables -t filter -A FORWARD -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE
But this has no effect. I think these procedures might be a little outdated since we are on 5.1. Does anyone know of a VPN+Tether procedure that works on our G4's?
Bump
Solved!
NOTE: This required root access
1. Install WiFi Tether Router from the Play Store ($2.80)
2. Configure WiFi Tether Router like so:
Code:
Interface wlan0
Method 2
Channel 1
Encryption wpa2-psk (Don't forget to set password)
"No Firmware Reload" <- UNCHECKED
3. Connect to your VPN (I used the stock G4 settings)
4. Enable Wifi Tether Router (Asks for Root)
5. Enjoy!
All clients that connect to your G4 via Wifi Tether Router should now be within the VPN. You can check this by going to http://whatismyipaddress.com/

dnsmasq.conf location?

In the latest 5.0.3 build for the 5T, I see dnsmasq is running in /system/bin/dnsmasq
Awesome, I want to use it. The question is, if I put my config file in /system/etc/dnsmasq.conf will dnsmasq see it and run my config? If not there, where does it need to go in order to work?
Interesting.
I'll give it a try later today.
I'd say put your configuration and see if that works. Not sure if cycling the connection would work or if you'll need a full reboot tho.
W.
Awesome, please let us know.
For those who are unfamiliar with dnsmasq, it allows users to block domains (e.g. malware.com) without having to also block all of its subdomains (e.g. www.malware.com, infect.malware.com, hidden01.malware.com, hidden02.malware.com, etc).
The /etc/hosts file commonly used to block connections cannot do this, it requires you to list every subdomain, which turns blocking sites into a game of whack-a-mole as malware sites simply invent new subdomains every day.
That's why dnsmasq is so important, and I'm glad to see that the service is running on Android.
dnsmasq is used only during tethering. Right?
Actually, you cannot find dnsmasq.conf in any directory. I think it is hard-coded in settings app.
But, you can follow these steps to use your own dnsmasq.conf
turn on tethering
kill dnsmasq
Code:
killall dnsmasq
run dnsmasq with your own configuration
Code:
dnsmasq -C /path/to/dnsmasq.conf -x /path/to/dnsmasq.pid
enjoy
This requires your device to be rooted. I use this method to host captive portal on my android device.

Categories

Resources