dhcp-fwd(1)

๐Ÿ“ฆ version 0.11, in fedora 43, fedora 44

๐Ÿ’– dhcp-fwd โ€” the manual, bestie edition ๐Ÿ’–

okay so you found dhcp-fwd(1), the General Commands Manual page, and honestly? iconic. let me walk you through it like we're texting at 2am. ๐Ÿฆ‹


โœจ NAME โœจ

dhcp-fwd โ€” starts the DHCP forwarding agent. that's it, that's the whole vibe. ๐Ÿ‘‘


๐ŸŒธ SYNOPSIS ๐ŸŒธ

dhcp-fwd [-n] [-N] [-d] [-v] [-h] [-c config_file]

๐ŸŽ€ DESCRIPTION ๐ŸŽ€

so dhcp-fwd starts a DHCP forwarding agent which relays DHCP messages between subnets with different sublayer broadcast domains. it's giving bridge-between-worlds energy fr fr. ๐Ÿ’ซ

when you call it with no arguments at all, it reads its configuration from /etc/dhcp-fwd.conf and forks itself into the background. a different configfile? that's what the -c option is for, bestie. and if you don't want it to fork at all, hit it with the -n switch. there's also a -d option that's intended for debugging purposes and prevents forking too โ€” but lowkey, currently it is just an alias for -n. ๐Ÿ’€

the way that this program must be started as root but then drops its privileges and goes into a chroot-jail after finishing the initialization?? main character behavior honestly. it gets in, does the job, and locks itself down. periodt. ๐Ÿ”


โœจ OPTIONS โœจ

  • -n โ€” Prevents the daemon from going into background after initialization. this one's useful when you're using advanced init-concepts like minit (http://www.fefe.de/minit/). ๐Ÿซถ
  • -N โ€” Like -n, but the program sends a SIGSTOP signal to itself when initialization has been finished. this is interpreted e.g. by the upstart init system. ๐ŸŒˆ
  • -d โ€” Turns on debugging mode and prevents forking; currently it is just an alias for -n. ngl it's the same thing wearing a different hat. ๐Ÿ™ˆ
  • -c config_file โ€” Specifies the configfile to use; the default is /etc/dhcp-fwd.conf. ๐Ÿ“
  • -v โ€” Shows version. quick lil flex. โญ
  • -h โ€” Shows help. your girl's got your back. ๐Ÿ’œ

๐Ÿฆ‹ CONFIGURATION FILE ๐Ÿฆ‹

the default location of the configfile is determined at compilation-time and can be overridden by using the -c option. and when an option needs a boolean parameter, the keywords true, false, 0, 1, yes and no are all possible values. so many ways to say yes. ๐Ÿ’…

within the configfile, the following options MUST be set (no skipping, bestie, these are mandatory):

  • user username|uid โ€” The program setuid()'s to the given user after finishing its initialization. The parameter must be an alphanumeric username or a numeric uid. ๐Ÿงš
  • group groupname|gid โ€” The program setgid()'s to the given group after finishing its initialization. The parameter must be an alphanumeric groupname or a numeric gid. ๐Ÿงš
  • chroot path โ€” The program goes into this directory and calls there chroot() after finishing its initialization. ๐Ÿ 
  • pidfile filename โ€” The file where the pid of the daemon will be written into. ๐Ÿ“

๐ŸŒธ the optional ones (still slay tho) ๐ŸŒธ

beside the mandatory options above, the following options are possible:

  • ulimit resource limit โ€” Sets a maximum limit for the given resource by calling setrlimit() appropriately. Possible values for resource are stack, data, core, rss, nproc, nofile, memlock, as and (if supported by your OS) locks. For the meaning of this values see setrlimit(2).

limit may be plain unsigned number, a number followed by 'k' (*1000), 'K' (*1024), 'm' (*1000k), 'M' (*1024K) or '-1' to remove the limit for this resource. ๐Ÿงฎ

  • logfile filename โ€” Specifies the file where messages will be stored. This file is located relatively to the directory where dhcp-fwd was started and not to the directory given at the chroot option. lowkey important distinction, don't get caught slippin'. ๐Ÿšจ
  • if ifname has_clients has_servers allow_bcast โ€” Declares an interface and sets parameter of the network topology. When an interfacename is used in one of the other options, it must have been declared by if already. no gatekeeping โ€” declare first, then reference. ๐Ÿšช

ifname is the name of the interface as being used e.g. by ifconfig also (e.g. eth0).

has_clients and has_servers tell if messages from clients or servers can be expected on this interface. BOOTREQUESTs are assumed to be client- and BOOTREPLYs are assumed to be server-messages. Unexpected packages will be dropped away. bye felicia. ๐Ÿ‘‹

allow_bcast is/was an experimentell features and will be disappear probably. When not set, the interface will not send packages to IP-broadcast addresses. This affects messages to clients only; when specifying a bcast-server, this option will be ignored. ๐Ÿซฃ

  • ports ifname client-port server-port โ€” Declares the ports which are used on the specified interface ifname for client resp. server functionality. ๐Ÿšช

dhcp-fwd acts as client only, when the has_servers flag has been set and sends from client-port then. Interface will be listen on server-port when the has_clients and/or has_servers flags of the interface have been set.

Omitting this option for an interface or using a value of "0" for the port arguments uses default values. These are port 68/udp (bootpc) for client-port and port 67/udp (bootps) for server-port by default. โœจ

NOTE: This option exists to avoid conflicts with already running dhcp servers, clients or relay agents which do not bind to specific interfaces. The DHCP/BOOTP protocol relies on the 67/udp + 68/udp ports and you have e.g. to configure iptable rules which rewrite your custom port numbers to the expected ones. See BUGS below for further restrictions. โš ๏ธ
  • name ifname agent-id โ€” specifies the RFC 3046 agent-id for the given interface. When not used explicitly, the interfacename will be assumed as the agent-id. ๐Ÿท๏ธ
  • ip ifname ip โ€” assigns the ip to be used in the giaddr field. By default to IP of the interface will be assumed but when having multiple IPs for one interface this option may be usefully. ๐Ÿ‘€
Attention: This IP will not be used in the IP-layer; this means that the UDP packet sent to the server will contain the IP assigned by the system. To setup this address, usual SNAT rulesets in a local packetfilter are recommended. โš ๏ธ
  • server type info โ€” Defines the DHCP server to be used. The following types are supported:
    • server ip address [interface] โ€” address is a dotted IP-address and the optional interface the name of an interface. Please note that mixing declarations without an interface parameter and such ones with this parameter will fail. ๐Ÿ’€
    • server bcast interface โ€” the DHCP server with be assumed at interface interface and contacted with broadcast messages. ๐Ÿ“ข
  • suboption interface code value โ€” sets a relay-agent option. The following values for code are supported:
    • suboption interface 2 agent-id โ€” Sets the agent remote id; this is the same as "name interface agent-id". ๐Ÿ”
    • suboption interface 5 ip โ€” Set the RFC3527 link selection. ๐Ÿ”—
    • suboption interface 11 ip โ€” Set the RFC5107 server identifier.. (yes, two periods, she's got flair) ๐Ÿ’…
  • compathack type hack โ€” Sometimes, new versions of dhcp-fwd will contain changes/fixes which might break existing installations. To restore old behavior, compatibility hacks can be activated. These hacks are specified by the hack integer parameter. See the NEWS file for changes are their corresponding hack value. ๐Ÿ•ฐ๏ธ

For a sample configuration file see the contrib/dhcp-fwd.conf template in the source-tarball. ๐ŸŽ


๐ŸŒˆ VARIABLE EXPANSION ๐ŸŒˆ

It is possible to use $VAR style variable expansion for path, file and interface names, and for ip addresses. Value of $VAR will be taken from the corresponding environment variable which must be defined. Quoting of leading `$ยด characters is possible by prepending a single backslash. โœจ

Examples:

pidfile $PIDFILE
if $IFACE t t t
ip $IFACE $IP

๐Ÿ’€ BUGS ๐Ÿ’€

The ports set up by the ports configuration option are used for binding sockets only. The default DHCP port numbers (67 + 68) appear in the UDP headers of the relayed DHCP responses. so yeah, heads up bestie, the ports don't do what your brain might assume. ๐Ÿ˜ญ


๐ŸŽ€ FILES ๐ŸŽ€

  • /etc/dhcp-fwd.conf โ€” configuration file ๐Ÿ“„
  • /usr/bin/dhcp-fwd โ€” executable ๐Ÿš€

๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹

RFC 2131, 2132, 3046 ๐Ÿ“š


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Enrico Scholz <enrico.scholz@ensc.de> โ€” thank you for your service king ๐Ÿซก


and that's the whole page, bestie!! this was dhcp-forwarder 0.6, dated June 17 2004 โ€” an absolute classic, we stan a vintage queen. go forth and forward those DHCP messages responsibly. mwah ๐Ÿ’–โœจ๐ŸŒธ

๐Ÿ“ฆ where this page comes from