Wednesday, August 19, 2009

Change default gateway in Sun Solaris 10

Default Gateway or the Default Router is the IP address (IPv4)

Default Gateway is maintained in the file /etc/defaultrouter
This file should contain an entry for each router directly connected to the network. The entry should be the name for the network interface that functions as a router between networks.

How to add or Edit

- If you wish to add or edit the default gateway ,edit /etc/defaultrouter file and update the IP Address.
- Use the command to manually configure the routes in the routing table.
# route delete default 192.1.1.1 <--remove the dexisting default gateway
# route add default 192.1.1.1 <--Add new default gateway


View the existing Kernel IP Routing table;
# netstat -nr
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
——————– ——————– —– —– ———- ———
192.168.0.0 192.1.1.1 U 1 115 eth0
default 192.1.1.1 UG 1 25
127.0.0.1 127.0.0.1 UH 5 2 lo0



After changing default router restart network service;
#svcadm restart network/physical


For a detailed Man Page for /etc/defaultrouter click here

No comments: