HOW TO SET LINUX-FT UP TO USE DEMON INTERNET

VERSION 3.0 17th September 1995

Martin Houston <mhouston@mh01.demon.co.uk>

Introduction

This 'Mini How-to' is not complete - it is intended to be a bootstrap that is small enough to type things in from if needed to get a very basic Internet connection going. Although these instructions are specific to Demon I would hope that other service providers would send me revised instructions to work with their systems also (please).

If anyone wants to delve any deeper into Linux network configuration the book to buy is "Linux Network Administrators Guide" - the green book with a cowboy on it by O'Reilly & Associates (ISBN 1-56592-087-2).

I assume that you have a fresh and clean Linux-FT setup that you want to connect to the net.

What this HOW-TO will give you:

This should be enough to get you running enough to get further help from the net.

What is not (yet) covered:

I based my support on what other demon subscribers have themselves provided on ftp.demon.co.uk for Slackware Linux.

I cribbed the scripts from the slackware set but not any programs - FT comes with nice new elf format binaries so it would be generally a bad thing to replace network programs with old slackware ones. Anything that you have to type into files is indented from the rest of the text. You don't need to indent the text when you use it.

	**** Swapping components between Linux Distributions ****
	****           is potentially dangerous 	     ****
The first thing to do is to sort out which serial port you are going to connect your modem to. Your modem should be at least a V32bis type and the serial port have a 16550 or 16550A compatible chip or you may as well forget it!

The modem is up to you but the Linux kernel will tell you what sort of serial chips you have as part of the kernel boot sequence. If you don't have a high speed serial port then you will probably just about manage to use a high speed modem under DOS but will almost certainly loose characters and thus get very poor performance with Linux, or with MS Windows. What if you only have 16440 serial chips reported? What you will have to do is disable the COM ports in your computer and buy another card with one or more high speed serial ports to take their place.

A good buy for Linux (but not much use for DOS) is an "AST Four port" type of multiplexed serial card. This give 4 16550A serial chips that share a common interrupt so that 4 serial ports take the space in your machine where one was to start with. You may have trouble getting hold of a suitable card. The place I got mine from stopped selling them ages ago, the reason: lack of demand! The Maplin catalogue do a card that looks suitable for about 70 but I have not tried it.

The other alternative is to buy an internally fitted V32bis (or faster) modem as these really should have a 16550 chip unless they are very, very sad! You will still have to loose one of your DOS COM ports to the modem though.

Personaly I prefer the 4 port and external modem solution though - you get those nice lights that show you when you are on line (running up a bill) etc. Internal modems seldom have status lights so you cannot even tell if you are on the phone or not when having problems. The combination of an internal modem and the Microsoft Network would be particulary dangerous as it would be possible for the uninformed to run up a hefty bill just by clicking on icons without any clue as to what was happening!

The next step is to set your modem up and confirm that you can dial out and connect to the POP you want to use manually. The X Windows based seyon program is the easiest to use for this - just start it as 'seyon -modem /dev/modem'. If you haven't setup X then pcomm could be used I have always found its setup rather confusing though.

The best way to set up your modem is to store all the correct parameters for talking to Demon in the modems non volatile memory so a simple 'ATZ' will suffice as an initialisation string. Modems vary so I can't give you a step by step guide. The modem I use - a Shine FAX-Modem V.32BIS, worked with demon straight out of the box. I would think that the factory settings for most modems sold nowadays should work without too much problem.

Once you have the modem working the next stage is to get your machine ready to connect to the net. When you signed up with demon you will have been given a machine name - something.demon.co.uk and an IP address which will be 158.152.XXX.XXX. Your name will always end in the DOMAIN of demon.co.uk (unless you have paid for a custom domain) and your IP address will always start with 158.152 as that is Demon's Class B Internet Address - unless they have grown so much as to require another Class B domain!.

You will now have to edit a few files in the /etc directory. You will have to be the root 'superuser' to do this so take care and make a backup of anything that you change.

TIP: If the thought of using vi fills you with dread then try the 'pico' editor that comes as part of the pine mailer. It has on-screen help and is very simple to use.

/etc/hosts

You should already have an entry for 'localhost'
	127.0.0.1    localhost
To this add an entry for your IP address and the address of at least one of the machines at Demon - gate is a good choice.
	158.152.YOURIPADDR	YOURACCOUNTNAME	YOURACCOUNTNAME.demon.co.uk
	158.152.1.65		gate	gate.demon.co.uk
One machine on the Demon side is needed as the other end of our SLIP link. We need the name in the hosts file as the name server we are going to set up later cannot work until we have connected to the net at least once - a bit of a chicken and egg situation!

/etc/host.conf

This should contain the following lines:
	order hosts,bind
	multi on

/etc/resolv.conf

	domain demon.co.uk
	# three sample demon nameservers to try
	nameserver 192.68.174.95
	nameserver 158.152.1.193
	nameserver 158.152.1.65

/etc/demon.dip

You will need to put the telephone numbers of the POPS you will call in here along with setup info for your modem. I have left a choice of Birmingham Coventry and Wolverhampton as an example. Get the numbers of your local POPs from Demon.
	#!/usr/sbin/dip
	# demon.dip: connection script for SLIP via demon router.
	# Replace YOURACCOUNTNAME and YOURPASSWORD

	# Set the local and remote ends of the link.
	  get $local YOURACCOUNTNAME.demon.co.uk
	  get $remote gate.demon.co.uk

	# Set the desired serial port and speed.
	# I use S4 - the first port of my high speed Longshine 4 port
	# serial card
	  port ttyS4
	  speed 38400

	# Set eight-bit clean comms (it's the default, but it can't hurt).
	  databits 8
	  parity N
	  stopbits 1

	# Define the modem initialisation string.  This is the string sent to
	# the modem just prior to dialing.
	# best to set the modem up in NVRAM and re-init it here
	  init ATZ

	# Turn on echoing of the control commands, responses etc.
	  echo on

	# Reset the modem and terminal line.  NB some people report having
	# problems dialing after using this.  It also slows down the login.
	# Un comment the next three lines if you need to reset the modem here.
	reset
	wait OK 3
	if $errlvl != 0 goto error1

	# Un comment the phone number of the POP you want to try
	# This list is not complete - ask Demon about numbers local to you.
	top:
	# Dial Coventry (Energis POP)
	# dial 01203284848
	# Dial Birmingham (Energis POP)
	dial 2754848
	# Dial Wolverhampton (Energis POP)
	# dial 01902464848
	# Check to see if all is OK.
	  if $errlvl != 0 goto error2

	# If we get a successful CONNECT, go on to the login section, else retry
	  wait CONNECT 30
	  if $errlvl == 0 goto login

	# Retry.  This does not limit the number of retries.  It is for manual
	# operation only!  This reset may also disrupt dialing on some modems.
	# Un comment the next three lines if you need to reset the modem here.
	  reset
	  wait OK 3
	  if $errlvl != 0 goto error1
	  print
	  print Trying again ...
	  sleep 20
	  goto top

	login:
	# We are now connected.  Log in to the system.  You should not normally
	# need to provoke the login prompt with the next two lines.
	# sleep 3
	# send \r\n\r\n
	  wait ogin: 60
	  if $errlvl != 0 goto error3
	  sleep 1
	  print Sending account
	  send YOURACCOUNTNAME\n
	  wait word: 60
	  if $errlvl != 0 goto error4
	  print Sending password
	  send YOURPASSWORD\n
	# VERY IMPORTANT
	# NEVER EVER DISCLOSE YOUR PASSWORD TO ANYONE
	# It is the only non public knowledge needed to
	# connect a machine to demon so that it will be you.
	# If somebody has stolen your Demon password they
	# can steal your mail and send messages that look to
	# the rest of the world like you sent them.
	  wait ocol: 60
	  if $errlvl != 0 goto error5
	  print Sending protocol
	  send slip,idle=120,mru=576\n
	  wait HELLO 60
	  if $errlvl != 0 goto error6

	# This route is the default route.  The mtu must match the mru above.
	  get $mtu 576
	  default

	# Announce the connection.
	  print
	  print CONNECTED via $remote with address $rmtip

	# Make a compressed SLIP connection.
	  mode CSLIP
	  goto exit

	# Error handling section.
	error1:
	  print Error resetting modem - OK not received.
	  goto error
	error2:
	  print Error in dialing.
	  goto error
	error3:
	  print Error waiting for login prompt.
	  goto error
	error4:
	  print Error waiting for password prompt.
	  goto error
	error5:
	  print Error waiting for protocol prompt.
	  goto error
	error6:
	  print Error waiting for HELLO prompt.
	  goto error
	error:
	  print SLIP failed.

	# Exit ...
	exit:
There is a lot there to type in! The above is a script for the dip dialer and will be executed by dip Make /etc/demon.dip executable by saying chmod 700 /etc/demon.dip. Only root is allowed to read or execute the file as it contains your top secret Demon password!

There is some more housekeeping needed before and after making the connection. This is handled by a thankfully shorter script called start.dip.

/sbin/start.dip

	/etc/demon.dip
	# make our default route go out to the Internet
	route add default dev sl0
	sleep 12
	# Give the network a chance to settle
	sendmail -q # run our mail queue now we are connected
	# fingering the post office machine kicks it in to attempting
	# to deliver your mail as well as showing what is there
	finger YOURHOSTNAME@post.demon.co.uk
	# You could add more things here like receiving news
	# and setting your machines time from the net

SENDMAIL

The last stage before attempting a connection is to get sendmail (the electronic mail system) configured to know about Demon's smart mail hub. The job of sendmail on your machine is very simple if all your email is either local to one machine or via the net.

	divert(-1)
	#
	# Copyright (c) 1983 Eric P. Allman
	# Copyright (c) 1988, 1993
	# The Regents of the University of California.  All rights reserved.
	#
	# Redistribution and use in source and binary forms, with or without
	# modification, are permitted provided that the following conditions
	# are met:
	# 1. Redistributions of source code must retain the above copyright
	#    notice, this list of conditions and the following disclaimer.
	# 2. Redistributions in binary form must reproduce the above copyright
	#    notice, this list of conditions and the following disclaimer in the
	#    documentation and/or other materials provided with the distribution.
	# 3. All advertising materials mentioning features or use of this software
	#    must display the following acknowledgment:
	# This product includes software developed by the University of
	# California, Berkeley and its contributors.
	# 4. Neither the name of the University nor the names of its contributors
	#    may be used to endorse or promote products derived from this software
	#    without specific prior written permission.
	#
	# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
	# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
	# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
	# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
	# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
	# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
	# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
	# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
	# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANYWAY
	# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
	# SUCH DAMAGE.
	#

	include(`../m4/cf.m4')
	VERSIONID(`@(#)Demon.mc 1.0 (Borg.demon.co.uk) 15/7/93')
	OSTYPE(linux)dnl
	FEATURE(nouucp)
	MAILER(local)
	MAILER(smtp)
	define(`SMART_HOST', `smtp:post.demon.co.uk')
The above file should be placed in /etc/sendmail.d/cf and the command
	m4 demon.mc >/etc/sendmail.cf
used to generate an appropriate sendmail configuration file. For this configuration to work you must have at least the following lines in a file called /etc/aliases

	postmaster:     root
	mailer-daemon:  root
This is so the root user gets informed of any mail problems.

Type the command

	newaliases
when you have modified this file.

In the /etc/SERVICES file

# Sendmail for receiving mail through SMTP
"sendmail -bd -q30m"
Remove the -q30m - as we are only connecting to the rest of the world manually there is no point in sendmail trying to deliver queued mail at regular intervals. sendmail -bd on its own starts the sendmail demon process that will listen to incoming mail traffic from post.demon.

By the way the program 'smtpd' is the same as 'sendmail -bd' so you could use that instead - don't run both though!

If you don't want to reboot before trying the net type

	killall sendmail
	sendmail -bd
This will stop any existing sendmail program and start a new demon only one that does not do periodic queue polling.

To get on the net just type start.dip as the root user. Once you have a successful connection you can use any other net services from other screens and accounts.

To stop using the network type dip -k as the root user.

However if you don't use the network for more than about a minute Demon drops the connection to let somebody else have a try. In this case you do not need dip -k.

NEWS READING

This is not the ultimate solution to reading usenet news - you have to be online while reading. It is however extremley simple compared to setting your system up to take news in batches.

Start the pine mailer program

Choose S SETUP

then C CONFIG and set

	nntp-server            = betanews.demon.co.uk                                   
and 
	news-collections       = News *{news.demon.co.uk/nntp}[]
And later on in the config mark the following two options
 	[X]  news-approximates-new-status          
        [X]  news-post-without-validation      
Save the config and restart pine WHILE YOU ARE ONLINE.

You will now be offered the chance to subscribe to newsgroups from the L FOLDER LIST menu.

Tip: Over a dial up link and with the huge number of news groups available asking pine to show you available groups would give a very long wait!

You need to tell it exactly what group to get:

	comp.os.linux.announce
for example.

Subscribing to a new group causes a few minutes of intense activity but after that performance seems quite reasonable.

Pine treats news just like mail. If you Compose while in a news group you are asked if you want to post to the group or just want to send normal email.

Conclusion

If you have any comments and suggestions for improvement to this document please email me mhouston@mh01.demon.co.uk.

Permission is granted to copy and distribute this document as long as the above copyright notice is maintained and no changes are made to the document.

I accept no responsibility for any errors or omissions (although I would like to hear about then to make future versions better).