Linux Help

Networking Basics 101   
Printable Version
 _____________________________________________________
|                                                     |
|  Linux Network_Basics-HOWTO v1.1                    |#
|  Written by _ToXic_MYsT_, toxicmyst@deathsdoor.com  |#
|  Created on May 30th, 1999.                         |#
|_____________________________________________________|#
 #######################################################


_____________________________________________________________________________
TABLE OF CONTENTS

 1. Introduction

     1.1 Copyright & Disclaimer
     1.2 Requirements
     1.3 Synopsis


 2. Starting out

     2.1 IP Addresses
     2.2 Netmasks


 3. Configuring the Network

     3.1 Configuring Linux
     3.2 Setting up the Nameserver
     3.3 Information about other computers on your network
     3.4 Giving & Denying Access To Your Server
     3.5 Configuring the Windows machine


 4. Testing the Network

     4.1 From Linux
     4.2 From Windows


 5. Troubleshooting

     5.1 The PPPUP Chatscript


 6. Epilogue

     6.1 Further Reading


_____________________________________________________________________________

1.  Introduction



1.1 Copyright & Disclaimer

This document is copyright 1999 by _ToXIc_MYsT_.  You are encouraged to redistribute it.  
You may not modify this document, if you intend to resdistribute it however.

This document is available for free, and, while I have done the best I can to make it accurate
and up to date, I take no responsibility for any problems you may encounter resulting from the
use of this document.



1.2 Requirements

This document assumes that you've already successfully installed and configured your machines
NICs (Network Interface Cards) on all of the computers on your network, and that you have
connected your cables and hub together properly.

This document is also currently based off the RedHat distribution of linux, as we will be
making use of 'linuxconf' to enable the network.



1.3 Synopsis

Networking is one of the fundamental basics of Linux due to the fact that Linux boasts kernel
based networking support; setting up a small LAN (Local Area Network) using Linux should not
be a difficult task.  However, there were no HOWTOs on quickly setting up a small LAN so I
decided to write one.

The aim of this document is to guide you through the setting up of a small Local Area Network
with one Linux server and one windows workstation for the example systems.  We will cover
setting up Windows 9x to use your network.

My thanks go out to Syn`sthe for his help in the editing of this document.

__________________

2.  Starting out



2.1 IP Addresses

There are 3 classes of IPs you can use for your LAN if it is to be connected to the
internet. If you DO NOT plan on having your LAN on the internet these are irrelevant and
you can use any IP address you want.

The 3 classes of IPs are:
        Class A - 10.0.0.0 to 10.255.255.255
        Class B - 172.16.0.0 to 172.16.255.255
        Class C - 192.168.0.0 to 192.168.255.255

For this document we will use a Class C network with 192.168.0.1 as the Linux Server and
192.168.0.2 as the Windows 9x Computer on the LAN.



2.2 Netmasks

The Class of the IP addresses used on your network will determine what netmask you will
use.

        IP Class  |   Netmask
        ----------------------------
            A     -  255.0.0.0
            B     -  255.255.0.0
            C     -  255.255.255.0

For this document we will use a netmask of 255.255.255.0 since we are using Class C IP
addresses on the LAN.




___________________________________
3. Configuring The Linux Computer



3.1 Configuring Linux

For ease of use we will be using the program 'linuxconf' to configure most of our network.
'linuxconf' can be called from the console and from within X. (As user root type
"linuxconf" from either the console, or a shell terminal within X.

In 'linuxconf', find the following in the tree structure:
        Config >> Networking >> Client Tasks >> Basic Host Information

This is where you will enter the network information for your system.

I will briefly explain each part of this section:

HOSTNAME Tab
        Hostname - The hostname of this computer, leave this alone for now.

ADAPTER 1 Tab
        Config Mode -  It's default is [X]Enabled, (o)Manual.  Leave it alone.

        Primary name + domain - The computer name & domain for this computer.  You can make
                                up a domain for this.  For this example we will use
                                "linuxbox" for the primary name and "mydomain.com" for the
                                domain.  So you would enter "linuxbox.mydomain.com".

        Aliases(opt) - Make this the primary name you used in the previous selection. For
                       this document it will be set To "linuxbox".

        IP Address - This is the IP address for that machine.  We will use 192.168.0.1

        Netmasks - Enter the proper netmask for your class of IP addresses.  For this
                   example it will be 255.255.255.0

        Netdevice - The device that the NIC on your network is using.  We will use eth0.

        Kernel Module - Module for your NIC.  Leave it blank if your card is recognized
                        at boot.

        I.O. port (opt) - Options for your NIC module.  Leave it blank if your card is
                          recognized.

        IRQ (opt) - IRQ for your NIC.  Leave it blank if your card is properly recognized.

Properly fill in the above values and click on "Accept".



3.2 Setting up the Nameserver

Go to the following in the linuxconf tree structure:
        Config >>  Networking >> Client Tasks >> Name server specification (DNS)

This is where you will configure Linux to resolve your LAN's Domain. I will explain the
parts we need to fill in.

        DNS Usage - enable this if it's not already enabled

        Default Domain - this is the domain of your network.  We will
                         be using "mydomain.com" in this example.

        nameserver 1 - this should be the IP address of the linux server.
                       We will use 192.168.0.1

For now the rest should all be blank.



3.3  Information About Other Computers On Your Network

Go to the following in the linuxconf tree structure:
        Config >> Networking >> Misc >> Information About Other Hosts

Here is an example what your screen should look like:

        IP Number     |   Name & Alias
        ------------------------------------------
        127.0.0.1     |   localhost
        192.168.0.1   |   linuxbox.mydomain.com linuxbox
        192.168.0.2   |   winbox.mydomain.com winbox

In this example:

        - 127.0.0.1 is our localhost using the loopback interface.
        - 192.168.0.1 is our Linux server
        - 192.168.0.2 is the Windows 9x computer  (not yet configured, be patient)

If you are missing a line "ADD" it and fill in the information.



3.4 Giving & Denying Access To Your Server

You need to give computers on your network access to the server.  To do this we need to
edit two files, /etc/hosts.allow and /etc/hosts.deny.

hosts.allow describes the names of hosts which are allowed to use local services.
hosts.deny describes the names of hosts which are *not* allowed to use local services.

As root enter the following command:  pico /etc/hosts.allow
Enter the following line:  ALL:192.168.0.2

Now hit ctrl+o to save the file and ctrl+x to exit pico.
You need to add IP addresses to hosts.allow for each computer on your network.

As root enter the following command:  pico /etc/hosts.deny
Enter the following line:  ALL:ALL

Now hit ctrl+o to save the file and ctrl+x to exit pico.


That's it for Linux Configuration!

Leave linuxconf and activate the changes.  You might want to reboot linux to let some of the
network-related daemons recognize the changes.



3.5 Configuring Windows

Before attempting to configure your network you should install the software you received
with your NIC.  This should greatly aid in the configuration.

Right-click Network Neighborhood on your windows desktop, and choose "properties..."

In the CONFIGURATION Tab locate and highlight the network protocol with your NIC information
on it.  For me it is: TCP/IP -> 3Com Fast EtherLink XL 10/100Mb Ethernet NIC(3c905b-TX).
When this is highlighted, click the properties button.

For this example we will be using TCP/IP protocol.

In the new window go to the "IP ADDRESS" tab.

Enable "Specify an IP address" and enter the IP address of your Windows computer that you
specified in linuxconf.  Then enter the netmask for your IP address.  For this example
the IP address will 192.168.0.2 and netmask 255.255.255.0


Click OK.  You will now be prompted to reboot your computer, choose Yes.
THAT'S IT!  Your network should be configured properly.




________________________
4. Testing the Network



4.1 From Linux

>From the console type: ping 192.168.0.2
After a few seconds hit ctrl+c to cancel it.
If your network was successful you should get something like this:

$ ping 192.168.0.2
PING 192.168.0.2 (192.168.0.2): 56 data bytes
64 bytes from 192.168.0.2: icmp_seq=0 ttl=128 time=0.3 ms
64 bytes from 192.168.0.2: icmp_seq=1 ttl=128 time=0.3 ms

--- 192.168.0.2 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.3/0.3/0.3 ms

If you get something to that effect your network is set up properly.



4.2 From Windows

>From a ms-dos prompt type: ping 192.168.0.1
After a few seconds hit ctrl+c to cancel it.
If your network was successful you should get something like this:

c:\WINDOWS> ping 192.168.0.1

Pinging 192.168.0.1 with 32 bytes of data:

Reply from  192.168.0.1: bytes=32 time<10msg TTL=225
Reply from  192.168.0.1: bytes=32 time<10msg TTL=225
Reply from  192.168.0.1: bytes=32 time<10msg TTL=225

If you get something to that effect your network is set up properly.

Congratulations!




____________________
5. Troubleshooting



5.1 The PPPUP Chatscript

If you are using a chatscript like ppp-up or another chatscript that uses /etc/ppp/ip-up
and ip-down you will need to make a slight change.

As root enter the following command:  cp /etc/hosts /etc/hosts.tem

If you do not do this change, ip-up will overwrite your /etc/hosts file and delete
your network settings every time you connect to the internet via your chatscript.
If you reboot and the file has be overwritten some of the network-sensitive daemons
will stall during bootup and it will take 15-30 minutes for your system to finish booting,
depending on the number of network-sensitive daemons that need to time-out.

_____________

6. Epilogue



6.1 Further Reading

If your LAN is setup properly you might consider reading the following networking
related documents:

     - lytes Security Guide
     - SirPlaya's IP Masquerading Guide
     - lytes IPFWADM/Firewall script  (for 2.0.x kernels)
     - lytes IPCHAINS/Firewall script  (for 2.2.x kernels)

All of these pages can be found at http://www.linuxhelp.ca/guides/





Having trouble? Got questions? Require further assistance? If so please feel free to visit our Help Forums and ask the experts!


Copyright © 1997 - 2008 Private World Domination Inc. All rights reserved.
Linux is a registered trademark of Linus Torvalds. All other trademarks and copyrights are the property of their respective owners.
| Contact Us | Link to Us | RSS Feed | Staff |

DNS Hosting by easyDNS