Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Dimension X

    HOWTO: Internet Connection Sharing (Ubuntu = Server) (Puppy Linux = client)

    This guide will cover a focused part Internet Connection Sharing. It will discuss using Ubuntu as a server (the one that receives/gives the incoming Internet; it funnels the connection to the Puppy Linux box) and Puppy Linux as the client (the one that receives/shares the Internet with the Ubuntu computer).

    I'm using Ubuntu 7.10 and Puppy Linux 2.11.
    I bet it can be applied to later Puppy versions, though.

    *** This guide applies to Ubuntu Linux 7.10 Live-CD.

    (it might be compatible for others)

    (wireless router)< ) ) ) wifi( ( ( >(ubuntu)<---ethernet--->(puppy)

    This guide considers three devices.

    1. Wireless device device <-- Server (Ubuntu)
    2. Ethernet device <-- Server (Ubuntu)
    3. Ethernet device <-- Client (Puppy)

    For those that are using the Live-CD...

    In order to manipulate the Live-CD without a remaster, you need to have an understanding of dpkg-scanpackages.
    Or you just apt-get it all while using the wireless device and ignore dpkg-scanpackages.

    Dpkg-scanpackages can be installed using this command in a terminal:

    sudo apt-get install build-essential dpkg-dev
    You should also know how to download packages with apt-get without installing them.
    If you want to know more about apt-get, do this at the terminal:

    man apt-get
    Dpkg-scanpackages will help you install packages from various storage media. There are websites on the Internet that discuss it. Here are a few of them. A thanks goes out to those who have authored them.


    I have not tried it on an installed system. It may or may not work on an installed system. If I get up to the task, I might attempt to make it work on such. Caution is advised when working with an installed system.

    This guide was written in part due to my annoyance with the Ubuntu wiki, various online guides, and just bad rhetoric and poor leet skills on part of the people who wrote crappy guides.

    To say the least, I know this works. If it does not work, then there might be something wrong with your hardware. There might be something wrong with my guide. There might be something funny about your hardware. For example, I've known devices to fight for their names, IPs, and so forth. That's more of a network issue than an ICS issue. Another example, maybe the modules with hardware are not working properly. The nforce module in earlier Ubuntu versions for onboard nvidia ethernets didn't seem to work, newer modules with newer kernels have tried to fix this problem. Maybe there aren't really any linux drivers for the devices you are using. This is why you need to make sure the wireless and ethernet devices work. That needs to be your first task.

    I suggest hooking up the ethernet ports to the network itself and trying to ping a website. (I suggest doing both with the wireless and ethernet if possible--or just a website)

    If both computers are successful at pinging a website/network, then you can most likely assume the ethernet devices work. Secondly, you need to make sure the wireless device works. If you can ping a network/website, then one could assume that both devices work. If you are using an Ubuntu module for the wireless device instead of ndiswrapper, you may come across problems. Some ubuntu modules for wireless devices have been known to cause problems, such as not loading websites, loading some websites but not others, and simply showing that a module exists, but not allowing a ping/pong to occur.

    If you've having a problem with your network device, look into it. Find out what module/driver it's using, and learn how to do research on Google. See if other people are having the same problem with the network device. Maybe you'll want to try an older or newer kernel.

    This guide isn't going to examine setting up and making a network card/device work. It's going to cover Internet Connection Sharing (ICS). So, onto ICS.

    Returning to what was said before, this will discuss Ubuntu (server) as using two devices:

    1. A wireless device <-- receives connection
    2. An ethernet card <-- shares connection

    The Puppy Linux computer (client) is using one device:

    1. An ethernet card <-- receives connection from Ubuntu computer

    In addition, the cable used to share the Internet connection is an ethernet cross-over cable. These are different from regular ethernet cables. For what I understand, an ethernet cross-over cable must be used. I suggest visiting Radio Shack, eBay, or reading a guide about developing your own cross-over cables (with caution).

    1. The internet connection is being obtained via the wireless device.
    2. The internet connection is being shared with computer 2 via the ethernet card.

    I offer no advice on this, and I do not plan on replying to comments unless there are suggestions for improvement.

    Following are the steps I used:

    This part is for Ubuntu:

    This guide makes a couple of assumptions.

    1. That you know how to install a dhcp3-server.
    2. You know how to setup the dhcp3-server.

    Ubuntu Starter Guide - DHCP Server

    3. You have been able to get your network devices to work.
    4. You have established a wireless connection.
    5. You have been able to ping and pong via your ethernet card.
    6. You have been able to get your ethernet card and your wireless card to work at the same time without interference (or you fixed the previous interference).

    resolv.conf(5): resolver config file - Linux man page

    An excellent way to do #6 is by setting up dhcp3-server, vnc, and the wireless connection. Afterwards, connect the client to the server, and use the client to VNC into the server. If you can VNC, then while inside the ubuntu box via the client, try to use ubuntu's terminal to ping an Internet website. If both can be established, then you have both all three network devices working.

    You can check the /etc/resolv.conf file for consistencies. Sometimes network manager overrides it and screws with the networking configuration. I often suggest turning network manager off. Ubuntu 8.04 seems to have an excellent network manager, but the older versions just suck.

    - turn of network manager
    - restart the eth0
    - restart the dhcp3-server
    - restart the wlan0
    - check /etc/resolv.conf for consistencies

    try vnc'ing into the server.
    play around with those options until something works

    7. You know a couple network commands.

    If you don't know how to do those things, then I suggest you comb the web for information.
    Read about those things, ask questions (create another thread), and experiment.
    There are a few links at the bottom under "FURTHER INFORMATION" that might help.

    The process of managing the dhcp3-server works like this:

    Install dhcp3-server onto Ubuntu.

    The DHCP server acts as a server that assigns IP addresses to computers that link up with it.
    The DHCP3-server is an essential part. If I remember correctly, it also assigns an IP to itself.
    This self-assignment is in reference to the ethernet (in accordance with this guide).

    Your wireless router should assign the wireless device its own IP address.
    I suggest restarting your wireless connection after restarting the dhcp3-server.

    1. Install dhcp3-server

    sudo apt-get install dhcp3-server
    Configure the ethernet card on Ubuntu.
    * I suggest something like

    2. configure your ethernet card to have its own aliased IP address

    * You may not have to do number 2.
    It's suggested. You can try without it.
    This goes with the idea of assigning things a static IP.

    3. configure dhcp3-server to assign an IP to the ethernet card that is installed in the computer with Puppy Linux on it. You need to know its MAC address.

    * You may not have to do number 3.
    It's suggested. You can try without it.
    This goes with the idea of assigning things a static IP.

    4. Restart the dhcp3-server on Ubuntu.

    Alright, those are pre-network things. I'm not going into detail about them. You can read about them elsewhere.
    You should let your wireless router assign the wireless device an IP address.

    Now onto the Internet Connection Sharing bit...

    sudo apt-get install dnsmasq ipmasq
    sysctl -w net.ipv4.ip_forward=1
    If you run the below line of code more than once, you may want to edit your /etc/sysctl.conf file.

    echo "net.ipv4.ip_forward = 1" | sudo tee -a /etc/sysctl.conf
    # replace wlan0 with the device that receives the Internet, such as wlan0.

    sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
    If you run the below line of code more than once, you may want to edit /proc/sys/net/ipv4/ip_forward.

    echo "1" | sudo tee -a /proc/sys/net/ipv4/ip_forward
    # This next line will restart dnsmasq

    sudo /etc/init.d/dnsmasq restart
    # This next line will reconfigure ipmasq

    sudo dpkg-reconfigure ipmasq
    You'll be bombared with a blue screen.
    If you know what to do, then configure things to your liking.
    Otherwise, you could do the following...

    1. yes
    2. ok
    3. keep current setup

    # replace wlan0 with the device that receives the Internet, such as wlan0.

    sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
    Alright, now onto the Puppy Linux computer.

    1. Open a terminal/console.
    2. Type in the following

    ifconfig eth0 up
    3. Ok, now time to read.

    Remember when I said

    "* I suggest something like"

    If you chose that IP, then you that in place of "IP-THAT-YOU-CHOSE"

    route add default gw IP-THAT-YOU-CHOSE

    would be typed in as

    route add default gw
    if you decided to not setup a static-ip for the server's ethernet card, then you need to figure out the server's ethernet card's IP address and put it inplace of IP-THAT-YOU-CHOSE.

    4. Time to test it


    1. if the client computer still has problems (maybe you're not using puppy? Hmm?)

    - try editing the /etc/resolv.conf file of the client
    -- replace the IP on the line of nameserver with the IP of the ubuntu server's ethernet card.


    Now try pinging a website.



  2. #2
    Linux Newbie Geeth's Avatar
    Join Date
    Apr 2008
    Brisbane Aus
    Nice post.
    Very complete, even with sources very impressive.

  3. #3
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Dimension X

    sysctl -w net.ipv4.ip_forward=1
    should be input as...

    sudo sysctl -w net.ipv4.ip_forward=1

  4. $spacer_open

Posting Permissions

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