Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1379932
  • 博文数量: 247
  • 博客积分: 10147
  • 博客等级: 上将
  • 技术积分: 2776
  • 用 户 组: 普通用户
  • 注册时间: 2008-01-24 15:18
文章分类

全部博文(247)

文章存档

2013年(11)

2012年(3)

2011年(20)

2010年(35)

2009年(91)

2008年(87)

我的朋友

分类:

2009-08-26 15:15:21

一、路由和网关
1)通过文件增加
文件:/etc/gateways
格式:; ; ; metric ;
描述:添加路由表记录
     dest. net                目标网段
     gateway                下一跳路由器的地址
     count                跳数

2)route命令
命令格式:route add|delete [host|net] destination [gateway
举例:
Add a route
        #route add  -net 10.50.3.0 10.168.1.1 1
Delete a route
        #route delete -net  10.50.2.0 10.168.1.2
3)缺省路由
文件:/etc/defaultrouter
描述:防止不必要的路由进程
适用于只有一个路由器通向其它网段
单一路由占用较小的路由表资源
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

                二、网络地址和掩码
1)文件:/etc/hostname.interface
接口描述:
网卡型号
十兆网卡:le
百兆网卡:hme
2)文件:/etc/hosts
功能描述:
系统名与IP地址的映射
与/etc/hostname.interface 协同工作,配置本机网卡地址
举例:
# more /etc/hosts
127.0.0.1        localhost        loghost
10.12.255.1        xiaojg
10.13.255.1        xiaojg
3)文件:/etc/netmasks
功能描述:
将网络的IP地址与网络地址联系一起,划分子网
如果是标准网段,则不需要配置
4)命令:ifconfig
举例:
检测网络端口状态
        #ifconfig -a
配置网络端口地址
        #ifconfig le0 10.16.25.1 netmask 255.255.255.0
配置网络端口状态
        #ifconfig le0 up/down
配置网络端口是否可用
        #ifconfig le0 plumb/unplumb
5)文件:/etc/services
功能描述:
网络服务协议的端口号
网络协议的服务类型
举例:
#more /etc/inet/services
ftp-data        20/tcp
ftp        21/tcp
telnet        23/tcp
smtp        25/tcp        mail
sunrpc        111/udp        rpcbind
sunrpc        111/tcp        rpcbind
6)文件:/etc/inetd.conf
功能:管理系统的各种服务
格式:
;  ;  ;  ;  ;  ;  ;
举例:
# cat /etc/inet/inetd.conf
ftp        stream        tcp        nowait        root        /usr/sbin/in.ftpd        in.ftpd
telnet        stream        tcp        nowait        root        /usr/sbin/in.telnetd        in.telnetd
login        stream        tcp        nowait        root        /usr/sbin/in.rlogind        in.rlogind
talk        dgram        udp        wait        root        /usr/sbin/in.talkd        in.talkd
 
 
三、DNS
1)DNS客户端的配置
文件:etc/resolv.conf
举例:
# more /etc/resolv.conf
nameserver        192.16.25.3
domainname        xiaojg.com.cn
文件:/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:     xiaojg
group:      xiaojg
# You must also set up the /etc/resolv.conf file for DNS name
# server lookup.  See resolv.conf(4).
hosts:      xiaojg dns
ipnodes:    xiaojg

命令:nslookup
描述:
用于查询DNS服务器
用于验证客户端的设置
用于下载DNS数据库
举例:
# nslookup
Default Server:  ns.zjhzptt.net.cn
Address:  202.96.96.68

>;
Server:  ns.shptt.net.cn
Address:  202.96.96.68

Non-authoritative answer:
Name:   
Address:  192.18.97.241
阅读(1135) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~