Configuring RedHat 7.2 as a Server System (v3)

The Gateway Server

This will help you install RedHat 7.2 to function in the following environment, with some optional properties:

Basic Assumptions

You must know the answer to the following questions:

Normal instructions are in plain text. Material dealing with DNS connections is in blue. Material dealing with IP-masquerading is in green. And finally, anything commands or other typeins you should enter at on your linux machine will be in red-bold. For example, if you see

ls -la
it indicates you should enter those characters. The terminating RETURN or ENTER key is assumed.

If you use IdahoQuad.com as your dns server

If you want to do IP Masquerading for an internal network

Assumptions

In my environment, I had several PC's, and I dedicated one of them to be my Linux gateway. I will call this machine the Gateway machine. I equipped it with two network cards, one (eth0) connected to the internet, and the other (eth1) connected to a hub, to which my internal machines were connected. You won't need the second adaptor unless you're doing Network Address Translation (Masquerading).

1. Loading the Gateway Machine

Install RedHat 7.2 from the supplied CD.

When you bootstrap from a CD, you get to chose the installation display type. I chose text , since I did not intend installing X on the server. Follow all the suggested defaults. They're pretty obvious.
Window Title Choice Comments
Language Selection English
Keyboard Selection US
Mouse Selection None Since this is a text system, we really don't need any mouse
Installation Type Server This seems to include most of the desired stuff
Disk Partitioning Setup Autopartition The setup seems to make the right choices
Automatic Partitioning Remove all partitions on this system
Select only hda for the installation
We assume no data will survive, but the system will reside on the first disk only
Partitioning OK An interesting display
Boot Loader Configuration Use GRUB Boot Loader
Boot Loader Configuration Choose the MBR
Boot Loader Configuration OK I don't think you need special parameters to the Kernel, and I don't think you need a boot password.
Network Configuration Fill in the data correct for your situation
Firewall Configuration Choose None We'll fix this later
Time Zone Selection Make it right
Root Password Choose carefully There is a remedy if you forget, but you don't want an easily guessed one.
Add User Add at least one user. Please include the user "daku", as well as your own account.
Package Group Selection Unselect the Classic X window System
Select the Web Server.
Check the Select Individual Packages
Individual Package Selection
Package Group Add these Remove these
Somewhere imap, only if you're going to provide mail services
Applications/Archiving zip
unzip
Applications/Internet lynx
Applications/Multimedia netpbm-progs
Applications/System linuxconf
Documentation
(optional)
apache-manual
System Environment/Daemons mod_bandwidth
dhcp (if you're masquerading)
ntp
wu-ftpd
pidentd (only if you're Masquerading)
Video Configuration If it arises, you can skip the X-configuration

I used the supplied default functions for everything else. If Package Dependencies appear, allow them to be fulfilled.

Complete the install (many minutes). You can make a boot diskette at this time, but it's not required.

Reload the machine. Make sure you revise the boot sequence in your ROM, so it doesn't start with the CD. When your system comes up, you're running without any firewall protection, but it will be for only a very short time. If you get invitations from kudzu, choose the yes-configure option. This is Linux's Plug-and-Play detection.

The Network can be configured at this point, but you still will have to give the local machine a name.

First, after you log in as root, type:

hostname your-host-name
such as
hostname alpha.beta.com
The name you choose here makes a difference, so you should choose the DNS name by which you are known to the outside world. This is important if you ever hope to do any mail functions, since SMTP involves a reverse dns lookup.

2. First Configuration

Internet access will be important, so that's our first job. So, type:

linuxconf
You should read the Introduction, which gives you an idea of how to navigate, and then choose quit.

Go to Config -> Networking -> Client tasks -> Host name and IP network devices Fill in the following information:

Heading Value Comments
Host name + domain yourhost.yourdomain.com This is the simple name by which your system knows itself. This should match the value you defined as the hostname above.
Adaptor 1 Enabled X
Adaptor 1 Config Mode Choose. If you select DHCP, nothing else matters.
Adaptor 1
Primary name + domain
yourhost.yourdomain.com This should be a copy of the Host Name field.
Details of adaptor If you're manual, fill in the details
Adaptor 1 .... The net device and Kernel Module should be filled in automatically; the rest should be empty
Configuring eth1 is needed only if you plan on supporting masquerading (Network Address Translation, NAT)
Adaptor 2 Enabled X if you plan on using an internal network. You can always turn this on later.
Adaptor 2 Config Mode Manual This is the DHCP master for your internal network
Adaptor 2 Primary name + domain xxx Whatever you choose to enter. It probably doesn't matter
Adaptor 2 IP address 192.168.1.2 The IP address you choose here is important for the first three digits. If you change the 4th field, you'll have to modify the dhcpd configuration I load later. You will find me using 192.168.1.* all over the place. I personally have adopted the convention that the fixed IP addresses are 192.168.1.1 - 192.168.1.127, and the dynamic ones are awarded from 128 up.
Adaptor 2 Netmask (opt) 255.255.255.0

Use the Accept function to return to Linuxconf's main screen.

If you are using static IP addresses for your eth0 configuration, you should walk through the Name Server, Routing and Host-Name search path screens to make sure all is good.

At this point, your network should work. Reboot your machine.

3. Second Configuration

At this point, I can remotely enter your system and watch what goes on. Your system will be vulnerable for a few minutes.

Type the command screen and then I can join you and watch.

Find Control->Control Panel->Control Service Activity and modify stuff as follows:

Control Service Desired Setting
apmd Manual, unless you're on a portable with batteries
gpm Manual, since we don't use a mouse
httpd Auto
ipchains Manual
lpd Manual, unless you have a printer
ntpd Automatic, and start it.
xfs Manual

After you've finished these, use Dismiss to return to linuxconf.

Space down to the date & time selection inside the control section, enter it. Put an X in the "store in GMT Format, and set up your time zone (use the (control)X to open up the options). For the "get date" option, I chose the server

ntp0.cornell.edu
Hit accept

You can now exit linuxconf, selecting Act/Changes, then Do it. With luck, all should work without complaint, and you return to the Linuxconf main screen.

Use Dismiss and you should be back at the shell prompt. With luck, lots of stuff should be working, and your system is vulnerable. So, try a simple ping just to make sure stuff is working, and we'll proceed with the fixups. A reboot is Not necessary (Isn't Linux nice?)

3.2 Moving the special files

I have saved that has a bunch of files on it that make your work easier. Download the diskette image and unzip it expanding directories onto a clean formatted diskette using your windows machine. The root directory on the diskette should contain two files (import and part1) and one directory (data).

You now mount the diskette on your new linux box, and execute a script on it.

You must type in the following sequence

The typein The explanation
mount -t vfat /dev/fd0 /mnt/floppy Mounts the floppy as a MSDos file system
. /mnt/floppy/part1 Runs the script. Note the initial period; it's important. You will be asked a set of questions to which you should respond either Y or N.
  • The NAT question asks whether you plan on having a second interface supporting an internal masqueraded network. If you choose Y, several utilities are installed.
  • The DYNDNS question asks whether you have a static IP address for your primary connection, or whether you use the services of dyndns.org.
See below for a discussion of what's happening.

This form of the command puts all the output into the file /usr/part1.out, so we can look at it when it's done.

You can monitor the output by opening another window (hit alt-F2), and typing
tail -f /usr/part1.out

Don't worry about the "dude" diagnostics. That is what OIDENTD talks about.

umount /dev/fd0 Dismount the diskette. Always wait until the light on the diskette drive goes out before removing the diskette.

Here are the files you just copied in

File Function Tailoring
/root/scripts A collection of scripts
/root/scripts/httpd_logger A cron job to rotate HTTP logs
/root/scripts/export_to_floppy A job to recreate the above diskette
/etc/dhcpd.conf DHCP daemon configuration
/etc/firewall.conf The firewall configuration
/etc/init.d/firewall The firewall script
/etc/rc.d/fixup An extra after rc.local
/etc/xinetd.d/oidentd The controls for Oinetd
/etc/xinetd.d/telnet Telnet daemon permissions The "only_from" argument probably needs to be augmented by adding any IP addresses that are allowed to TELNET in.
/etc/xinetd.d/wu-ftp WU-FTP daemon permissions See above.
/etc/httpd/conf/extras.conf My tailoring of the Apache server
Install oidentd This is the daemon that allows you to run mIRC behind the firewall.

3.3 Adjusting stuff

Some of the files you just loaded need some localization. For this, you'll need an editor (I use "vi"). The things you have to do are:

4. Updating and Fixing

Remove the diskette (unless your boot rom doesn't look at diskettes) and reboot. Your gateway machine should now work with the firewall.

Your next step is to register your RedHat LInux with the Redhat folks, so that we can perform a huge set of updates. Assuming you have the registration number, you run the program

rhn_register
and follow directions. After you've successfully done that, you can run your first update by typing in
up2date -fu
and watch the bits fly. Remember that we perform this action every night.

5. Adding a Disk

You've just added a second hard-drive. Remember the naming convention for ATA drives: hdxn, where:
x is one of the letters, a,b,c.... corresponding to the physical drive
n is a partition number.

Device name Where
/dev/hda1 Primary, Master, first partition
/dev/hda2 Primary, Master, Second partition
/dev/hda3 Primary, Master, Third partition
/dev/hda4 Primary, Master, Fourth partition, usually an extended one, which contains other partitions.
/dev/hdb1 Primary, Slave, often a CD
/dev/hdc1 Secondary Master
/dev/hdd1 Secondary Slave
/dev/hde1 Tertiary master, in case you have an extra IDE card.

Let's assume you have a new empty disk and it attaches as the secondary master. This makes its UNIX name /dev/hdc1. You also have to decide where you'll mount the device in the Unix file system. The steps are:

mkfs /dev/hdc1 This is much like the "format" command in DOS.
mkdir /mount-name Where you will be mounting the new disk
tune2fs -j /dev/hdc1 This creates the journaling structures on the disk
mount -t ext3 /dev/hdc1 /mount-name This mounts the device at the place indicated.

6. Adding a User, the Hard Way

When you add a user and you need web access, there are a few changes to make. We assume that you added the user via linuxconf. The problem will be the security of the directories, and to allow the web-server to come looking.

In the below, let's assume you've added a new user named newguy, via Linuxconf, and you specified /home/newguy as his home directory. The following assumes you are running as 'root'

Adjusting Permissions

You have to allow the web server to access the user's directory. All it needs is pass-through access, which allows it to traverse the directory without being able to list it.
chmod 711 /home/newguy
mkdir /home/newguy/public_html
chmod 711 /home/newguy/public_html
chown newguy.newguy /home/newguy/public_html

Adding a virtual web server

My technique is to rely upon a special port number for this user. So, let's assume you assign him a port number webport. This will typically be a number in the 80xx range, or maybe in the 10xxx range.

Adding a User the Easy Way

The above steps happen automatically if you run the script:
. /root/scripts/new_user name password port
where the name is the name of the user, password is his password (which I haven't been able to make work), and port is the port number for his web services.

You will have to go back into LINUXCONF to set this user's password; I haven't found a way to do it successfully in the script.

Activating Mail

If you want your Linux machine to be able to send mail, you need do nothing. If, however, you wish to receive mail from the outside world, or relay mail from selected clients to the outside, you have some work to do.

The Front Page Server

Hidden behind the gateway is a FrontPage apache server. Because port 80 is not available, the tricks are:
  1. Administration is sent to frontpage.daku.org.
  2. The dyndns setting redefines this as www2.daku.org:13090
  3. My NAT firewall maps port 13090 to 192.168.1.101:8090
  4. The frontpage machine accepts admin on 8090

The user access is as follows. Assume an external customer with a domain name sammygarden.com.

  1. Using IdahoQuad.com, the names are remapped:
    sammygarden.com redirected to telford.daku.org:13080
    www.sammygarde.com redirected to telford.daku.org:13080
  2. My NAT firwall maps port 13080 to 192.168.1.101:80
  3. The frontpage machine has a virtual webserver for www.sammygarden.com
  4. The frontpage machine has a user account named sammygarden