Skip to main content

How to add Static route permanent in Solaris?

Route for Linux was originally written by Fred N. van Kempen, and then modified by Johannes Stille and Linus Torvalds for pl15. Alan Cox added the mss and window options for Linux 1.1.22. irtt support and merged with netstat from Bernd Eckenfels.

Route manipulates the kernel's IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig(8) program.

To add a Static Route in Solaris you need use route command this will manipulates the Kernel's IP Routing Tables.
If you reboot the server the dynamic route will be lost to avoid this happening in future just create a script to start it in one of the /etc/rcX.d directories such as

/etc/rc2.d or /etc/rc3.d something like S99route.

Method (1)
Syntax:
root@techgyaan:~# route add [net|host] netmask [GatewayAddr|-interface ]

Example:

root@techgyaan:~# route add -net 192.56.76.0 netmask 255.255.255.0 192.56.76.1
or
root@techgyaan:~# route add -net 192.56.76.0/24 192.56.76.1

to check the route

root@techgyaan:~# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags Mss Window irtt Iface
192.56.76.0 192.56.76.1 255.255.255.0 U 1 273 hme0
169.254.0.0 0.0.0.0 255.255.0.0 U 1 0 hme0


To make this entires permanent next time you reboot your machine "route add" under /etc/rc2.d or /etc/rc2.d S99route startup file.

root@techgyaan:~# vi /etc/rc2.d/S99route
#/bin/sh
route add -net 192.56.76.0 netmask 255.255.255.0 192.56.76.1


save & close the file

set the file to executable for owner, set owner as root. Now when you reboot, your route gets added

root@techgyaan:~# chmod 744 /etc/rc2.d/S99route

Premission
### String Owner's Permissions Group's Permissions Other'sPermissions
744 -rwxr--r-- Read,Write & Execute Read Read

Method (2)

This method is just smiple.
Just create file under /etc/defaultrouter

/etc/defaultrouter is configuration file containing the hostnames or IP adresses of one or more default routers.

to check present routing table.

Syntax:
root@techgyaan:~# netstat -rn (netstat - show network status)

Create file /etc/defaultrouter
root@techgyaan:~# touch /etc/defaultrouter
root@techgyaan:~# vi /etc/defaultrouter
192.56.76.1


Save & close the file.

Fore more details on above commands refer man:
man route
man netstat
man defaultrouter
man chmod

Feedbacks: We appreciate feedbacks and suggestions about our website info@techgyaan.org

Your Ad Here

Comments

Popular posts from this blog

Download of the Day!

Amarok 2.0.2 has released Amarok is an open source alternative music player for iTunes. Amarok supports Linux, Unix, MacOSX and windows Operating system. It is smiliar to iTunes just drag & drop the songs to play list. Amarok also lets you listen to internet radio ( mp3 streaming ) including music from last.fm . Features Automatic cover Lyrics download Dynamic playlists Visualizations and Podcasting. These are only some of the great new features of Amarok 2. Give it a try! Download here An least but not last - Amarok will also synchronize your music to your iPod. For the more technical users a scripting interface allows you to extend the functionality of Amarok. Print Page Feedbacks: We appreciate feedbacks and suggestions about our website info@techgyaan.org

How to install WebLogic 8 on Solaris 10

Lets start the installation Login to solaris box use sudo command to install the application. $ ./server814_solaris32.bin Extracting 0%……………………………………………………………………………………….100% Unable to instantiate GUI, defaulting to console mode. Welcome: ——– ————— This installer will guide you through the installation of WebLogic Server 8.1 SP4. Type “ Next” or enter to proceed to thenext prompt. If you want to change data entered previously, type “Previous”. You may quit the installer at any time by typing “ Exit”. Enter [Exit][Next]> BEA Systems License Agreement: —————————— BEA SYSTEMS, INC. SOFTWARE LICENSE AGREEMENT USE OF SOFTWARE ORDERED FROM BEA SYSTEMS, INC. (”BEA”) IS PROVIDED ONLY UNDER LICENSE FROM BEA. PLEASE READ THE FOLLOWING LICENSE CAREFULLY AND INDICATE YOUR ACCEPTANCE BY CLICKING THE ACCEPTANCE BOX. CERTAIN CAPITALIZED TERMS ARE DEFINED IN SECTION 11. 1. LICENSE TERMS a. Workshop Free Use. The terms of this Section 1(a) are applicable to you if you h...

Sysadmin Daily Commands

Some of these commands are used by unix/linux administrator in his/her day-to-day activities  cat to concatenate files to standard output chgrp to change file group ownership chmod to change file access permissions chown to change file owner and group cp to copy files and directories date to print or set the system data and time dd to convert and copy a file df to report filesystem disk space usage dmesg to print or control the kernel message buffer echo to display a line of text hostname to show or set the system's host name kill to send signals to processes ln to make links between files login to begin a session on the system ls to list directory contents mkdir to make directories mknod to make block or character special files more to page through text mount to mount a filesystem mv to move/rename files ps to report process status pwd to print na...