ROUTE.CONF(5)
okay so you opened ROUTE.CONF(5), bestie β it's a File Formats Manual page, and it's literally the whole vibe for the static routes config file. no cap. π
π NAME π
route.conf β static routes config file
πΈ DESCRIPTION πΈ
The route.conf file gets read by the staticroute rc.d script during system start-up and shutdown, and it's intended for adding and removing static routes. that's the main character energy here. β¨
β¨ FILE FORMAT β¨
okay so the first character of a line lowkey decides everything:
- Lines starting with a hash (
#) are comments and get ignored. bye bestie π - Lines starting with a plus sign (
+) are run during start-up. slay β - Lines starting with a minus sign (
-) are run during system shutdown. iconic π - If a line starts with a
!, the rest of the line gets evaluated as a shell script fragment. shell mode activated π§ - All other lines are passed to
route(8). During start-up, they're passed behind aroute add -command, and during shutdown they're passed behind aroute delete -command.
π«Ά tiny but important: the leading character is doing a lot of work here, so don't sleep on it.
π FILES π
/etc/route.confβ theroute.conffile resides in/etc./etc/rc.d/staticrouteβ therc.d(8)script that parsesroute.conf.
π¦ EXAMPLES π¦
π Example one
In this example, the interface for the desired routing changes is set, the IP address on that interface is determined, and a route is added during startup, or deleted during system shutdown. it's giving βdo it all in one little block.β β¨
# Set interface and determine current IP address for added route.
!ifname=bnx0
!ipaddr=$(/sbin/ifconfig ${ifname} | awk '$1 == "inet" {print $2}')
net 10.10.1 -interface ${ipaddr}
π Example two
In this example, IP forwarding is turned on during start-up, and a static route is added for 192.168.2.0. During system shutdown, the route is removed and IP forwarding is turned off. balanced. symmetrical. obsessed. π
# Turn on/off IP forwarding.
+sysctl -w net.inet.ip.forwarding=1
-sysctl -w net.inet.ip.forwarding=0
net 192.168.2.0 -netmask 255.255.255.0 192.168.150.2
π SEE ALSO π
muah π β this page is from Debian, dated May 1, 2012, and yes bestie, it's ROUTE.CONF(5). periodt. π
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2004 Thomas Klausner
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms