Find knowledge base article(s) by searching for keywords in the title e.g. type linux in the search box below
Find knowledge base article(s) by browsing the subject categories of articles
Technology quick references, cheatsheets, user manuals etc.
Shop Online through ShopifyLite
Tutorials on various IT applications.
Search Title    (UL:0 |SS:f)

Software >> OS >> Unix >> Linux >> RHEL >> 7 >> How to set persistent IP static route

The script /etc/init.d/network will check for /etc/sysconfig/static-routes and execute if found.

Add the static routes into /etc/sysconfig/static-routes

 

/etc/init.d/network

...

    # Add non interface-specific static-routes.
    if [ -f /etc/sysconfig/static-routes ]; then
        if [ -x /sbin/route ]; then
            grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do
                /sbin/route add -$args
            done
        else
            net_log $"Legacy static-route support not available: /sbin/route not found"
        fi
    fi

...

 add your custom persistent route accordingly into the file /etc/sysconfig/static-routes

 

example

any net 10.0.0.0 netmask 255.0.0.0 gw 10.1.1.254 dev eth0

[ © 2008-2021 myfaqbase.com - A property of WPDC Consulting ]