操作系统  办公  实用知识  设计  开发  WEB开发  移动开发  数据库  软件工程  网管  安全  管理  信息化  答疑  渠道 

solaris常用网络文件配置(2)

2007-3-13 网友评论 0 条 点击进入论坛

路由和网关

1. /etc/defaulrouter文件

配置缺省网关

防止不必要的路由进程

适用于只有一个路由器通向其它网段

单一路由占用较小的路由表资源

该文件保存了缺省路由得信息。系统安装时并没有该文件,是用户自己创建的。文件内容是缺省路由的地址。

#cat /etc/defaultrouter

172.16.255.254

优点:

占用资源少,只有一条路由条目。

2. /etc/gateways文件

路由表文件

net gateway metric

dest. net 目标网段

router 下一跳路由器的地址

count 跳数

3. route命令

route add|delete [host|net] destination [gateway ]

Add a route

#route add net 128.50.3.0 192.168.1.1 1

Delete a route

#route delete net 128.50.2.0 192.168.12.2

4. 查看路由表

# netstat -r

Routing Table:

Destination Gateway Flags Ref Use Interface

----------- ---------- ----- --- --- ---------

localhost localhost UH 0 2272 lo0

202.96.0.0 192.168.12.1 U 3 562 le0

10.103.0.0 192.168.12.2 U 3 562 le0

#

Destination 目标网络或主机

Gateway 转发数据包的主机

Flags 这条路由的状态,这个参数有这样几个选项:

U 端口处于激活状态(up)

H 目标是个主机,而不是网段

Ref 同一个网络接口地址拥有的路由条目数量

Use 通过这条路由的包数量,对于localhost来说,这个数字代表 所有接收的包数量

Interface 路由的网络接口

DNS客户端的设置

1. /etc/resolv.conf文件

记录DNS服务器的地址和域名

关键字: domainname

nameserver

# more /etc/resolv.conf

nameserver 172.16.255.3

domainname sunrise.com.cn

2. /etc/nsswitch.conf文件

记录主机名的搜索顺序等信息

# more /etc/nsswitch.conf
#
# /etc/nsswitch.dns:
#
# An example file that could be copied over to /etc/nsswitch.conf; it uses
# DNS for hosts lookups, otherwise it does not use any other 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
# You must also set up the /etc/resolv.conf file for DNS name
# server lookup. See resolv.conf(4).
hosts: files dns
ipnodes: files


将这个文件的hosts记录配置成hosts: files dns

3. nslookup命令

用于查询DNS服务器

用于验证客户端的设置

用于下载DNS数据库

# nslookup

Default Server: ns.zjhzptt.net.cn

Address: 202.96.96.68

> www.sun.com

Server: ns.zjhzptt.net.cn

Address: 202.96.96.68

Non-authoritative answer:

Name: www.sun.com

Address: 192.18.97.241

启动时,nslookup缺省地以本地服务器为目标。响应中包括目标服务器的名字和地址。

>是提示符,这意味着可以开始发送名字服务询问或配置。

已有 0 位对此文章感兴趣的网友发布了看法    
我来评两句 用户名: 密码:
  匿名发表
今日推荐
技术文库(共有 45972 篇文章)
操作系统
办公软件
实用知识
网络管理
软件开发
WEB开发
软件工程
数据库
设计在线
信息安全
行业信息化
管理信息化
移动开发
重点推荐
电子杂志订阅
点击电子杂志名称查看样刊
输入E-mail地址即可订阅
E-mail