ROUTE.CONF(5)

πŸ“¦ version 11.0, in nixpkgs unstable

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 a route add - command, and during shutdown they're passed behind a route 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 β€” the route.conf file resides in /etc.
  • /etc/rc.d/staticroute β€” the rc.d(8) script that parses route.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