Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way I can configure my notebook as an access point for the desktop pc, my tablet and phone over an internet connection I'm sharing with my neighbor which only connects from the balcony of my house?

share|improve this question
    
how did you connected your netbook with your neighbour's pc? –  Avinash Raj Dec 1 '13 at 12:38

1 Answer 1

This is the tutorial I am using right now and I am sharing with you. Credit goes to XDA Developers.

  • Open your terminal and paste as

    sudo apt-get install hostapd dnsmasq
    
  • Then paste these one after one.

    sudo service hostapd stop
    sudo service dnsmasq stop
    sudo update-rc.d hostapd disable
    sudo update-rc.d dnsmasq disable
    
  • after that paste as

    sudo gedit /etc/dnsmasq.conf

and paste these lines

# 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
  • Then again

      sudo gedit /etc/hostapd.conf
    

paste this

# 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

Now open a text editor and paste

#!/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

and save it with any script.sh name and do as

chmod +x scriptname.sh
./scriptname.sh

so you will have a wifi access point.

Note: ssid=myhotspot

set the access point name as you want by editing there.

wpa_passphrase=mypassword

here you can set your password as you want.

sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

change ppp0 to the connection from which you will get Internet.

sudo iptables -D POSTROUTING -t nat -o ppp0 -j MASQUERADE

Here also same change it.

And we are ready to go.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.