博客程序转换完成, 欢迎大家落户!

[原创] Solaris的网络设置

上一篇 / 下一篇  2005-12-11 22:22:45

作者: 5life
状态:鼓捣工作站中

最近买了台旧的Ultra1, 只有一个Solaris 5.5,只好自己装其他的软件。要安装就要上网呀,所以就鼓捣了网络设置。

试了好几回。以下是我修改过的文件:

1. /etc/hostname.interface
Interface是网卡的型号,有le、hme等。Le是十兆网卡,hme为百兆网卡等等。后面跟一个数字,第一个十兆网卡为le0,第二个为le1;第二个百兆网卡为hme0,第二个为hme1等等。
文件的内容是这块网卡的名字
我的设置:
#more /etc/hostname.le0
u1lic2

2. /etc/hosts文件
系统名与IP地址的映射
与/etc/hostname.le0 协同工作,配置本机网卡地址
# more /etc/hosts
127.0.0.1 localhost
192.168.1.110 u1lic2
192.168.1.101 5life

系统名不是机器名,机器名是唯一的,要更改机器名,用命令:hostname。

有了/etc/hostname.interface和/etc/hosts两个文件,系统就知道如何配置网卡了,如第一个百兆网卡的名字是Sunny,其对应的地址是172.18.255.1。

3. /etc/netmasks文件
将网络的IP地址与网络地址联系一起,划分子网
如果是标准网段,则不需要配置

标准网段:
A类网:0-127(127用于本地地址) 掩码:255..0.0.0
B类网:128-191 掩码:255.255.0.0
C类网:192-223 掩码:255.255.255.0
D类网:224-254(用于多址广播)

我的设置:192.168.1.1 255.255.255.0

4. 创建/etc/resolv.conf文件
    一个示例的resolv.conf文件如下:
    nameserver 127.0.0.1
    nameserver 192.1.0.11
    nameserver 192.1.0.10
这里设置所使用的DNS服务器

5. 修改/etc/nsswitch.conf,是客户机能够使用DNS服务
    SUN客户机缺省使用files作为服务器名字的解析,为了使用DNS名称解析服务器,必须在/etc/nsswitch.conf指明使用DNS服务。
    #
    # /etc/nsswitch.files:
    #
    # An example file that could be copied over to /etc/nsswitch.conf; it
    # does not use any naming service.
    #
    # "hosts:" and "services:" in this file are used only if the
    # /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.

    passwd: files
    group: files
    hosts: files dns
    networks: files dns
    protocols: files
    rpc: files
    ethers: files
    netmasks: files
    bootparams: files
    publickey: files
    # At present there isn't a 'files' backend for netgroup; the system will
    # figure it out pretty quickly, and won't use netgroups at all.
    netgroup: files
    automount: files
    aliases: files
    services: files
    sendmailvars: files
    如上例,只要在hosts一项添加dns项就可以

6. /etc/defaultrouter文件中设置默认的路由
  192.168.1.1

TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

Open Toolbar