Next Previous Contents

2. Hardware Installation

2.1 Setting up a normal private network

The purpose of this section is to provide the basics of how to take two networked computers, and add a second network interface card to each, and connect them both to a second, "private" network. This step does not use rtnet, but it is extremely useful to first have a correctly configured (and working!) private network, which you can then switch to rtnet.

You need to have two Linux computers, which are both connected to an existing network, two additional ethernet cards, and a means of physically connecting the cards. The physical connection can either be a 100base-T crossover cable, or regular cables connected to a hub.

In the examples in this document, I have two computers, named wallace and gromit. Wallace has a 3com 3c503 (it's retro-computing) as it's original network card, and a 3com 3c905b as the secondary network card. I compile its kernel with both 3c503 and 3c59x support as modules. Gromit has two identical Tulip clone cards, and I compile its kernel with tulip support as a module. Having two identical cards can cause problems with probe order and general abiguity about "which cable goes where", so I would recommend _not_ doing this.

I compile all the ethernet drivers as modules, so that they can be assigned properly to eth0, eth1, etc. (If you compile them into the kernel, they appear in probe order -- this is OK until you start changing ethernet cards. Nasty. Just compile them as modules. Trust me.) To assign the cards to the right interface name, I added

# This is for wallace
alias eth0 3c503  # or whatever you have
alias eth1 3c59x
# Later, we will change the previous line to
#alias eth1 3c59x_rt

into /etc/conf.modules. Note that this still doesn't guarantee that they end up assigned correctly if there is an error loading one. For gromit, /etc/conf.modules should have

alias eth0 tulip
alias eth1 tulip
# Later, we will change _both_ lines to
#alias eth0 tulip_rt
#alias eth1 tulip_rt

You now need to configure the secondary network cards for a private network. For the private network, you need to choose an unallocated IP address segment, such as 192.168.0.0 to 192.168.0.255. This block of numbers is reserved for purposes such as this, i.e., completely private networks. However, it may be possible that your organization is already using this address segment, in which case you will want to consult with your network administrator for advice.

In the example setup, gromit is 10.11.12.100 on the regular network, and wallace is 10.11.12.101. (10.x.x.x is another reserved segment -- I'm behind a firewall.) On the secondary network, gromit is 192.168.0.1, and wallace is 192.168.0.2. It is also convenient to assign names to the 192.168.0.[12] addresses, since names are easier to remember and type. I use the names rtgromit and rtwallace for the 192.168.0.[12] numbers, and added the following lines to /etc/hosts:

192.168.0.1     rtwallace
192.168.0.2     rtgromit

Red Hat uses the files /etc/sysconfig/network-scripts/ifcfg-eth* as configuration files for the network interfaces. On wallace, the configuration script /etc/sysconfig/network-scripts/ifcfg-eth0 (for the normal network interface) should look like:

DEVICE="eth0"
IPADDR="10.11.12.101"
NETMASK="255.255.255.0"
NETWORK="10.11.12.0"
BROADCAST="10.11.12.255"
ONBOOT="yes"

the configuration for the secondary network card (/etc/sysconfig/network-scripts/ifcfg-eth1) should look like:

DEVICE="eth1"
IPADDR="192.168.0.2"
NETMASK="255.255.255.0"
NETWORK="192.168.0.0"
BROADCAST="192.168.0.255"
ONBOOT="no"

and similar on gromit. Depending on how your computer was installed, there might be addditional lines in the eth0 file. These are irrelevant to our current discussion, and should be left the same.

Debian uses the file /etc/network/interfaces as a configuration file for both network interfaces. It should look like:

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
iface lo inet loopback

# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
iface eth0 inet static
        address 10.11.12.101
        netmask 255.255.255.0
        network 10.11.12.0
        broadcast 10.11.12.255
        gateway 10.11.12.1
iface eth1 inet static
        address 192.168.0.2
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255

Other distributions have other methods of configuring network interfaces.

Connect the secondary network cards together directly or through a hub, and reboot both computers. At this point, you should be able to use the normal network on both computers. Run the command

/sbin/ifup eth1

on both computers. Depending on how your distribution is configured, the interface may be brought up automatically at boot, in which case you will probably get an error message. It would be a good idea to disable this, if possible. Now on wallace, run the command

ping rtgromit

and it should ping correctly. It may take a few seconds right at the beginning for the two cards to negotiate signals if you are not using a hub. Likewise, from gromit, you should be able to ping rtwallace. Note that you are pinging over the private network. To check this, disconnect one or both of the computers from the normal network. The pinging should continue uninterrupted.

Up to now, you haven't done anything special (i.e., related to rtnet), just set up a private network of two computers. For more information, this topic is better covered in various HOWTOs.

2.2 Half-RT network

If you haven't already, compile and install rtnet, as described in the file INSTALL. Change the line for eth1 in /etc/conf.modules to point to the real-time versions of the driver for the secondary network card, and also the primary network card, if it uses the same driver. Reboot to a real-time kernel, if one is not already running.

You will now use the command 'rtifconfig' provided in the rtnet distribution to configure the interface for RT networking. The command is similar but not identical to the ifconfig command for regular networking. On gromit (whose RT IP address is 192.168.0.1), run the commands

ifdown eth1
rtifconfig eth1 up 192.168.0.1 255.255.255.0

The first command is only necessary if the interface is already running with Linux networking. Normally, you would run a similar command on wallace, but in order to see if everything is working properly, use 'ifup eth1' to bring up normal Linux networking on the RT interface. That way, you can now run (on wallace)

ping rtgromit

and it should start echoing packets. This is a half-real-time network. The computer gromit is replying to packets in real time. The computer wallace, which is still using normal Linux networking, is not working in real-time.

Now, (on gromit), insmod the real-time UDP echo server, rt_echo_server.o. (UDP echo is a standard service normally provided by inetd, but usually disabled. See /etc/inetd.conf.) Then you can run the user-space UDP echo client, echo_client, on wallace, like this:

udp_echo_client 192.168.0.1

This sends UDP packets to gromit, which sends a duplicate copy back.

2.3 Full real-time network

Now, bring down the normal Linux networking on eth1 on wallace, ('ifdown eth1'), and start up the RT networking, using

rtifconfig eth1 up 192.168.0.2 255.255.255.0

Computers using ethernet need to know how to convert IP addresses to hardware addresses. This is typically done using a non-real-time protocol called ARP. The RT networking knows how to handle ARP, but _does not_ automatically generate ARP requests. So you need to force it to generate an ARP request for the other computer. This is done by the command (run on wallace)

rtifconfig eth1 route solicit 192.168.0.2

This generates an ARP request for gromit. gromit then replies with its hardware address. So now wallace knows how to translate gromit's IP address to gromit's hardware address. On the opposite end, gromit received and replied to the ARP request, so it now has wallace in its ARP tables, thus the solicit is not necessary.

Now, on wallace, you can install the rt_echo_client.o module, which is similar to the user-space UDP echo client, except that it is real time. At this point, you have two RT processes communicating over an RT network.


Next Previous Contents