Pages

Wednesday, February 26, 2014

Set the Default Route on Solaris

Every once in awhile you need to change the default route for a server in Solaris. Follow the steps below are my notes on how to do that.




Run the route add command
root@earth> route add default 10.10.0.1

To make the default route persistent, you will need to update or create the /etc/defaultrouter file.

root@earth> echo 10.10.0.1   >  /etc/defaultrouter


Solaris Zones
If you need to do this on a Solaris zone then it depends how the zone has it's network interfaces configured. If the interfaces are configure as IP-Exclusive then the zone is configure the same way are the global zone. The same way a show above, so run the commands above for the zone. If the zone shares there interfaces with the global zone then you have to use the zonecfg command.

Run the command below to find out if the zone uses ip-exclusive or shared interfaces.
root@earth> svcadm list -cv
ID NAME STATUS PATH BRAND IP
global running / native shared
moon running /export/zones/moon native shared
The example above shows the zone moon as having shared interfaces.

Follow the steps below to change the default route on a zone with shared interfaces.
root@earth> zonecfg -z moon
zonecfg:moon> select net address=10.10.0.20
zonecfg:moon:net> set defrouter=10.10.0.1
zonecfg:moon:net> end
zonecfg:moon> verify
zonecfg:moon> commit
zonecfg:moon> exit
You will need to restart the zone to get the new default route.

If you need to also change your ip address then refer to my other post.
How-to change the IP address on a Solaris server

Links to other sites with similar info
Set the Default Route on Solaris
Solaris: How do I setup a default static route / static router IP address?


I hope this helps. Please leave a comment below if you have comments or questions.

No comments:

Post a Comment