mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-16 14:03:00 +02:00
Initial commit for static routing.
Add script that initializes the routing table and is supposed to set the routes.
This commit is contained in:
39
src/initscripts/init.d/static-routes
Normal file
39
src/initscripts/init.d/static-routes
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /etc/sysconfig/rc
|
||||
. ${rc_functions}
|
||||
|
||||
|
||||
function init_table() {
|
||||
# Check if table does already exist. If not we add it.
|
||||
if (ip rule | grep -qeE static >/dev/null 2>&1); then
|
||||
return
|
||||
fi
|
||||
|
||||
ip rule add table static
|
||||
}
|
||||
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
boot_mesg "Adding static routes..."
|
||||
|
||||
# First, initialize the table
|
||||
init_table
|
||||
|
||||
### ADD ALL ROUTES
|
||||
|
||||
evaluate_retval
|
||||
;;
|
||||
|
||||
stop)
|
||||
boot_mesg "Removing static routes..."
|
||||
ip route flush table static >/dev/null 2>&1
|
||||
evaluate_retval
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: ${0} {start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user