4. TCP/IP system files

As well as configuring pppd, as a TCP/IP interface, you have to configure TCP/IP itself. This section is common to ethernet and modems. Normally you do this first.

4.1 /etc/HOSTNAME
4.2 /etc/hosts
4.3 /etc/host.conf
4.4 /etc/resolv.conf
4.5 The confusing parts

4.1

/etc/HOSTNAME

This is your fully qualified (host-)domain name. The one that your Internet provider rents to you.

trix.dircon.co.uk

Debian uses /etc/hostname. RedHat uses /etc/sysconfig/network but leaves the same result in /etc/HOSTNAME for other apps to find.

The file is read by the system during bootup, and by any utility that wants to know it's own name (but doesn't use /etc/hosts or the running IP stack).

You would of course substitute your hostname here, and everywhere else. Ditto for the other parameters.

4.2

/etc/hosts

You MUST edit this to be YOUR addresses and names. chmod 644, chown root. It must be world readable, but not writable. You should check it's contents regularly, as it is a lock (one of many) needed to keep the system secure. Check also the permissions on /etc/. (the directory). If that is world writable ...

The first name on the line is the 'proper' name, so ensure that the machine that connects to the Internet will get it's proper FQHN. Note that trix has two lines, one for the ethernet card, one for the slip link.

The shortnames make it easier to call telnet crow and to specify an exact IP_address in the PPP scripts.

The 192.168.xxx.nn numbers are LOCALLY allocated PRIVATE addresses. Basically, you think of a random number instead of 67, and allocate the last number (1,2,3,4 ...). See Issue-5-Planning for details. The internal host names, end in .priv That is a local convention.

The 172.17.2.xx numbers are actually from the private B range, so that you don't upset anyone by accidently copying this file! You would replace them with the numbers that your ISP provides.

Now that I use PPP, I no-longer need the addresses for the SLIP link, as my Internet provider validates my login, and enforces both it's IP address, and mine (isn't PPP wonderful). That's a question of trust. If you often connect to several different places, you may need to declare what you expect, here or in the PPP scripts.

# /etc/hosts
# loopback 

127.0.0.1	localhost

# lan_67  the ethernet LAN

192.168.67.1 trix.dircon.co.uk  trix  trix.lan67.priv
192.168.67.2    crow.lan67.priv crow
192.168.67.3 kestrel.lan67.priv kestrel
192.168.67.6 pc_cube.lan67.priv pc_cube
192.168.67.7  pigeon.lan67.priv pigeon 
192.168.67.1   raven.lan67.priv raven 

# slip link to tdc
# used by the PPP scripts (or not)
# illustrative figures from the B range
# so that you don't send any alarm bells ringing!
# almost all ISP's are in the 'C' range

172.17.2.67	  trix.dircon.co.uk tdc_me
172.17.2.1	tdc_gw.dircon.co.uk tdc_gw 

# this number placed into /etc/resolv.conf
# and not needed here
# the nameserver is reached through the gateway
# and is actually on a separate LAN.

194.112.32.1 nameserver.dircon.co.uk	nameserver

# eof # /etc/hosts.

4.3

/etc/host.conf

Check that it contains the following. Note that hosts comes before bind, this means that your /etc/hosts file 'knows better' than the network DNS service, and is checked first. That is both a security lock, and helps when PPP link is down, as a local address doesn't have to timeout. Also it helps when your the nameserver is badly configured. Otherwise there are countless opportunites to lock youself out with the keys inside!

order hosts, bind
multi on

Personally I used to have a bug-ette where DNS does not work properly for the first few seconds until the name server connection 'warms-up'. IE the ISP's modem server, talks to the central database, and sets up all the links for packets to reach me. During the first 2 seconds, this doesn't always work, and my finger@smtphost used to fail.

My workaround, was to put the mailserver address in /etc/hosts, not get it from the DNS. This also prevents delays when the network is down, and helps prevent a spoofing host from feeding me lies.

4.4

/etc/resolv.conf

You MUST edit this to have YOUR domain and nameserver. Use the information that your ISP sent you.

domain dircon.co.uk
nameserver 194.112.32.1

This is part of DNS - how you automatically lookup the IP_ADDR of "rtfm.mit.edu", or any other site not listed in /etc/hosts.

If you connect to different ISP's at different times, simply move the correct file into place as part of the connect scripts.

You can have two nameservers, and can NAME them provided you have entries in /etc/hosts, and order hosts,bind in host.conf

4.5

The confusing parts

Actually that's it, but it may help to realise that your machine can have several addresses, and they DONT have to appear above. They DO have to appear in the ifconfig scripts, but ifconfig uses name to address lookup from the /etc/hosts file, which makes it easier.

pppd in particular is very clever and can negociate the IP_ADDR of both sides (unless you set a manual override). Ethernet doesn't do any negociation (unless you request it over RARP), but the IP_ADDR comes from the /etc/rc.d/rc.eth0 script.

IE when you run ifconfig (and route), the command line parameter becomes the IP_ADDR of that interface, whether it is listed in /etc/hosts or not.

To make life simpler, ifconfig can take a NAME, that it converts to an address, by looking it up in /etc/hosts. pppd also.

To make this easier, I use a standard /etc/hosts on every machine, and add aliases for the interfaces. These aliases appear in the establish interface scripts. eg "tdc_me" and "tdc_gw" are the IP_ADDRs of both sides of the slip/pppd link.

I call it "tdc_gw", but dircon probably have their own name for it.

When you don't have PPP up (eg at system boot time) some networking facilities, (such as Samba) will attempt to deduce their own IP address from the primary TCP/IP interface (which is a good guess), ie the ethernet card. That's why the line in /etc/hosts for the trix ethernet card has the FQHN.