The Default Gateway or the Default Router is the IP address (IPv4) to which all the traffic to any target destination(s) which does not have a route in the Routing Table of the server will be forwarded.
This Default Gateway is maintained in the file
/etc/defaultrouter [IPv4 only]
bash-3.00# cat /etc/defaultrouter
This IP Address should be in the same network or the subnet as that of the server itself.
If you wish to add or edit the Default Gateway or the Default Router in Sun Solaris, edit /etc/defaultrouter file and update the IP Address. One entry per line for one or more default gateways (very unlikely to have multiple default gateways).
This file is read at the boot time and hence the server needs to be rebooted for the changes to take effect.
Instead of rebooting the server, update the Kernel IP Routing table first by deleting the existing Default Gateway or Default Router (if any) and then adding the new IP address.
To view the existing Kernel IP Routing table,
# netstat -rn
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
——————– ——————– —– —– ———- ———
default 126.96.36.199 UG 1 5
188.8.131.52 100.100.100.102 U 1 1 bge1
184.108.40.206 220.127.116.11 U 1 3 bge0
18.104.22.168 22.214.171.124 U 1 0 bge0
127.0.0.1 127.0.0.1 UH 38 3397 lo0
Now, remove the existing default gateway;
# route delete default 126.96.36.199
Add the new Default Gateway using:
# route add default 192.168.1.1