Giving your server an address

Once you've set up your client, it's time to tackle the painful part: the server. UNIX is wonderful in many ways, but I've never found a system more difficult to configure. One of the few areas which Linux was helpful (or at least my installation was) was in the rc.inet files you need to use to set up your TCP/IP connection. In my installation, they're in the directory /etc/rc.d/. The first one you'll want to approach, once you have your ethernet installed, is the rc.inet1 file. (On some installations, both rc.inet1 and rc.inet2 are combined in one file, and you'll have to do some improvising to make this work.) Here's what mine looks like now:
#! /bin/sh
#
# rc.inet1	This shell script boots up the base INET system.
#
# Version:	@(#)/etc/rc.d/rc.inet1	1.01	05/27/93
#

HOSTNAME=`cat /etc/HOSTNAME`

# Attach the loopback device.
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0

# IF YOU HAVE AN ETHERNET CONNECTION, use these lines below to configure the 
# eth0 interface. If you're only using loopback or SLIP, don't include the
# rest of the lines in this file.

# Edit for your setup.
IPADDR="192.168.124.2"	# REPLACE with YOUR IP address!
NETMASK="255.255.255.0"	# REPLACE with YOUR netmask!
NETWORK="192.168.124.0"	# REPLACE with YOUR network address!
BROADCAST="192.168.124.255"	# REPLACE with YOUR broadcast address, if you
			# have one. If not, leave blank and edit below.
GATEWAY="192.168.124.1"	# REPLACE with YOUR gateway address!

# Uncomment ONLY ONE of the three lines below. If one doesn't work, try again.
# /sbin/ifconfig eth0 ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
/sbin/ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
# /sbin/ifconfig  eth0 ${IPADDR} netmask ${NETMASK} 

# Uncomment these to set up your IP routing table.
/sbin/route add -net ${NETWORK} netmask ${NETMASK}
#/sbin/route add default gw ${GATEWAY} metric 1

# End of rc.inet1
Most of this is pretty simple fill in the blank, and switching it to your system should be simple - you just need to edit this file with vi or emacs or your other favorite editor. The first thing the script gets is a HOSTNAME, from the file /etc/HOSTNAME. Of course, I don't hink this line does anything at all, but I'd put your host name in that file. (Please email me if you know why/what this is for in this script.) The next section attaches the loopback adress. 127.0.0.1 will always call back to your home machine. This standardization provides a level of convenience for many TCP/IP systems, sparing you having to inform every program of your machines IP address and letting you test your system easily. The ifconfig line tells UNIX that the loopback address is at 127.0.0.1, and the route add -net line tells it that it can reach the network 127.0.0.0 which includes the loopback address. This part was probably already set up when you installed Linux.

The next part is where you have to plug in your own IP address and netmask numbers. The IP address is the number you've chosen for this machine - on my network, the Mac is 192.168.124.3, the PC 192.168.124.2 - so I put 192.168.124.2 in for my IP address. The netmask is 255.255.255.0 - because this is a class C address. The network is 192.168.124.0 - the zero on the end of it makes it simply a network address, not a reference to a specific computer. The next number the broadcast address, is the same as the network address except that the final digit is 255, not zero. This is the address that every machine on the network will receive and respond to, good for system-wide messages and testing. The gateway address, if you have one, is for a machine that can connect you to other networks. Here I've used my nonexistent 192.168.124.1, the number for the UNIX machine I hope someday to have when I have much more money available. (Since I've commented out the later line where this gateway number is used, this can't do any harm.)

The next three ifconfig lines offer you different ways of setting up your machine. The second line is the only line I've tried (came in the installation) and it's worked fine but the others may work better for you. Remember, uncomment only one. The next two lines of the script set up your routing and your gateway. You must let it route the network to be able to reach other machines. You can comment out the gateway line if you don't have one, though. (You comment out by putting a # sign in front of the line.)

Another good thing to do is edit the /etc/hosts file at this time and tell it what you have on the network. This file doesn't give you real name service, but lets you use names instead of IP numbers for processes running on your Linux machine. Here's mine:

# hosts		This file describes a number of hostname-to-address
#		mappings for the TCP/IP subsystem.  It is mostly
#		used at boot time, when no name servers are running.
#		On small systems, this file can be used instead of a
#		"named" name server.  Just add the names, addresses
#		and any aliases to this file...
#
# For loopbacking.
127.0.0.1	localhost
# connections via ethernet
#ip number	full name with domain	local name - no net
192.168.124.2	hypeserve.hypertype.com	hypeserve
192.168.124.3	hypermac.hypertype.com 	hypermac
# End of hosts.
This isn't so complicated - the IP number, a tab, the full name, including the network domain name, and then the local name only. Replace the IP numbers with your own numbers the names with your own names, and you'll be ready to go.

Once you have all of this set up, restart your machine and let's test it out.

Back to the start of the Linux instructions

Copyright 1995 by Simon St.Laurent. All rights reserved. You may print this document for yourself or others at no charge, but commercial distribution without permission is prohibited.

Hypertype
448 West 25th Street #3
New York, NY 10001
hypertyp@panix.com
SimonStL@aol.com