The route command is used to manage the network routing tables. Use the –p option to ensure that any changes you make to the network routing tables persist across system reboots.
Check whether a route already exists in the persistent configuration as follows:
# route -p show persistent: route add default 10.153.123.1 -ifp net0
If the route already exists in the persistent configuration, the information in the network routing tables (which is not persistent configuration) might differ from the persistent configuration.
The following example illustrates this point further. In this example, an attempt is made to add a persistent route to net1. However, the command fails because a persistent route already exists for net0, per the previous example's output.
# route -p add default 10.153.123.1 -ifp net1 add net default: gateway 10.153.123.1 add persistent net default: gateway 10.153.123.1: entry exists Warning: persistent route might not be consistent with routing table.
Running the route –p show command again reveals that the persistent route did not change and is still configured for net0, as shown in the following output:
# route -p show persistent: route add default 10.153.123.1 -ifp net0
However, the command did change the routing tables in the kernel to use net1, as shown in the following output:
# netstat -nr Routing Table: IPv4 Destination Gateway Flags Ref Use Interface -------------------- -------------------- ----- ----- ---------- --------- default 10.153.123.1 UG 2 1 net1 10.153.123.0 10.153.123.78 U 3 0 net1 127.0.0.1 127.0.0.1 UH 2 466 lo0 . . .
Therefore, it is always best to delete any existing persistent route configuration prior to adding a new route. See Creating Persistent (Static) Routes in Configuring and Administering Network Components in Oracle Solaris 11.2 for more information.