How to use your laptop as an internet access point for a desktop
I have tested this thoroughly since its original creation. In the meanwhile I upgraded the OS on the laptop form Hoary to Breezy. Now that both the computers in question are running Breezy and this has been tested fully I am posting it here. The original thread where I posted about this topic in the Hoary section is here and it was based on this thread. Special thanks to mlomker for his kind and vital assistance.
The goal here is to use a crossover cable and a wireless laptop to connect to the internet from a desktop computer that is too far from the router to run a cable.
By the way, there are a lot of words here, but that is because I like to be complete, not because this is hard. Read the whole thing before you start and you will discover this isn't real technical or difficult.
Notes:
I am running Ubuntu Breezy 5.10 on both the laptop and desktop.
My laptop is an AOpen 1557gls, configuration listed here in the entry I made on the Ubuntu Wiki.
My desktop is made up of a bunch of old parts including an AMD Duron processor. It is nothing special except it has a working ethernet card that I pretested by plugging it directly into my router.
My router is a Linksys WRT54G with the latest official firmware. This will likely work with other hardware and setups, but I have only tested it with mine. I am using WPA, but since all that is needed here is a working wireless connection that is beyond the scope of this howto. I connect from the router to the high-speed modem using DHCP.
Before you start:
Make sure you have a working connection from your wireless laptop to your router and from there to the internet.
Make sure you know how to use and set up your router as well as how to find it's configuration. For me this is through a browser interface at 192.168.1.1 when connected directly to the router via an ethernet cable or wireless connection.
Find the following information from your router's configuration. I will list mine (where security permits) for comparison and so you can see it below as we continue. On the linksys wrt54g with firmware version 4.20.7 this is found under Status->Router in the configuration pages.
IP address: 192.168.15.100
Default gateway: 192.168.15.1
Subnet mask: 255.255.255.0
Domain name: your.netprovider.net
DNS: xxx.xxx.xxx.xxx (there will likely be 2 or 3 assigned to you by your internet provider and DHCP)
*for me to log into my router from any computer on the network the address is 192.168.1.1
*the router assigns addresses to computers using it from 192.168.1.100 to 192.168.1.149
Things you will need:
A desktop computer with a working Ubuntu installation and a tested and known to work ethernet card. (I will call this desktop)
A ethernet crossover cable...NOT a regular ethernet cable
A wireless access point that is already configured properly and has access to the internet (I will call this router)
A laptop or other computer with a working Ubuntu installation and a wireless connection that is configured properly and already works (I will call this laptop)
Step 0: Plug in the cable
Plug the crossover cable in to the ethernet ports on the desktop and the laptop. Make sure both computers are turned on before you continue. It will be easiest if the computers are right next to each other for this process.
Step 1: Firestarter on the laptop to configure access:
a. If you have a firewall installed on the laptop, disable and uninstall it. We will use Firestarter as it is easy to configure. If you already know how to configure your firewall and want to continue using it, feel free to do so.
b. Install Firestarter on your laptop, either using synaptic or apt-get install firestarter.
c. Configure Firestarter:
Preferences->Network Settings
-select the laptop's wireless card (for me eth1) as your "Internet Connected Network Device"
-select the laptop's ethernet card (for me eth0) as your "Local Network Connected Device"
-select "Enable internet connection sharing"
Step 2: Configuring your network rules on the laptop
From the panel menu: System->Administration->Networking
Your wireless connection (for me eth1) should already be configured properly and working so I won't discuss that here. Your settings for that card/connection will not change at all.
Highlight your Ethernet Connection (for me eth0) and select "Properties"
Check "This device is configured"
Configuration: Static IP address
IP Address: 192.168.2.102 *see note just below
Subnet mask: 255.255.255.0
Gateway address: 192.168.15.100 +see note just below
Choose your wireless connection as the "Default gateway device"
Click "ok" because you are done here.
*the important thing here is to choose a different subnet from what your router assigns to computers connected to it. Mine assigns addresses in the 192.168.1.xxx subnet so I chose to use here 192.168.2.xxx
+This is from the Default Gateway listed in the router's setup page as shown above.
Step 3: Configuring your network rules on the desktop
From the panel menu: System->Administration->Networking
Highlight your Ethernet Connection and select "Properties"
Check "This device is configured"
Configuration: Static IP address
IP Address: 192.168.2.103 *see note just below
Subnet mask: 255.255.255.0
Gateway address: 192.168.2.102 +see note just below
Choose your wireless connection as the "Default gateway device"
Click "ok" because you are done here.
*the important thing here is to choose the same subnet as your laptop is using. Earlier we used 192.168.2.102 subnet so I chose to use here 192.168.2.103. Same subnet, different computer.
+This has to be the same as the IP address for your laptop's ethernet connection (eth0).
Step 4: Configuring the Domain Name and servers properly
This step insures that your desktop will have access to the internet the same way the laptop does and be able to use names for web sites and not just IP addresses...in other words, we are going to tell your desktop the some of the same information manually that your router is telling your laptop through DHCP.
On your laptop, open the file /etc/resolv.conf
In it you will find something like this:
Code:
search your.netprovider.net
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
Keep this information handy.
Go to the desktop and put the exact information in the file /etc/resolv.conf on the desktop using your favorite editor.
Code:
sudo gedit /etc/resolv.conf
It is probable that this file is currently blank. In any case, completely erase the contents if there are any and type in exactly what is shown in the same file on your laptop then save.
Okay. Time to test. Open firefox and type something simple in the address bar like "www.google.com"
If we did everything right it will work, but we are not quite done.
The resolv.conf file will be regenerated on the desktop every time you reboot. Unless you enjoy recreating the file each time, there is one more step remaining.
While the current internet connection is working on the desktop, with all the extra repositories enabled, fire up synaptic or apt-get install resolvconf on the desktop.
Once that is installed do this on the desktop
Code:
sudo cp /etc/network/interfaces /etc/network/interfaces_backup
sudo gedit /etc/network/interfaces
and add the following to that file under the heading shown using the information from your current, working /etc/resolv.conf:
Code:
iface eth0 inet static
dns-nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx
dns-search your.netprovider.net
This will automatically create your (correct) /etc/resolv.conf file every time you reboot.
Please post any mistakes you find and I will correct them. I don't know how adept I can be at answering questions as I just learned this myself, but feel free to post those here as well and I will try or we can hope someone more knowledgable can assist as well.
Also, I plan to submit this to the wiki soon after a few other people have tested the how-to and confirmed it works.
EDIT: Done and in CategoryCleanup awaiting final inclusion. Temporary wiki address is here.
Bookmarks