How to Change The Default Route or Gateway on Solaris

Changing the default gateway on a Solaris server is a straightforward process that can be accomplished without causing any network interruptions. By editing the /etc/defaultrouter file and using the ‘route delete default’ and ‘route add default’ commands, you can change the default gateway immediately and ensure that the changes persist after a system reboot.

In this guide, we will walk you through the process of changing the default gateway on a Solaris server. This configuration change can be implemented immediately without requiring a system reboot, and it will persist after the next reboot. This approach is highly recommended as it prevents any network interruptions.

Step-by-Step Guide to Changing the Default Gateway on Solaris

Step 1: Edit /etc/defaultrouter

The first step involves editing the /etc/defaultrouter file. The changes made to this file will take effect after the next system reboot.

[root@SolarisServer ~]# vi /etc/defaultrouter
192.168.2.1

You will need to replace the existing IP address with the new IP address of your preferred gateway and save the changes.

See also  How to Drop or Block Incoming/Attackers IP Address Using null route

Step 2: Update the Default Route

The next step is to run specific commands that will delete the existing default route and add a new one. This will implement the configuration changes immediately. For instance, if the existing gateway is 192.168.1.1 and you want to change it to 172.19.1.1, you would use the following commands:

[root@SolarisServer ~]# route delete default 172.19.1.1
[root@SolarisServer ~]# route add default 172.19.1.1

Commands Mentioned

  • vi /etc/defaultrouter – This command is used to edit the /etc/defaultrouter file where you can set the IP address of your preferred gateway.
  • route delete default [ip_address] – This command is used to delete the existing default route.
  • route add default [ip_address] – This command is used to add a new default route.

Conclusion

In this guide, we will walk you through the process of changing the default gateway on a Solaris server. This configuration change can be implemented immediately without requiring a system reboot, and it will persist after the next reboot. This approach is highly recommended as it prevents any network interruptions.

See also  How to Shut Down or Reboot Solaris Server

Frequently Asked Questions

  1. What is the purpose of the /etc/defaultrouter file in Solaris?

    The /etc/defaultrouter file in Solaris is used to specify the IP address of the default gateway. This file is read at system startup, and the IP address found in this file is set as the default gateway for the system.

  2. What does the ‘route delete default’ command do?

    The ‘route delete default’ command is used to remove the existing default route from the system. This is typically done when you want to change the default gateway to a new IP address.

  3. What does the ‘route add default’ command do?

    The ‘route add default’ command is used to add a new default route to the system. This command is typically used after the ‘route delete default’ command to set a new default gateway.

  4. Do I need to reboot the Solaris server for the changes to take effect?

    No, you do not need to reboot the server. The changes will take effect immediately after running the ‘route delete default’ and ‘route add default’ commands. However, the changes made to the /etc/defaultrouter file will only apply after the next system reboot.

  5. Can I use these commands on other Unix-like systems?

    Yes, the ‘route add default’ and ‘route delete default’ commands are standard Unix commands and can be used on other Unix-like systems. However, the location and usage of the defaultrouter file may vary depending on the specific Unix-like system.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *