solaris靜態(tài)路由的三種配置方法
怎樣才能進(jìn)行有效的solaris靜態(tài)路由?在配置solaris靜態(tài)路由過程中應(yīng)該特別注意些什么呢?下面我們就針對(duì)這些問題,進(jìn)行綜合的講解。我們都知道在solaris中添加默認(rèn)路由只需編輯vi/etc/defaultrouter這個(gè)文件,內(nèi)容就是你的默認(rèn)網(wǎng)關(guān)。
而添加solaris靜態(tài)路由可以使用命令route,具體參數(shù)可以參閱route(1)的manual。下面僅僅是簡單的添加和刪除solaris靜態(tài)路由的例子,執(zhí)行之后,路由表立即生效,可以使用命令#netstat-r來查看但是,通過route的命令,系統(tǒng)重起以后,就會(huì)失效。也就是說,在重起系統(tǒng)之后,我需要重新運(yùn)行routeadd這條命令。為了省去這個(gè)麻煩,我們可以編制腳本,令系統(tǒng)已啟動(dòng)就自動(dòng)運(yùn)行這個(gè)命令,這也算是下面solution的思想所在。
solaris靜態(tài)路由solutionA:
在/etc/init.d下面編輯文件solutionA
內(nèi)容就是routeadd-netdestinationnext-hopmetric
然后再chmod0777/etc/init.d/solutionA使這個(gè)文件為可執(zhí)行文件。
然后在/etc/init.d/下lnsolutionA/etc/rc2.d/S100solutionA令系統(tǒng)啟動(dòng)以后也啟動(dòng)solutionA
solaris靜態(tài)路由solutionB:
在/etc/rc2.d下面viS100solutionB
內(nèi)容就是routeadd-netdestinationnext-hopmetric
比較而言,solutionA較好些
solaris靜態(tài)路由solutionC:
編輯/etc/gateways文件即可
文件格式
netdest.netgatewayroutermetriccnt[passive][active]
例如:
net128.50.0.0gatewaysword-rmetric1passive
如果只是主機(jī)則用
host128.50.0.0gatewaysword-rmetric1passive
默認(rèn)靜態(tài)路由的添加辦法
編輯/etc/defaultrouter內(nèi)容默認(rèn)網(wǎng)關(guān)的ip地址即可。