![]() |
![]() |
![]() |
| HOME SERVICES SUPPORT SOFTWARE SEARCH ABOUT | EMAIL FILTERED EMAIL |
|
Linux Static IP Address Setup BACK
The easiest way to set up Linux
networking is by using the installation script for your Linux
distribution. The installation script will ask for all required
information and configure the network accordingly. If you have
already installed Linux on your system and need to change the network
configuration, then follow the steps below.
Note that the procedures described here are only for static IP address installations; they will not work for dynamic IP addresses. If you have a dynamic IP address, then either purchase and install a home router/firewall which is PPPoE capable (most of them are), or download and install a free PPPoE client following its instructions. Step 1: Determining Network Parameters There are six critical parameters required to connect any computer to the internet and have it function properly. They are as follows: IP Address Subnet Mask Network Address Broadcast Address Gateway (Router) Address Name Server Addresses The IP address is the globally unique address of your computer. When you receive DSL Static IP Address service your IP address will be provided to you. An IP address consists of four numbers seperated by periods, or "dots", and each number can be from zero to 255. An example of an IP address is "192.168.33.251". The Subnet Mask defines the boundry of the immediate network. Hosts outside of the immediate network cannot be reached without sending requests for them to the Gateway. Like the IP address, it consists of four numbers seperated by periods, except the first number will always be 255. Your Subnet Mask will be "255.255.255.0". The Network Address is the lowest possible address on the immediate network. It can be derived from the IP address and Subnet Mask. The Broadcast Address is the highest possible address on the immediate network and it, too, can be derived from the IP address and Subnet Mask. To calculate your network address use the first three numbers of your IP address and substitute zero for the last number. For example, if your IP address is 172.16.228.5, then your network address will be 172.16.228.0. The Broadcast address is similar, except it will end in 255 instead of zero. Therefore, in the previous example, the broadcast address would be 172.16.228.255. The Gateway Address, or Router Address, is the IP address of the router which is connected to the immediate network. Traffic destin for remote networks, those which are not within the immediate network, are sent to the gateway. The gateway will then see to it that the traffic is sent along the correct path to its destination. For Internet Frontier DSL subscribers the gateway address is the same as the IP address except that the last number will be one. For example, if your IP address is 172.16.228.5 then your gateway address will be 172.16.228.1. The Name Server is a computer which will translate Domain Names, such as www.ifn.net, to IP addresses, such as 66.81.101.3. Without it you can still be on The Internet, you just can't find anything. Your name server address should have been provided with your IP address. Step 2: Setting up /etc/hosts All Unix and Linux systems keep their most basic host name to IP address associations in /etc/hosts. Log in as root and, using your prefered text editor, edit /etc/hosts. At a minimum the following entries should be present:
Step 3: Setting up /etc/resolv.conf All Unix and Linux systems configure their resolvers with the /etc/resolv.conf file. This file tells the resolver where its name servers are. As the root user edit this file; it should contain the following lines: nameserver 1.2.3.5 nameserver 1.2.3.6 Step 4: Setting up your interface One of the most significant differences between Linux distributions is how they manage network interfaces. Below are some examples of how interfaces are configured in various Linux distributions. If your Linux distribution is not one of those mentioned, then you may need to do some research to find out how it is done. A word of caution: Different versions of the same Linux distribution may handle network configuration differently. Check the documentation for your distribution and version if these instructions do not work for you. RedHat Network interfaces are defined in /etc/sysconfig/network-scripts/ifcfg-interface_name where interface-name
is the name of the interface (typically eth0). A sample eth0
interface configuration file is as follows:
DebianDEVICE=eth0 BROADCAST=192.168.0.255 IPADDR=192.168.0.10 NETMASK=255.255.255.0 NETWORK=192.168.0.0 ONBOOT=yes NETWORKING=yes All of the interface
configurations on a Debian system are stored in a single file, along
with your gateway: /etc/network/interfaces.
Here is a sample interfaces
file:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # The loopback interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.0.10 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1 Slackware Slackware Linux does not have an
interface management structure. It depends on startup scripts to
run ifconfig and route directly, typically out of /etc/rc.d/rc.inet1. In
the the below sample section from rc.inet1
the network parameters are stored as variables; the parts of the program
which actually run ifconfig
and route have been omitted:
Any Unix System#! /bin/sh # # rc.inet1 This shell script boots up the base INET system. # # Version: @(#)/etc/rc.d/rc.inet1 2.00 10/06/1999 # HOSTNAME=`cat /etc/HOSTNAME` # Attach the loopback device. /sbin/ifconfig lo 127.0.0.1 /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo # IF YOU HAVE AN ETHERNET CONNECTION, use these lines below to configure the # eth0 interface. # Edit these values to set up a static IP address: IPADDR="192.168.0.10" # REPLACE with YOUR IP address! NETMASK="255.255.255.0" # REPLACE with YOUR netmask! NETWORK="192.168.0.0" # REPLACE with YOUR network address! BROADCAST="192.168.0.255" # REPLACE with YOUR broadcast address, if you # have one. If not, leave blank and edit below. GATEWAY="192.168.0.1" # REPLACE with YOUR gateway address! . . . If you are working with a Linux
distribution not covered above, if you have another Unix variant
(Soalris, HP/UX, BSD, etc.) or if the above instructions did not work,
then try the following commands.
They should work on any Linux/Unix system, and will have to be placed
in the system startup files.
ifconfig eth0 1.2.3.4 broadcast 1.2.3.255 netmask 255.255.255.0
route add default gw 1.2.3.1 netmask 0.0.0.0 metric 1 Step 5: Restart Linux networking In most cases you can get your network configurations loaded without rebooting. If that does not work then a simple reboot should get it working. Try running the below startup/shutdown scripts (as root) with the parameter "restart" for the appropriate Linux distributions: RedHat /etc/rc.d/init.d/inet restart
Debian/etc/init.d/networking restart
Slackware/etc/rc.d/rc.inet1 restart
|
| © 1999-2003 Internet Frontier webmaster@ifn.net |