Skip navigation

Step 1: Tethering

Running Android? Install azilink
Something else? Find a way to tether…

Make note of the device you’re using to connect (e.g. azilink –> tun0, “real tethering” –> usb0, etc)

Step 2: Ad-Hoc Network

— Server side (the tethered device) —

# Set up ad-hoc network:
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 essid Jkrez # <-- network name here
ifconfig wlan0 10.0.0.1

# Some quick permissions…
echo 1 > /proc/sys/net/ipv4/ip_forward
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1

# Make me a router! (note -o “output” device, -i “input” device)
iptables -A FORWARD -o tun0 -i wlan0 -s 10.0.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE

— DHCP Server —

Don’t want to manually configure clients? Time for a little dhcp3d server action:

sudo apt-get install dhcp3-server

edit /etc/default/dhcpd3-server

INTERFACES="tun0" #<-- same interface name as above

edit /etc/dhcpd3/dhcpd.conf
Add/change the following:

authoritative;

option domain-name “Jkrez”; #essid from before
option domain-name-servers 4.2.2.2 #Google dns, or your favorite dns

subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 10.0.0.1;
option subnet-mask 255.255.255.0
option time-offset -18000; #Eastern timezone
range 10.0.0.100 10.0.0.200;
}

Then run:
sudo /etc/init.d/dhcpd3-server

Now clients should be able to auto connect. Enjoy!

— Don’t want to mess with a dhcp server? —

Set up a client (GUI edition!)

In NetworkManager try to connect to Jkrez (this will fail since no dhcp)
Right Click and “edit connections”, in Wireless tab select Jkrez and “Edit”
Go to IPv4 Settings and enter:
IP 10.0.0.2 # Unique IP for each client
Netmask 255.255.255.0
Gateway 10.0.0.1

DNS 4.2.2.2 # Or your favorite nameserver

These steps can also be done via CLI; setup ad-hoc wifi same way using iwconfig, ip/mask/gateway via ifconfig, and dns vi /etc/resolv.conf

—————————-

Thanks to my friend Pat, and the following linux links for tips along the way:
https://help.ubuntu.com/community/Internet/ConnectionSharing?action=show&redirect=InternetConnectionSharing
https://help.ubuntu.com/community/dhcp3-server

Advertisements

One Comment

  1. I was recommended this website by my cousin. I am not sure whether this post is written by
    him as no one else know such detailed about my trouble.
    You are amazing! Thanks!


2 Trackbacks/Pingbacks

  1. […] Making A Ubuntu Hotspot (jkrez.wordpress.com) […]

  2. By Wireless bridge, update | cartesian product on 21 Jul 2011 at 12:38 pm

    […] Making A Ubuntu Hotspot (jkrez.wordpress.com) […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: