Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: How to use your laptop as an internet access point for a desktop

  1. #1
    Join Date
    Apr 2005
    Location
    Parts Unknown
    Beans
    9,213
    Distro
    Ubuntu Development Release

    How to use your laptop as an internet access point for a desktop

    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.
    Last edited by matthew; November 22nd, 2005 at 05:00 AM.
    what's a troll? | my blog | my writing | Ubuntu Unleashed

    Don't ask support questions in PMs--post a thread so everyone can benefit!

  2. #2
    Join Date
    Mar 2005
    Location
    Belgium
    Beans
    327
    Distro
    Xubuntu 13.04 Raring Ringtail

    Re: How to use your laptop as an internet access point for a desktop

    Works for me.


    I used to do it the quick and dirty way, as laid out on the Firestarter website : http://www.fs-security.com/docs/connection-sharing.php i.e.: w/o the resolv.conf tweak, because I never type in adresses in the adressbar anyway, but this is a nice addition

    BTW, it is simple to rip open an existing patchcable and to the cable-twist in order to make it a crossover http://www.makeitsimple.com/how-to/dyi_crossover.htm

  3. #3
    Join Date
    Apr 2005
    Location
    Parts Unknown
    Beans
    9,213
    Distro
    Ubuntu Development Release

    Re: How to use your laptop as an internet access point for a desktop

    Rxke, thanks for trying it out and posting your experience. I am gratified to hear it worked for you. I also appreciate the links!
    what's a troll? | my blog | my writing | Ubuntu Unleashed

    Don't ask support questions in PMs--post a thread so everyone can benefit!

  4. #4
    Join Date
    Mar 2005
    Location
    Belgium
    Beans
    327
    Distro
    Xubuntu 13.04 Raring Ringtail

    Re: How to use your laptop as an internet access point for a desktop

    You're welcome.
    but come to think of it... i mainly followed the 'simple' approach posted on the Firestarter site, then checked your info when things didn't work directly.
    BTW, this works cross-platform too, I use my laptop under Breezy to connect my desktop running OSX...

  5. #5
    Join Date
    Jul 2005
    Location
    israel
    Beans
    252

    Re: How to use your laptop as an internet access point for a desktop

    do I need the firewall (firestarter) to make it work or just for security reasons?
    'cause Im not running any now. and I prefer not to install it if it is not essential.

  6. #6
    Join Date
    Apr 2005
    Location
    Parts Unknown
    Beans
    9,213
    Distro
    Ubuntu Development Release

    Re: How to use your laptop as an internet access point for a desktop

    Quote Originally Posted by kroiz
    do I need the firewall (firestarter) to make it work or just for security reasons?
    'cause Im not running any now. and I prefer not to install it if it is not essential.
    It's not necessary if you can figure out another way to enable internet connection sharing.

    I have found Firestarter to be an easy way to manage port access to a computer. It is really just a graphic frontend for IP Tables, the linux kernel's powerful firewall. It's easy to use so I recommend it.

    If you have a preferred method without using Firestarter you can use it.
    what's a troll? | my blog | my writing | Ubuntu Unleashed

    Don't ask support questions in PMs--post a thread so everyone can benefit!

  7. #7
    Join Date
    Jul 2005
    Location
    israel
    Beans
    252

    Re: How to use your laptop as an internet access point for a desktop

    Quote Originally Posted by matthew
    It's not necessary if you can figure out another way to enable internet connection sharing.
    If you have a preferred method without using Firestarter you can use it.
    got it, thanks.

    I got another question. what will happen when I will connect my laptop at work thru the ethernet? it wont work now. right? because I change it to static ip.

    any elegant solution except manualy changing from DHCP to static when I get home and then at work from static to DHCP.

    -Edit: I see that there is something called location in the network dialog, so I guess I can configure a location for home and work and set them to static and DHCP.
    I wonder if there is a way to make linux start with the right location? so when I boot my laptop at work it will start with the right network profile.
    Last edited by kroiz; October 29th, 2005 at 12:13 AM.

  8. #8
    Join Date
    Apr 2005
    Location
    Parts Unknown
    Beans
    9,213
    Distro
    Ubuntu Development Release

    Re: How to use your laptop as an internet access point for a desktop

    Quote Originally Posted by kroiz
    got it, thanks.

    I got another question. what will happen when I will connect my laptop at work thru the ethernet? it wont work now. right? because I change it to static ip.

    any elegant solution except manualy changing from DHCP to static when I get home and then at work from static to DHCP.
    I've never done it, but there is a way to make the go-through computer use DHCP, so your laptop then could use DHCP in both places. You would need to search on the wiki...pretty sure I saw something about this there. http://www.ubuntulinux.org/wiki If not there, try Google. I know this can be done, but never having done it I don't know what it would take. It might end up being pretty easy.
    what's a troll? | my blog | my writing | Ubuntu Unleashed

    Don't ask support questions in PMs--post a thread so everyone can benefit!

  9. #9
    Join Date
    Jul 2005
    Location
    israel
    Beans
    252

    Re: How to use your laptop as an internet access point for a desktop

    I thought I could do this without the firewall untill I bumped into this:
    From the "Linux IP Masquerade HOWTO", Chapter 3. Setting Up IP Masquerade:
    Code:
     Once you have IP MASQ functioning, it is HIGHLY recommended for the user to implement a STRONG IPFWADM/IPCHAINS firewall ruleset.
    so I'm gonna try it as in this howto.
    btw I still dont understand why the firewall is needed and still curious, so if anyone care to explaine...
    Last edited by kroiz; October 29th, 2005 at 10:20 PM.

  10. #10
    Join Date
    Apr 2005
    Location
    Parts Unknown
    Beans
    9,213
    Distro
    Ubuntu Development Release

    Re: How to use your laptop as an internet access point for a desktop

    Quote Originally Posted by kroiz
    I thought I could do this without the firewall untill I bumped into this:
    From the "Linux IP Masquerade HOWTO", Chapter 3. Setting Up IP Masquerade:
    Code:
     Once you have IP MASQ functioning, it is HIGHLY recommended for the user to implement a STRONG IPFWADM/IPCHAINS firewall ruleset.
    so I'm gonna try it as in this howto.
    btw I still dont understand why the firewall is needed and still curious, so if anyone care to explaine...
    Ubuntu is pre-configured with no ports open. It is as if a firewall already exists preventing any traffic from coming in to the computer unless explicitly requested by the user (ie though a web browser, synaptic, etc).

    IP tables is the main linux firewall (using IPCHAINS as the rules), but it takes a lot of reading and work to learn to use it.

    Most other firewall packages available for linux simply enable the user to configure IPtables easily. Firestarter is my favorite for that.

    So, in essense you already have a sort of firewall working for you. Installing and using another program like Firestarter will let you configure it how you want/need quickly and easily.
    what's a troll? | my blog | my writing | Ubuntu Unleashed

    Don't ask support questions in PMs--post a thread so everyone can benefit!

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •