I'm using streamyx for Internet connection at home. I've a laptop with an Ethernet card and a wireless card. Then, I started to google on how to share internet connection with other laptops using wireless connection since my LAN card is occupied with streamyx cable.
For setting up my machine as a gateway, it quite similar to previous post here, but it can simply be done by configuring firewall. Then, we can create an Ad-Hoc connection so that other machines (client) can simply connect to my laptop without the need of access point. In addition, in order to automatically configure IP address, gateway and DNS server address on client machine, we can set up DHCP server in the laptop (gateway machine). Following are the steps for make it works :
Note that all configuration is done on gateway machine.
Step 1: Connect to streamyx
Right-click on network manager applet, then choose 'Edit Connections..'
Select DSL tab and click 'Add' to add new connection. Then rename connection name to 'streamyx' or anything you want. Enter your username, password and service as shown in picture below. Tick connect automatically if want to allow connection on startup. Click 'Apply' to finish
Click on applet again, and now streamyx connection should be appear under 'Wired Networks'. Select to connect.
Step 2: Configure Firewall (from this step, all need to be done as root)
Open terminal and type
$ su
# system-config-firewall
Select 'Masquerading' and tick as bellow (thanks to KageSenshi)
Step 3: Setup DHCP server
First, install dhcpd (in fedora 12, dhcp package is using version 4)
# 'yum install dhcp
Check your DNS server to be used in dhcp configuration file
$ less /etc/resolv.conf
Output should be appear like this
# Generated by NetworkManager
nameserver 204.177.0.3
nameserver 204.177.1.12
Then, edit dhcpd configuration file (use familiar text editor such as gedit, vi or nano)
$ su -c 'gedit /etc/dhcp/dhcpd.conf'
Then, make it similar as bellow and match the address of DNS at 'option domain-name-servers'
# beginning of file
default-lease-time 86400;
max-lease-time 604800;
authoritative;
ddns-update-style interim;
option domain-name-servers 204.177.0.3
,204.177.1.12
;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.1 192.168.1.5; # only 5 person can connect
option broadcast-address 192.168.1.6;
option routers 192.168.1.1; # gateway address
}
# end of file
Step 4: Create an Ad-Hoc connection
Enable wireless connection, then select 'Create New wireless Network'
Choose any wireless security you want or simply choose none. Click 'Create' to finnish.
Again right-click on the network manager applet and choose 'Edit Connections'. Then, under 'Wireless' tab, select your connection name and edit as follow
Click on applet, and select 'Connect to Hidden Wireless Network' and connect.
Finally, restart dhcp server
# sudo service dhcpd restart
Note that you need to connect to the created ad-hoc connection first (in my case, it is 'anyname') before you can start dhcp server.
Now, everyone near to you can see you Ad-hoc connection. Configure client's IP address using 'automatic configuration'. Once they connect to your ad-hoc connection through WiFi, they can surf to internet and facebooking all the time :P
References:
No comments:
Post a Comment