Debian系统配置文件说明

来源:岁月联盟 编辑:zhuzhu 时间:2008-10-23
Debian系统配置文件说明内容简介:Debian系统配置文件说明 ################################ # # /etc/network/interfaces # ################################ 网络接口参数配置文件,下面是一个配置示例,它在一个网络接口中配置了两个静态IP地址: # /etc Debian系统配置文件说明
################################
#
# /etc/network/interfaces
#
################################
网络接口参数配置文件,下面是一个配置示例,它在一个网络接口中配置了两个静态IP地址:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
auto eth0:0
iface eth0:0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
下面是一个从DHCP服务器自动获得IP地址的示例:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
auto eth0
iface eth0 inet dhcp

################################
#
# /etc/resolv.conf
#
################################
该文件是DNS域名解析的配置文件,它的格式很简单,每行以一个关键字开头,后接配置参数。resolv.conf的关键字主要有四个,分别是:
nameserver #定义DNS服务器的IP地址
domain #定义本地域名
search #定义域名的搜索列表
sortlist #对返回的域名进行排序
/etc/resolv.conf的一个示例:
domain ringkee.com
search
www.ringkee.com
ringkee.com
nameserver 202.96.128.86
nameserver 202.96.128.166
最主要是nameserver关键字,如果没指定nameserver就找不到DNS服务器,其它关键字是可选的。
################################
#
# /etc/host.conf
#
################################
当系统中同时存在DNS域名解析和/etc/hosts主机表机制时,由该/etc/host.conf确定主机名解释顺序。示例:
order hosts,bind #名称解释顺序
multi on #允许主机拥有多个IP地址
nospoof on #禁止IP地址欺骗
order是关键字,定义先用本机hosts主机表进行名称解释,如果不能解释,再搜索bind名称服务器(DNS)。
################################
#
# /etc/hostname
#
################################
该文件只有一行,记录着本机的主机名。如:
debian

################################
#
# /etc/services
#
################################
Internet网络服务文件,记录网络服务名和它们对应使用的端口号及协议。文件中的每一行对应一种服务,它由4个字段组成,中间用TAB或空格分隔,分别表示“服务名称”、“使用端口”、“协议名称”以及“别名”。下面是这个文件的节选内容。
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
netstat 15/tcp
qotd 17/tcp quote
msp 18/tcp # message send protocol
msp 18/udp
chargen 19/tcp ttytst source
chargen 19/udp ttytst source
ftp-data 20/tcp
ftp 21/tcp
fsp 21/udp fspd
ssh 22/tcp # SSH Remote Login Protocol
ssh 22/udp
telnet 23/tcp
smtp 25/tcp mail
time 37/tcp timserver
一般情况下,不要修改该文件的内容,因为这些设置都是Internet标准的设置。一旦修改,可能会造成系统冲突,使用户无法正常访问资源。
Linux系统的端口号的范围为0--65535,不同范围有不同的意义。
0 不使用
1--1023 系统保留,只能由root用户使用
1024---4999 由客户端程序自由分配
5000---65535 由服务器端程序自由分配

########################################
#
# /etc/hosts.allow & /etc/hosts.deny
#
########################################
这两个文件是tcpd服务器的配置文件,tcpd服务器可以控制外部IP对本机服务的访问。这两个配置文件的格式如下:
#服务进程名:主机列表:当规则匹配时可选的命令操作
server_name:hosts-list[:command]
/etc/hosts.allow控制可以访问本机的IP地址,/etc/hosts.deny控制禁止访问本机的IP。如果两个文件的配置有冲突,以/etc/hosts.deny为准。下面是一个/etc/hosts.allow的示例:
ALL:127.0.0.1 #允许本机访问本机所有服务进程
smbd:192.168.0.0/255.255.255.0 #允许192.168.0.网段的IP访问smbd服务
ALL关键字匹配所有情况,EXCEPT匹配除了某些项之外的情况,PARANOID匹配你想控制的IP地址和它的域名不匹配时(域名伪装)的情况。

################################
#
# /etc/securetty
#
################################
该文件可控制根用户登录的设备,该文件里记录的是可以作为根用户登录的设备名,如tty1、tty2等。用户是不能从不存在于该文件里的设备登录为根用户的。这种情况用户只能以普通用户登录进来,再用su命令转为根用户。/etc/securetty文件的格式如下:
# /etc/securetty: list of terminals on which root is allowed to login.
# See securetty(5) and login(1).
console
# for people with serial port consoles
ttyS0
# for devfs
tts/0
# Standard consoles
tty1
tty2
tty3
...
如果/etc/securetty是一个空文件,则根用户就不能从任务的设备登录系统。只能以普通用户登录,再用su命令转成根用户。如果/etc/securetty文件不存在,那么根用户可以从任何地方登录。这样会引发安全问题,所以/etc/securetty文件在系统中是一定要存在的。