]> git.pld-linux.org Git - packages/dhcp-forwarder.git/commitdiff
- init
authorSebastian Zagrodzki <sebek@zagrodzki.net>
Fri, 6 Aug 2004 06:42:18 +0000 (06:42 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    dhcp-forwarder.config -> 1.1
    dhcp-forwarder.init -> 1.1
    dhcp-forwarder.sysconfig -> 1.1

dhcp-forwarder.config [new file with mode: 0644]
dhcp-forwarder.init [new file with mode: 0644]
dhcp-forwarder.sysconfig [new file with mode: 0644]

diff --git a/dhcp-forwarder.config b/dhcp-forwarder.config
new file mode 100644 (file)
index 0000000..9dfc02f
--- /dev/null
@@ -0,0 +1,114 @@
+## $Id$
+
+## This file contains a sample configuration for the network shown
+## below:
+##
+##  --------------              ----------              -------------
+## |  DHCP Server |            |          |            |             |
+## | 192.168.8.66 |------<eth1>| dhcp-fwd |<eth2>------|   Clients   |
+## |              |            |          |            |             |
+##  --------------              ----------              -------------
+##  
+## By default, the dhcp-fwd agent looks at $(sysconfdir)/dhcp-fwd.cfg
+## for this file. By using the '-c' option when calling dhcp-fwd, this
+## path can be changed.
+
+
+######### ENVIRONMENT SETTINGS #########
+####
+###
+## The server will drop its privileges and goes into a chroot-jail
+## after doing its initialization. The following parameters are
+## defining the needed parameters:
+
+## User and group names/ids. It can be a numeric id or a resolvable
+## alphanumeric-name.
+##
+## WARNING: when compiled with dietlibc the user-/group-names must be
+##          resolvable by files-NSS. LDAP or NIS NSS will not work so
+##          the numeric ids must be used
+user           nobody
+group          nobody
+
+## chroot() path
+chroot         /var/lib/dhcp-fwd
+
+## Logfile and loglevel. The logfile-location is relatively to the
+## directory where dhcp-fwd was started and not to the chroot-directory.
+##
+## The loglevel option is not supported yet.
+logfile                /var/log/dhcp-fwd.log
+loglevel       1
+
+## SysV pidfile; contains the PID of the daemon-process and will be
+## written with root-privileges
+pidfile                /var/run/dhcp-fwd.pid
+
+
+## Set limit for resources. When using much interfaces or servers
+## below you will need to increase some values. Same holds when not
+## using dietlibc. Use '-1' as the value to disable the upper limit
+## for the given resource.
+##
+## Look into /proc/<pid>/status to find out the real usage of the
+## resources.
+ulimit core    0
+ulimit stack   64K
+ulimit data    32K
+ulimit rss     200K
+ulimit nproc   0
+ulimit nofile  0
+ulimit as      0
+
+
+######### INTERFACE SETTINGS #########
+####
+###
+## The interface where the forwarder listens for messages. There must
+## be specified BOTH the server-side and client-side interfaces!
+##
+## Each interface will be identified by its system-wide name
+## (e.g. eth0). After this it must be told whether there are
+## clients and servers, and if it is allowed to send broadcast
+## messages to clients. The bcast flags will be IGNORED when
+## forwarding messages to servers.
+
+#      IFNAME  clients servers bcast
+if     eth2    true    false   true
+if     eth1    false   true    true
+
+
+## Each interface can be given an RFC 3046 agent ID. The 'name' config
+## option sets this value; if an interface is not specified here, the
+## IFNAME will be assumed.
+
+#      IFNAME  agent-id
+name   eth2    ws-c
+
+
+## Each interface can be given an specific IP to be filled into the
+## 'giaddr' field.
+##
+## BEWARE: because the outgoing DHCP message will contain the "normal" IP
+## address of the outgoing-interface in its IP-header, some additional
+## work in the system must be done. You can e.g. add an iptables rule to
+## the 'nat' table similarly to this:
+##
+## | Chain POSTROUTING (policy ACCEPT)
+## | target     prot opt source               destination         
+## | SNAT       udp  --  192.168.0.6          192.168.8.66       udp spt:68 dpt:67 to:192.168.2.255 
+
+# ip   eth0    192.168.2.255
+
+
+######### SERVER SETTINGS #########
+####
+###
+## Definitions of the servers. There must be told the type ('ip' or
+## 'bcast') and the address. When using 'ip', the address is a non-bcast
+## IPv4 address (dotted, DNS-names are NOT supported); and when using
+## 'bcast' servers, the address is an IFNAME.
+
+#      TYPE    address
+server ip      192.168.8.66
+#server        bcast   eth1
diff --git a/dhcp-forwarder.init b/dhcp-forwarder.init
new file mode 100644 (file)
index 0000000..97ae930
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/sh
+#
+# dhcp-forwarder       dhcp-forward agent
+#
+# chkconfig:   345 95 05
+#
+# description: The dhcp-forward agent relays DHCP messages between two \
+#              networks
+#
+# $Id$
+
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Set defaults
+DHCPFWD_CFGFILE="/etc/dhcp-fwd.conf"
+DHCPFWD_OPTIONS=
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/dhcp-forwarder ] && . /etc/sysconfig/dhcp-forwarder
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network ]; then
+               # nls "ERROR: Networking is down. %s can't be run." dhcp-forwarder
+               msg_network_down dhcp-forwarder
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+
+# See how we were called.
+case "$1" in
+  start)
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/dhcp-forwarder ]; then
+               # show "Starting %s service" dhcp-forwarder
+               msg_starting dhcp-forwarder
+               daemon dhcp-fwd -c "${DHCPFWD_CFGFILE}" ${DHCPFWD_OPTIONS}
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcp-forwarder
+       else
+               # show "%s service is already running." dhcp-forwarder
+               msg_already_running dhcp-forwarder
+       fi
+       ;;
+  stop)
+       if [ -f /var/lock/subsys/dhcp-forwarder ]; then
+               # Stop daemons.
+               # show "Stopping %s service" dhcp-forwarder
+               msg_stopping dhcp-forwarder
+               killproc dhcp-fwd
+               rm -f /var/lock/subsys/dhcp-forwarder
+       else
+               # show "%s service is not running." dhcp-forwarder
+               msg_not_running dhcp-forwarder
+       fi
+       ;;
+  restart)
+       $0 stop
+       $0 start
+       exit $?
+       ;;
+  force-reload)
+       $0 restart
+       exit $?
+       ;;
+  status)
+       status dhcp-fwd
+       RETVAL=$?
+       ;;
+  *)
+       # show "Usage: %s {start|stop|restart|reload|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       exit 3
+esac
+
+exit $RETVAL
+
+# This must be last line !
+# vi:syntax=sh:tw=78:ts=8:sw=4
diff --git a/dhcp-forwarder.sysconfig b/dhcp-forwarder.sysconfig
new file mode 100644 (file)
index 0000000..43246d9
--- /dev/null
@@ -0,0 +1,6 @@
+# Customized setings for dhcp-forwarder
+#DHCPFWD_CFGFILE=/etc/dhcp-fwd.conf
+#DHCPFWD_OPTIONS=
+
+# Define nice level for dhcp-forwarder 
+SERVICE_RUN_NICE_LEVEL="+0"
This page took 0.121267 seconds and 4 git commands to generate.