免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 839 | 回复: 0
打印 上一主题 下一主题

常用的网络配置文件 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-04-02 14:59 |只看该作者 |倒序浏览

                                Linux 网络配置文件解析
1. /etc/network/interfaces (interfaces(5))
该文件是本地网络接口的配置文件
通常,如果要配置以太网的dhcp方式设置网络接口, 其内容如下:
auto eth0
iface eth0 inet dhcp
其中 auto 表示开机自动激活eth0, iface那一句的作用是设置eth0为ipv4,dhcp方式获取IP
如果要配置成static方式, 则写入如下内容:
auto eth0
iface eth0 inet static
address 192.168.0.117
gateway 192.168.0.1
netmask 255.255.255.0
当然,该完配置后可以用/etc/init.d/networking restart 来重启网络是配置生效
2. /etc/resolv.conf (resolv.conf(5))
resolver configuration file,该文件是由域名解析器(resolver,一个根据主机名解析IP
地址的库)使用的配置文件.
内容通常如下:
nameserver 202.99.96.68
nameserver表示解析域名时使用该地址指定的主机为域名服务器。其中域名服务器是按照文
件中出现的顺序来查询的。
3. /etc/host.conf (host.conf(5))
resolver configuration file, 该文件指定如何解析主机名。Linux通过解析器库来获得主
机名对应的IP地址.通常内容如下:
# The "order" line is only used by old versions of the C library.
order hosts,bind
multi on
“order bind,hosts”指定主机名查询顺序,这里规定先查询“/etc/hosts”文件,然后再使用
DNS来解析域名
“multi on” “/etc/hosts”文件中指定的主机可以有多个地址, 这样resolver在返回对应的
host(在/etc/hosts中)对应的all addresses,而不仅仅是the first one.
4. /etc/hosts (hosts(5))
The static table lookup for host names, 用来静态查询的主机名到ip地址的匹配.另一
种查询方式是用DHCP
127.0.0.1    localhost
127.0.1.1    ulaptop
5. /etc/networks (networks(5))
network name information, 该文件里面是网络名与网络IP地址的对应. 通过路由命令使用,允
许使用网络名称。实例如下:
# symbolic names for networks, see networks(5) for more information
link-local 169.254.0.0
6. /etc/nsswitch.conf (nsswitch.conf(5))
System Databases and Name Service Switch configuration file, 该文件是由sun公司开
发并用于管理系统中多个配置文件查找的顺序,它比/etc/host.conf文件提供了更多的功能。
/etc/nsswitch.conf中的每一行或者是注释(以#号开头)或者是一个关键字后跟冒号和一系
列要试用的有顺序的方法。每一个关键字是在/etc/目录可以被/etc/nsswitch.conf控制的
/etc文件的名字。
7. /etc/services (services(5))
The Internet network services list, 该文件包含了服务名和端口号、协议之间的映射。
实例内容:
tcpmux        1/tcp                # TCP port service multiplexer
echo        7/tcp
echo        7/udp
discard        9/tcp        sink null
discard        9/udp        sink null
systat        11/tcp        users
daytime        13/tcp
daytime        13/udp
8. /etc/hostname (hostname(1))
该文件包含了系统的主机名称,包括完全的域名,如:
192.168.0.1 host1.domain host1
9. /etc/protocols
the protocols definition file, 列举当前Internet可用的协议。
10. /etc/rpc
rpc program number data base, 包含RPC指令/规则,这些指令/规则可以在NFS调用、远程
文件系统安装等中使用
               
               
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/56406/showart_1888594.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP