[102243] in RedHat Linux List

home help back first fref pref prev next nref lref last post

Re: RH52, Win95/98 TCP/IP Networking Problem

daemon@ATHENA.MIT.EDU (Joerg Mertin)
Wed Dec 2 03:31:11 1998

Date: Wed, 2 Dec 1998 08:54:17 +0100
From: Joerg Mertin <smurphy@dspecialists.de>
To: redhat-list@redhat.com
Mail-Followup-To: redhat-list@redhat.com
In-Reply-To: <005401be1d48$1d796b60$6401a8c0@home.jdimedia.nl>; from Igmar Palsenberg on Tue, Dec 01, 1998 at 05:31:57PM +0100
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com


--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

On Tue, Dec 01, 1998 at 05:31:57PM +0100, Igmar Palsenberg wrote: 
> 
> 
> Of course not. Set up IP-Masquerade to let all the PC's use Linux as a
> gateway.
> 
> >Any help, or suggestions, etc., are welcomed!

I wrote a little script to acitvate masquerading automagically, ion fact,
it´s a redhat-startup script. Used to work with 4.0, 4.1, 4.2, 5.1 and 5.2
:) it´s not big, so I attached it.

Regards
-- 
It's always darkest just before it gets pitch black.
-------------------------------------------------------------------------
 Systemverwalter:       Joerg Mertin <smurphy@stardust.phantasia.org>
 Phone : +49 30 467 805-71           DSPecialists GmbH
 FAX:    +49 30 467 805-99           Wattstraße 11-13
 Email:  <smurphy@DSPecialists.de>   13355 Berlin
 WWW:    http://www.DSPecialists.de  Germany

--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=masquerade

#!/bin/bash
#
# File Name & location:
# /sbin/masquerade
#
#>>> by "new_file" V1.0, from AIT kit Version 1.0 
#>>> (c) J. Mertin <smurphy@linux.de>
#
# *** Do not modify if you are unsure about what you're doing !
# *** Some changes may destroy your HARDWARE, so be WARNED !
#
# -------------------------------------------------------------
#
#
# masquerade	Start TCP/IP network masquerading services.
#               and accounting for the local host.
#
# Source function library.
. /etc/rc.d/init.d/functions
#
# Source network configuratiin
. /etc/sysconfig/network-scripts/ifcfg-eth0
#
# Masquerade module directory.
MOD_DIR="/lib/modules/`uname -r`/ipv4/"
#
# Starts the wanted service
initiate() {
  # That's it. Initialise it.
  echo "Initializing masquerade for ${HOSTNAME} "
    ipfwadm -F -v -m -p accept
    #
    # Make the masquerading modules get loaded.
    echo -n "Masquerading activated for: "
      #
      for masq_module in ${MOD_DIR}/ip_masq_*
      do
	MODULE=`basename ${masq_module} .o`
	#
	# Create name for echoing back to the command line
	echo -n `echo ${MODULE} | cut -d "_" -f 3 `" "
	#
	# Loading the module
	modprobe ${MODULE}
      done
      #
      # Cut the line :)
      echo 
      #
      # Activating IP-Accounting for the local-host
      echo "Initialising IP-Accounting for ${IPADDR}"
	ipfwadm -A -a -P all -S ${IPADDR} -D 0/0
	ipfwadm -A -a -P all -S 0/0 -D ${IPADDR}
	#
	# Set the lock-file
	touch /var/lock/subsys/masquerade
	#
}
# Stopps the service
terminate() {
  #
  # here we go.
  echo "Shutting down masquerading for ${HOSTNAME} "
    #
    # Make the masquerading modules get loaded.
    echo -n "Masquerading deactivated for: "
      #
      for masq_module in ${MOD_DIR}/ip_masq_*
      do
	MODULE=`basename ${masq_module} .o`
	#
	# Create name for echoing back to the command line
	echo -n `echo ${MODULE} | cut -d "_" -f 3 `" "
	#
	# Loading the module
	rmmod ${MODULE}
      done
      #
      # Cut the line :)
      echo 
      #
      # Do what the echo statement says.
      echo "Deleting forwarding, output and accounting rules"
      ipfwadm -F -v -f
      ipfwadm -O -v -f
      ipfwadm -A -f
      #
      # Remove the lock file
      rm -f /var/lock/subsys/masquerade
      #
}
#
# See how we were called.
case "$1" in
  start)
         initiate
	 ;;
  restart)
	   terminate
	   initiate
	   ;;
  stop)
	terminate
	;;
  *)
     # Oops someone made a typo.
     echo "Usage: masquerade {start|restart|stop}"
     exit 1
esac

exit 0
# 
# -------------------------------------------------------------
#
# End of /sbin/masquerade
#

--tKW2IUtsqtDRztdT--


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
		http://www.redhat.com http://archive.redhat.com
         To unsubscribe: mail redhat-list-request@redhat.com with 
                       "unsubscribe" as the Subject.


home help back first fref pref prev next nref lref last post