---
title: "solaris 网络设置 "
author: "suncxy"
date: "2007-01-12T14:05:00Z"
tags: []
slug: "solaris"
draft: false
lastmod: "2007-01-12T14:05:00Z"
id: 46652
url: "https://suncxy.iteye.com/blog/46652"
---

IP 为：192.168.0.72  
子网掩码：255.255.255.0  
网关：192.168.0.254  
首选DNS：10.27.1.30  
备选DNS：202.102.24.35  
配置过程如下：  
i /etc/hostname.iprb0  
输入：  
nspsx86 （注：主机名）  
(注：根据不同的网卡，hostname.xxx 文件的后缀xxx不同，如果网卡装上的话都应该有这个文件)

i /etc/hosts  
输入：  
[127.0.0.1](http://127.0.0.1/) localhost  
[192.168.0.72](http://192.168.0.72/) nspsx86 loghost （注：IP地址 主机名）

i /etc/defaultrouter  
输入：  
[192.168.0.254](http://192.168.0.254/) (注：网关地址)  
（注：若etc目录下无defaultrouter文件&lt;wbr&gt;&lt;/wbr&gt;，则自己在该目录下创建）

i /etc/nsswitch.conf  
输入：  
hosts: files dns （注：原先为hosts: files，改成hosts: files dns）

i /etc/resol.conf （注：若无此文件，请创建）  
输入：  
domain [nspsx86.domain.com](http://nspsx86.domain.com/)  
nameserer [10.27.1.30](http://10.27.1.30/) (注：首选DNS)  
nameserer [202.102.24.35](http://202.102.24.35/) (注：备选DNS)

重启就可以上因特网了。

另外一种方法：  
不用 /etc/defaultrouter 文件（可删除），其他文件照上面配置，然后执行命令：  
route add default [192.168.0.254](http://192.168.0.254/) 即可。  
不过这种方法重启后就失效了，若要重启后可用，执行如下操作：  
在/etc/rc2.d下面创建一个大写s开头的文件（如&lt;wbr&gt;&lt;/wbr&gt;：Saddrouter）  
i /ec/rc2.d/Saddrouter  
输入：  
route add default [192.168.0.254](http://192.168.0.254/)  
执行：chmod +x Saddrouter，重启就可以了。