How To Set Up a Home Network With Ubuntu, Part 1

October 4, 2008 by
Filed under: HowTo, linux, Ubuntu 

Building a home network can make the management and use of multiple computers in your home much more convenient. For example, you can set up shared folders so that you have access to your files from any computer in the house. Another nice thing you can do is share your printer with all of your other computers, so you can print from anywhere.

For this post I'm going to assume that you already have a router (wired or wireless) set up per the instructions from the manufacturer.

The first step to making your home network easy to manage is to assign static IP addresses to each of your computers. That's what I'm going to cover in this post. I have three computers on my home network; the main desktop/data server, a secondary desktop/media center, and a laptop. All three are running various versions of Ubuntu Linux. Here's a basic block diagram.

Home Network Block Diagram

Home Network Block Diagram

Affiliate Link

First, we're going to configure the Main Desktop/Data Server. Login to that computer and use your favorite text editor to edit /etc/network/interfaces to include the following lines:

iface eth0 inet static
gateway eth0

This assumes that you are connected to the router using a LAN cable and eth0 is the name of your configured network card. Also, the gateway address should be set to the IP address of your router. This is the same address you use to access the web based configuration of the router. Yours may be

Now, restart the network to make the settings take effect.


sudo /etc/init.d/networking restart

Now, just repeat the process on your Secondary Desktop/Media Center making sure to substitute the name of your network device for eth0 and set the address to You can use the ifconfig command to view information about your network devices to get an idea of what name to use. Some common names for wireless devices are ath0, wlan0, ra0.

Again, repeat the process for the laptop using as the address.

Your home network is now set up with static IP addresses and is ready to set up folder sharing using NFS or Samba. I'll cover sharing with NFS in Part 2 and automounting the shared folders in Part 3.


6 Responses to “How To Set Up a Home Network With Ubuntu, Part 1”

  1. [...] do this in laymens terms???? I changed the etc/network/file according to instructions found here: Then ran this code : `sudo /etc/init.d/networking restart` Here is the result: `* Running [...]

  2. creolbuay says:

    While I do agree with trying to keep tutorials as simple as possible, I would like to suggest adding a quick "what you will need" at the start of your tutorials. For editing I would actually suggest using the shell, that way people can gain more familiarity of their system. You could also point users to useful sites for reference.

    I myself am a big vi user.

    To install open a terminal window and type:

    sudo apt-get update && sudo apt-get install vim

    To use it simply type:

    vi /path/to/filename

    To get a quick tutorial type:

    man vi

    Some common commands are:

    i - Insert... Use this to start editing.
    esc - press the escape key to leave editing mode

    Use these outside of editing mode...
    :wq - Save and Quit
    dd - delete an entire line
    yy - copy an entire line
    p - paste a line

    • Linerd says:

      Thanks for the feedback. vi/vim is something that everyone should learn to use. Your installation command shouldn't be required since vim is installed by default on nearly every Linux distro. vi is also a standard on Unix. Everyone should learn it because it's the one editor that's always available.

      vim is also a great improvement on vi. I'm one of the lucky ones that had to go through all my programming classes in college with only the vi editor available on the mainframe.

  3. Padi says:

    Thanks ever so much! I agree, there are always lower levels of understanding, and whilst I'd not be too enamoured to read about keyboard/mouse use, I have a friend who is just beyond that level. (And I had to teach her about that )

    Having said that, we all have to start somewhere, and I know that sometimes it is as basic as that. (I have taught languages to people with no prior knowledge of the language being learnt, and it has to start at a very basic level).

    I'm migrating from Windows, and I still have a lot to learn, but I am eager, and am now confident that with your easy to understand instructions I shall succeed after having been completely mind boggled by the info on the Ubuntu Forums.

    Once again, thanks.

  4. Padi says:

    This looks as if it could solve my problem, however, as a complete novice I'm a bit thrown as to how opening up a text editor, (andI don't have a favourite one!) and entering the information can configure the network - what is the context? Maybe I'm missing something here, but you seem to be assuming prior knowledge. I'm completely confused!! Please could you explain using simple idiot-proof steps? I'd be eternally grateful.

    Many thanks.

    • Linerd says:

      @Padi - if you're on a standard Ubuntu build you can launch a text editor through the menu at Programs→Accessories→Text Editor. But for the step above you need to be the superuser. You can launch a text editor as superuser by pressing [Alt][F2] and entering this command in the window: gksudo gedit /etc/network/interfaces
      Enter your password at the prompt and then make the edits from the post above.

      The first line of the file tells the system to configure your computer's network card to use a static IP address. The second line tells what IP address to use. The third line tells what network mask to use. The fourth line tells the IP address of your router. The last line tells you system to start the network card automatically.

      I'm sorry it seems confusing. If you want to know more about IP addresses, check Wikipedia. If you think you're confused now, wait 'til you read the Wikipedia page!

      Sorry, but I have to assume some prior knowledge. Otherwise I'd never get to post anything actually useful. No matter how far down I take it, there's always another lower level. I doubt you'd enjoy reading directions on how to use a mouse or a keyboard.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>