"Linux Gazette...making Linux just a little more fun!"


IPmasquerading with Roadrunner or Second Ethernet Card

By Mark Nielsen


This is for Red Hat 5.0 systems. You can probably do a similar thing for other linux systems. It is specifically configured for roadrunner in Columbus, Ohio. If you live somewhere else, you will have to change anything with "columbus" in the configuration to something else. So far, the only thing I see you have change is in /etc/resolv.conf, but I believe that gets changed everytime you start rrhdcpcd.

If you manage to pull this off, you are almost one step away from being able to install a real network to the internet. Think about it, the only difference between what we are doing here and a real network connected to the internet is that fact that your local intranet doesn't have real valid ip addresses. If you had real valid ip addresses and your gateway addressed stayed the same (it changes everytime you log into roadrunner) then you would have a real fixed network connected to the internet. Do this, and you can actually say you have real networking experience. This involves ethernet, DNS, ip forwarding, ip masquerading, ethernet configuration, and a lot of other stuff. Good luck!

I also wish to thank a bunch of people at The Ohio State University for their suggestions. I hope I was able to implement them correctly!

  1. References
  2. Install roadrunner first on a windows95 computer and get the configuration files. You will need them.
  3. Short way, if you have 2 3com 3c509 cards aet at irq=10, address 300, and irq=11,address=310. If this works, great, but otherwise do all the steps.
  4. Setup your ethernet cards.
  5. Setup your DNS on the server. Just use my examples. I have it setup for 9 computers if you need that many. Also, you must have the DNS rpm installed. Here is a dns caching server from my cheapbytes Redhat 5.0 cdrom.
  6. Setup your clients.
  7. Compile kernel for ip masquerading and ethernet card driver.
  8. Change various configuration files.
  9. Hook up your hub, gateway computer, and roadrunner.
  10. Connect your gateway computer to the internet with roadrunner.
  11. Setting roadrunner up as a service and making the first ethernet card use rrdhcpcd.
  12. Starting and stopping the roadrunner service and rrdhpcd.
  13. Other things.
  14. Index of files. You should not have blank lines at the beginning of the files!

References

  1. RoadRunner Columbus, OH Infosite. You can get roadrunner stuff from here.
  2. HOWTO -- Compiling the Kernel for IP Masquerade Support
  3. Linux IP Masquerade Resource
  4. Linux IP Masquerading Web Site
  5. Network at home and a modem by Mark Nielsen. This article is very similar to this one.
  6. RoadRunner help webpage. This is where I got my rrclientd program.
  7. DNS. You almost don't need this if you use /etc/hosts file for your linux computers. For Windoze95 and other operating systems you will have to.
  8. Ethernet. Howto set up your ethernet cards.
  9. Firewall. If you want to setup your firewall, it is trivial with this setup.
  10. Networking-3. How to do networking in general.
  11. Bootprompt. Howto modify what the kernel does at boottime.
  12. Linux kernel
  13. DHCPcd mini howto. I found this useful in answering some questions.

Short way

THIS SHORT SECTION ONLY WORKS IF YOU MANAGE to get both ethernet cards detected with modules. It will probably not work for most people.

This will probably only work with RedHat 5.0. These steps you must not deviate from. For some reason, the installation of redhat detected both ethernet cards properly and also the kernel has ip forwarding in the kernel. It just needs to be enabled. Thus, Installing your own network is just a bunch of file copying and a couple of commands and you are done. Be sure to install roadrunner with Windows95 first to get a configuration file.

1. Install both ethernet cards before you install RedHat 5.0 The two ethernet cards I used were 3com 3c509. The first had values of, irq=10, address=300 and the second had irq=11, address=310. Also, when you install RedHat 5.0, go ahead and install it for a LAN and have it autoprobe the ethernet cards. I cannot figure it out, but when I installed redhat after installing these two ethernet cards, it gets them both everytime, when before it wouldn't. When it comes close to the end of the RedHat 5.0 installation, it will ask to to select which services you want started on bootup. I turn off sendmail and smb. I do this because it hanged on me at boot time. When you install RedHat 5.0, install everything. I did. You also shouldn't have to change /etc/lilo.conf.

2. You don't need to recompile the kernel. Just add this file to yours.
/etc/rc.d/rc.local
Also, add the krb5.ini file in C:\NETMANAG for Windows95 to
/etc/krb5.conf
Also, make a file called "/etc/rrpasswd" which only has one line on it which is the password for your roadrunner username.

3. Execute the commands
mkdir /etc/dhcpc
unset noglob

4. Copy these files to their exact location
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth1
/etc/rc.d/init.d/roadrunner
/etc/dhcpc/resolv.conf

/etc/named.conf
/var/named/10.0.0
/var/named/mark.local
/var/named/named.local

/etc/HOSTNAME
/etc/hosts

/root/Login2.bat
/root/email.pl
/root/cron2

5. Downlaod rrclientd-1.3, untar and ungzip it, and copy all the files in rrclientd-1.3/bin to /sbin. For example, if you are in rrclientd-1.3/bin, execute "cp * /sbin". I had the binaries when I got mine, so hopefully you won't have to compile them. Compiling with the new libraries Red Hat has had has been tricky at times.

You may have to alter the /etc/services file as it says in the README file for rrclientd-1.3.

6. Execute the commands
mv /etc/resolv.conf /etc/resolv.conf_old
ln -s /etc/dhcpc/resolv.conf /etc/resolv.conf
mv /sbin/dhcpcd /sbin/dhcpcd_old
mv /usr/sbin/dhcpcd /usr/sbin/dhcpcd_old
mv /usr/bin/rdate /usr/bin/rdate_old

ln -s /sbin/rdate /usr/bin/rdate
ln -s /sbin/rrdhcpcd /sbin/dhcpcd
ln -s /sbin/rrdhcpcd /usr/sbin/dhcpcd
ln -s /sbin/rrclientd /usr/sbin/rrclientd

cp /root/roadrunner /etc/rc.d/init.d ## adding roadrunner service
chkconfig --add roadrunner

crontab /root/RR/cron2 ### resetting connection in a cron job

## Making it so we can execute the scripts with cron2
chmod 755 /root/Login2.bat /root/email.pl /etc/rc.d/init.d/roadrunner

### We only want root to see the password!
chmod 700 /etc/rrpasswd

7. In /etc/rc.d/init.d/roadrunner, make sure you change the username to your username that you got for roadrunner.

8. Follow the steps in Hook up your hub, gateway computer, and roadrunner and if you have clients, follow the steps in Setup your clients .

9. Now we need to attach dhpc to your first ethernet card. Follow the instructions on part b of Setting roadrunner up as a service.

10. Reboot your computer and you are done!

11. If you have any problems whatsoever, all I can say is, make sure your timezone is correct and that your time is not ahead of the current time by one second or behind it by more than 5 minutes, and if that doesn't help, use the rest of the instructions I have.


First ethernet card

Install your first ethernet card as normal when you install the operating system. Give it a phony ip address you will not use on your network. For some reason, this ethernet card has to be the one connected to the outside in order to get everything to work right with xwindows forwarding. Now, let me state, I had to do this for only people coming in. Going out, you should have no problem with the second ethernet card being the one hooked up to roadrunner. However, I could never telnet in from work to my house and get an xwindows program to work when roadrunner was using the second ethernet card. The second ethernet card will be for the intranet.

Also, setup your second ethernet card to NOT use the same irq and address of your first ethernet card. Traditionally, I use lower irq and address for my first ethernet card compared to the second. Often I use a dos computer using a dos program to set the values for the ethernet cards. You will probably have to do this as well.

Don't do anything yet with roadrunner or your rrdhcpcd program yet. Also, don't worry about the network configurations yet, we will take care of it later. Also don't worry about the fact Linux probably won't see the second ethernet card, we will take care of this later. Just make sure the ethernet cards don't use the same hardware values. Also, if your second ethernet card has a lower irq and address than the first, the computer might think it is the first, so I believe there really is a reason why I make the first ethernet card with the lower values. I ain't gonna test if I am wrong. You should just make sure at least one ethernet card is detected.


Setup your DNS server on your server connected to the internet.

If you know what you are doing, you can change the configurations. Because I am silly, I choose the domain "mark.local". If "mark.local" every becomes an official domain, then you will have to change every occurance of "mark.local" to something else in the files below.
  1. Copy the following files to your server
    1. /etc/named.boot
    2. /etc/resolv.conf
    3. /var/named/mark.local
    4. /var/named/10.0.0
    5. /var/named/named.local
    6. /etc/hosts is a file I would use, but don't need. Just in case your dns server fails, this is handy for a backup.
  2. Leave /var/named/named.ca and named.local the same
  3. Restart named with this command
    /etc/rc.d/init.d/named restart

There are a couple of things you could change for your own personal needs. In /var/named/mark.local, I disabled localhost definition.

Now at least your clients computers can find each other. I assume you know how to setup ip addresses, gateways, and other stuff for your clients. I will give some pointers on this anyways. Setup clients to use DNS server.


Setup your client computers

In your computer that is acting like the DNS server, I have upto eight additional entries in the dns server so that you can have upto eight computers using the dns server. I am assuming you know a little bit about ethernet cards. Here are the following configurations I did for a computer of mine.
  1. ip address = 10.0.0.21
  2. name address = c1.mark.local
  3. gateway address = 10.0.0.10 <-- second ethernet card on server computer
  4. netmask = 255.255.255.0
  5. As for the file /etc/resolv.conf, use this one for the clients.
  6. I didn't have to fuss with the kernel on the client computers. As far as the clients are concerened, your server is just a normal gateway.
  7. /etc/hosts is a file I would use, but don't need. Just in case your dns server fails, this is handy for a backup.

The only thing you should have to change to each additional computer is the ip address and the name address. c2.mark.local and 10.0.0.22 would be used for the next computer. Get the idea?

Also, if you are using pc or mac clients or other stuff, check out the masquerading mini-howto.


Setup masquerading on the server

If you were able to get your module(s) to detect both ethernet cards, then this section doesn't apply. But if you could not get the modules to recognize both ethernet cards, which will be the case for most people, you MUST COMPILE THE DRIVER of the ethernet card into your kernel and also compile in the masquerading bit. I have had problems getting modules to work with 2 ethernet cards of the same type. Somehow, when I installed RedHat 5.0 from scratch, it got both of my ethernet cards, but it was probably an unusal case.

Read the ip masquerading HOWTO. Follow its steps on compiling the kernel for masquerading. NOTE -- VERY DANGEROUS if you screw this up. About, installing the kernel, RedHat did something silly when they configured the /etc/lilo.conf file. Change this line "image=/boot/vmlinuz-2.0.32" to "image=/boot/vmlinuz" and make sure you run "lilo" at some point before you reboot your computer. Do it now to be safe.

1. And also, these are the steps I use to compile the kernel, first configure it like the howto says
cd /usr/src/linux
make config

2. and when that is done, compile it
make dep
make clean
make zImage

3. and if it worked, compile and install the modules
make modules
make modules_install

4. After you created your kernel, do the following steps to install your new kernel.

cp /usr/src/linux arch/i386/boot/zImage /boot/vmlinuz_NEW
rm /boot/vmlinuz
ln -s /boot/vmlinuz_NEW /boot/vmlinuz
lilo

That should install your kernel if you compiled it. Here is an example of my /etc/lilo.conf file.

YOUR /etc/lilo.conf WILL NOT BE THE SAME AS MINE. Change /etc/lilo.conf for your specific needs and please read about append in the BOOTPROMPT howto before you use it. You will have to modify this file yourself. Add the append statement like I did for two ethernet cards.


Change some configuration files

Use these files.
  1. Change /etc/rc.d/rc.local which will start the ip masquerading. Actually, ADD THIS to your rc.local file and do not overwite it.
  2. Change /etc/sysconfig/network and remember that these values don't me anything and will get changed once you log into the internet.
  3. Change /etc/sysconfig/network-scripts/ifcfg-eth0 and also change /etc/sysconfig/network-scripts/ifcfg-eth0.

Hook up the network.

  1. Put your gateway server computer between the roadrunner box and the hub.
  2. Reboot the computer.
  3. Hook up all your other computers to the hub.
  4. See if you can ping or connect from a client computer to your gateway computer. If so good.
  5. See if your internal computers can see each other. You don't need the gateway computer to do this, this is just to check to see if your hub is working. Telnet, ping, ftp, or others should work. For example, "ping c1" would ping your c1.mark.local computer. If you used /etc/hosts like I told you to, you don't need the gateway server to resolve the ip address. Or you could just do "ping 10.0.0.21" to do the same thing.
Specifically, you should hook up the first ethernet card to the roadrunner modem thing and the second ethernet card to the hub.

Now we need to get your gateway computer connected to the internet.


Connect your gateway to the internet.

Did you remember to first install roadrunner on a Windows95 computer to get the configuration files? If so, you better.

Download the rrclientd-1.3.tar.gz and rrdhcpcd-1.02.tar.gz files. You don't need rrdhcpcd-1.02.tar.gz unless you want to compile as it has a binary contained in rrclientd-1.3.tar.gz. Here are the briefs instructions on what to do, but read the README file that comes with rrclientd-1.3.tar.gz. It tells you in better detail what to do next. Use rrdhcpcd instead of dhcpcd. It works better and seems to initiate faster.

  1. Create a /etc/rrpasswd file that contains the password for your account. A "chmod 700 /etc/rrpasswd" command if you only want root to be able to read it.
  2. Link your /etc/resolv.conf file to /etc/dhcpc/resolv.conf with the commands
    mkdir /etc/dhcpc
    cp /etc/resolv.conf /etc/dhcpc/resolv.conf
    rm /etc/resolv.conf
    ln -s /etc/dhcpc/resolv.conf /etc/resolv.conf
  3. Copy a file from your windows95 installation to /etc/krb5.conf
  4. Make changes to your /etc/services file as said in the readme file from rrclientd-1.3.tar.gz.
  5. Copy the binaries you need for rrclientd into /sbin, or at least, that is what I did. The rest of this document will assume you put your binaries in /sbin.
  6. Make sure the time on your computer is not ahead of the current time and not behind by more than 5 minutes. Also, make sure your timezone is correct.
  7. I am going to assume you are using rrdhcpcd. If you don't have a binary of it, you will have to compile it. Execute these commands to make sure you have the correct links to use the new programs you copied to /sbin.
    mv /sbin/dhcpcd /sbin/dhcpcd_old
    mv /usr/sbin/dhcpcd /usr/sbin/dhcpcd_old
    mv /usr/bin/rdate /usr/bin/rdate_old

    ln -s /sbin/rdate /usr/bin/rdate
    ln -s /sbin/rrdhcpcd /sbin/dhcpcd
    ln -s /sbin/rrdhcpcd /usr/sbin/dhcpcd
    ln -s /sbin/rrclientd /usr/sbin/rrclientd

Once you have installed rrclientd-1.3.tar.gz properly, use this file /root/Login.bat to start your login session with "source /root/Login.bat". Remember to change USERNAME in the file to whatever username it is that you have. In my script, I stop and start rrdhcpcd, which is unecessary. Once rrdhcpcd is started, it tries to renew the ip address every 3 hours. Thus, you should never have to stop rrdhcpcd, but I do it anyways.


Setting roadrunner up as a service.

You need to set your ethernet card to use the dhcp protocol and to have roadrunner as an activated service in order for it to start when your computer is turned on. This worked for me. I read the dhcpcd program (and probably rrdhcpcd does the same thing) tries to renew the ip address every 3 hours. This is good. This means users don't have to start and stop it.

A. First, install roadrunner as a service.

  1. This webpage is the guide I used.
  2. /root/roadruner is the file you need. I downloaded this April 7th, 1998. It looks pretty straightforward, so I doubt it will change.
  3. Change your username in the file like it says to.
  4. Copy it to the /etc/rc.d/init.d directory like
    cp /root/roadrunner /etc/rc.d/init.d
  5. Issue the command
    chkconfig --list | grep roadrunner
    and you should see
    roadrunner 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  6. Activate the service by
    chkconfig --add roadrunner
  7. Issue the command
    chkconfig --list | grep roadrunner
    and you should see
    roadrunner 0:off 1:off 2:on 3:on 4:on 5:on 6:off

B. Now use the control panel. Log in as root and use xwindows. "startx" will start xwindows at the prompt if you don't have xdm running. The control-panel should be there. This next step will set the first ethernet card to use dhcp which we replaced with rrdhcp (the computer doesn't know any better).

  1. Click on the "Network Configuration" icon in the control panel.
  2. Click on "Interfaces".
  3. Click on "eth0"
  4. Click on "edit"
  5. OPTIONAL: Click on "Allow user to (de)active interface".
  6. Choose "dhcp" for Interface configuration protocol.
  7. Click somewhere to save the changes.

Okay, we got rrdhcpcd running by setting the first ethernet card to use the protocl dhcp and we installed the roadrunner service which uses rrclientd.

Reboot your computer and see what happens!

You should be connected to the internet when your server boots up as well as all your clients. If you use a web browser, you might have to set it to use the "proxy-server" on port 8080. Programs like telnet, ssh, nslookup, ftp, and ping should work. Actually, ping might work with just rrdhcpcd being activated.

Starting and stopping the roadrunner service and rrdhpcd.

Well, to stop everything down and start everything up, you would do
/etc/rc.d/init.d/roadrunner stop
/etc/rc.d/init.d/network stop
/etc/rc.d/init.d/network start
/etc/rc.d/init.d/roadrunner start

But of course, that is a little drastic. Rrdhpcd supposedly tries to renew the ip address every 3 hours, so you should never have to start and stop it. That is good because it takes a while to initiate and stalls the network.

Why would you want to stop and start the roadrunner service? Well, in theory, rrdhpcd should get the same ip address 99% of the time if you leave it on all the time. If it doesn't, you are screwed and you will have to restart the roadrunner service. Thus, instead of using my /root/Login.bat script, just put into the cron for the roadrunner service to be stopped and started at specific times. Use the files /root/Login2.bat and /root/cron2 and /root/email.pl. Make sure you do a "chmod 755 /root/Login2.bat /root/email.pl". And also do a "crontab /root/cron2". Oh, uh, if you had other stuff cronned as root, I would "add the cron stuff" or otherwise you are going to blow away your previous cron jobs.

Also, a quote from Joshua Jackson when I e-mailed him about what problems you might have being logged in all the time.

If for some reason you lose your IP address (this SHOULD NOT happen under
normal circumstances), you Kerberos tickets and GSS auth info would become
invalid.  If this happens, rrclientd will exit and you will need to log   
back in.

The only reason that you would lose your IP address would either be a
hardware/software malfunction at either the client or server end or a
reset of the dhcp servers at RR.

Joshua Jackson

Other things

Use this section at your own risk. This stuff I plan to elaborate more on given that some people have made good suggestions about them. For updates to this webpage, look at http://linux.med.ohio-state.edu/nielsen/rr.html, but that might even change someday. NONE OF THIS STUFF in this section is explained well. Modifications are probably in order at some point. This is just what I would do.
  1. If you don't setup the roadrunner service and bind rrdhcpcd to the ethernet card but you want to stay connected almost 24 hours a day, you could do something like send yourself e-mail once an hour use a perl script and and cron job on your gateway server and issue the command "crontab cron" to get it started. The /root/cron file uses /root/Login.bat file, so you need it also. Also the /root/Kill.bat file to kill it at 1 a.m. You don't have to, I do. Do a "chmod 755 /root/email.pl /root/Kill.bat /root/Login.bat". Modify the stuff as you see fit. Also, add this to your /etc/rc.d/rc.local file and replace USERNAME with the username you use for roadrunner. This will start the stuff at boot time if you didn't set it up to do so with the roadrunner service and control panel.
    echo starting rrdhcpcd
    /sbin/rrdhcpcd eth0
    echo sleeping for 5 seconds
    sleep 5
    echo Starting rrclientd
    /sbin/rrclientd  -u USERNAME /etc/rrpasswd dce-server 
    echo finished
    echo sleeping 20 more seconds
    sleep 20
    
  2. If you are interested in what programs you can use, telnet, ssh, ftp, ping, nslookup, and xwindows programs seem to work. I have heard other ones do as well. Some of resources in "References" above mention other things like ircs and other stuff.
  3. In /etc/inet.d, I would comment out ftp, telnet, rsh, pop3, pop2, imap, and gopher for security reasons. Compile and install ssh.
  4. If you are interested in fixing /etc/resolv.conf so that it doesn't change, do a "chmod 444 /etc/dhcpc/resolv.conf" after you configure it. I recommend you only add information like nameservers and domains, like mine is
    domain columbus.rr.com
    search mark.local columbus.rr.com 
    nameserver 10.0.0.10  ### this is our DNS
    nameserver 204.210.252.18 ### this is the roadrunner dns
    nameserver 128.146.1.7  ### ONLY FOR OSU PEOPLE IN COLUMBUS OHIO!
    

Index of files

You should not have blank lines at the beginning of the files!


/etc/named.boot for server
 
;
; a caching only nameserver config
;
directory                              /var/named
cache           .                      named.ca
primary         0.0.127.in-addr.arpa   named.local
primary        mark.local        mark.local
primary          0.0.10.in-addr.arpa   10.0.0

/etc/resolv.conf for server and clients
domain columbus.rr.com
search mark.local columbus.rr.com 
nameserver 10.0.0.10  ### this is our DNS
nameserver 204.210.252.18 ### this is the roadrunner dns
nameserver 128.146.1.7  ### ONLY FOR OSU PEOPLE IN COLUMBUS OHIO!

### You can probably use our dns first if you want. Actually, I would.


/var/named/mark.local for server
 
mark.local.       IN      SOA  main.mark.local. root.main.mark.local.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
mark.local.       IN      NS      main.mark.local.
;localhost IN       A       127.0.0.1
main.mark.local.   IN     A       10.0.0.10
c1.mark.local.     IN      A       10.0.0.21
c2.mark.local.     IN     A       10.0.0.22
c3.mark.local.     IN     A       10.0.0.23
c4.mark.local.     IN     A       10.0.0.24
c5.mark.local.     IN     A       10.0.0.25
c6.mark.local.     IN     A       10.0.0.26
c7.mark.local.     IN     A       10.0.0.27
c8.mark.local.     IN     A       10.0.0.28


/var/named/10.0.0 for server
 
0.0.10.in-addr.arpa. IN   SOA  main.mark.local. root.main.mark.local. (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
              IN      NS      main.mark.local.
10.0.0.10.in-addr.arpa.       IN      PTR     main.mark.local.
21.0.0.10.in-addr.arpa.       IN      PTR     c1.mark.local.
22.0.0.10.in-addr.arpa.       IN      PTR     c2.mark.local.
23.0.0.10.in-addr.arpa.       IN      PTR     c3.mark.local.
24.0.0.10.in-addr.arpa.       IN      PTR     c4.mark.local.
25.0.0.10.in-addr.arpa.       IN      PTR     c5.mark.local.
26.0.0.10.in-addr.arpa.       IN      PTR     c6.mark.local.
27.0.0.10.in-addr.arpa.       IN      PTR     c7.mark.local.
28.0.0.10.in-addr.arpa.       IN      PTR     c8.mark.local.


/var/named/named.local for server


@       IN      SOA     localhost. root.localhost.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
              IN      NS      localhost.

1       IN      PTR     localhost.


/etc/hosts for server and clients
 
127.0.0.1 localhost     localhost.localdomain
10.0.0.21 c1.mark.local c1
10.0.0.10 main.mark.local       main
10.0.0.22 c2.mark.local c2
10.0.0.23 c3.mark.local c3
10.0.0.24 c4.mark.local c4
10.0.0.25 c5.mark.local c5
10.0.0.26 c6.mark.local c6
10.0.0.27 c7.mark.local c7
10.0.0.28 c8.mark.local c8



/etc/resolv.conf for the client computers
 
search mark.local
nameserver 10.0.0.10


/etc/lilo.conf
 
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
### WARNING!!! THE APPEND STATEMENT IS FOR MY COMPUTER ONLY!!!!!
image=/boot/vmlinuz
        label=linux
        root=/dev/hda1
        append="ether10,0x300,eth0 ether=11,0x310,eth1"
        read-only


/etc/rc.d/rc.local for server
## Add this file to /etc/rc.d/rc.local 

echo "setting up ip masquerde"
/sbin/depmod -a
/sbin/modprobe ip_masq_ftp
/sbin/modprobe ip_masq_raudio
/sbin/modprobe ip_masq_irc

echo "setting up permissions for 10.0.0.0 domain for mas"
ipfwadm -F -p deny
ipfwadm -F -a m -S 10.0.0.0/24 -D 0.0.0.0/0


/etc/sysconfig/network for server
NETWORKING=yes
FORWARD_IPV4=true
HOSTNAME=main.mark.local
DOMAINNAME=mark.local
GATEWAY=
GATEWAYDEV=eth0


/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
IPADDR=10.0.1.10
NETMASK=255.255.255.0
NETWORK=10.0.1.0
BROADCAST=10.0.1.255
ONBOOT=yes


/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
IPADDR=10.0.0.10
NETMASK=255.255.255.0
NETWORK=10.0.0.0
BROADCAST=10.0.0.255
ONBOOT=yes


/root/Login.bat
## This is a drastic solution to stop and start your roadrunner stuff
## Personally, you should only have to start and stop the roadunner
## service every once in a while, and you shouldn't mess with the network
date
echo killing rrclientd
/sbin/rrclientd -k
sleep 5
echo killing rrdhcpcd
/sbin/rrdhcpcd -k eth0
echo sleeping 2 seconds
sleep 2
### uncomment the next 5 lines if you wish, you probably don't have to
##echo stopping and starting the network
##/etc/rc.d/init.d/network stop
##echo sleeping 5 seconds
##sleep 5 
##/etc/rc.d/init.d/network start
echo starting rrdhcpcd
/sbin/rrdhcpcd eth0
echo sleeping for 5 seconds
sleep 5
echo Starting rrclientd
/sbin/rrclientd  -u USERNAME /etc/rrpasswd dce-server
echo finished
echo sleeping 20 more seconds
sleep 20


/root/roadrunner for server
#!/bin/sh
#
# roadrunner  This shell script takes care of starting and stopping
#             rrclientd.
#
# chkconfig: 2345 11 30
# description: Logs the system into TWC Road Runner Internet Service
#
# Author: Joshua Jackson  jjackson@neo.lrun.com
#         1/6/98
#
# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/rrclientd ] || exit 0

RRUSER="Your Username Goes here!"

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Logging into Road Runner: "
        daemon rrclientd -u ${RRUSER} /etc/rrpasswd dce-server
        echo
        ;;
  stop)
        # Stop daemons.
        echo -n "Logging out of Road Runner "
        killproc rrclientd
        echo
        ;;
  status)
        status rrclientd
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: roadrunner start|stop|restart"
        exit 1
esac

exit 0


/root/email.pl for server
!/usr/bin/perl

$EMAIL = "USERNAME\@somewhere.foo.edu";

open(EMAIL,"| /bin/mail -s RR $EMAIL");
$date = `date`;
chop $date;

print EMAIL "DATE AND TIME: $date\n";
print EMAIL "--------------------------------------------------\n";
print EMAIL "test\n";

close(EMAIL);


/root/cron for server
# Let us restart dhcpd and rrclient 7 a.m., 2 p.m., and 10 p.m.
# and kill it at 1 a.m.
# and e-mail once an hour 5 minutes after the hour
0 7,14,22 * * *     /root/Login.bat  >> /root/Login.log
0 1 * * *     /root/Kill.bat >> /root/Kill.log
5 * * * * /root/mail.pl  


/root/Kill.bat for server
date
/sbin/rrclientd -k
sleep 5
/sbin/rrdhcpcd -k eth0
sleep 5


/root/Login2.bat
### We just need to quickly stop and start roadrunner
/etc/rc.d/init.d/roadrunner stop
sleep 5
/etc/rc.d/init.d/roadrunner start


/root/cron2
# Let us restart roadrunner 7 a.m., 2 p.m., and 10 p.m.
# and e-mail once an hour 5 minutes after the hour
0 7,14,22 * * *     /root/Login2.bat  >> /root/Login2.log
5 * * * * /root/mail.pl


/etc/HOSTNAME
main.mark.local


Copyright © 1998, Mark Nielsen
Published in Issue 28 of Linux Gazette, May 1998


[ TABLE OF CONTENTS ] [ FRONT PAGE ]  Back  Next