How to Share netbook wifi internet access

My Netbook is Axio pico, with OS Ubuntu 11.04
below for setup wifi device to Access Point Indoor room
Conncet your netbook to internet, and open your terminal console

#sudo apt-get install hostpad
#sudo apt-get install dhcp3-server
#sudo apt-get update dhcp3-server
#sudo gedit /etc/dhcp3/dhcpd.conf

write this config:
# /etc/dhcp3/dhcpd.conf
ddns-update-style none;
option subnet-mask 255.255.255.0;
#default-lease-time 600;
#max-lease-time 7200;
#authoritative;
subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.1 192.168.1.254;
  option domain-name-servers 8.8.8.8, 8.8.4.4;
  option domain-name "internal.ubuntu";
  option routers 192.168.1.1;
  option broadcast-address 192.168.1.255;
#  default-lease-time 600;
#  max-lease-time 7200;
}

before exit, don't forget save configuration. Than do command at below,

sudo gedit /etc/default/dhcp3-server

write this config:
# Defaults for dhcp initscript
# sourced by /etc/init.d/dhcp
# installed at /etc/default/dhcp3-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".

INTERFACES="wlan0"

before exit, don't forget save configuration.
For edit Access Point configuration, follow below,

sudo gedit hostapd.conf

write this config:

interface=wlan0
driver=nl80211
ssid=ubuntuspot
channel=1
hw_mode=g
auth_algs=1
wpa=3
wpa_passphrase=1234567890
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP

before exit, don't forget save configuration. Than do command at below,


sudo gedit /etc/network/interfaces

auto lo eth0 wlan0
iface lo inet loopback
iface eth0 inet static
address 192.168.2.2
netmask 255.255.255.0
gateway 192.168.1.1
iface wlan0 inet dhcp
before exit, don't forget save configuration. Than do command at below,
restart network.
$sudo /etc/init.d/network restart

for setting IPForwarding, do below:

sudo gedit /etc/sysctl.conf

write this config:

# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
#  Enabling this option disables Stateless Address Autoconfiguration
#  based on Router Advertisements for this host
net.ipv6.conf.all.forwarding=1

before exit, don't forget save configuration.

All Configuration is done, then connect modem to Netbook (USB Port)

after modem connect to netbook, follow this command below.

$eject /dev/sr0

$sudo wvdial
$sudo sysctl -w net.ipv4.conf.all.forwarding=1
$sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
$sudo ifconfig wlan0 inet 192.168.1.1 netmask 255.255.255.0
$sudo hostapd -d hostapd.conf
$sudo /etc/init.d/dhcp3-server start

When you pairing wirelless connect, name of wirelless network is "ubuntuspot" and ask then need to insert keys, the keys is 1234567890.

This book recommand to learn basic unix command.

 

So Enjoy

No comments: