设置服务

要设置哪些服务是开放的,以及对哪些对象(名称或 IP 地址)开放,请编辑 /etc/hosts.allow 和 /etc/hosts.deny 文件。

通过添加以下行:ALL: ALL在 /etc/hosts.deny 文件中,我们将不允许来自所有 IP 地址的所有端口的连接(除了那些通过下面的 /etc/hosts.allow 允许的连接)。ALL: PARANOID如果传入流中找到的名称与通过 IP 地址和 DNS 找到的名称不匹配,将拒绝访问。

# /etc/hosts.deny: list of hosts that are _not_
# allowed to access the system. See hosts_access(5)
# and /usr/doc/net/portmapper.txt
#
# Example:
#  ALL: some.host.name, .some.domain
#  ALL EXCEPT in.fingerd: other.host.name, .other.domain
#
# The ALL: PARANOID wild card matches any host
# whose name does not match its address. ALL: ALL
在以下文件中,你需要指定防火墙上的哪些端口将对 Internet 或本地网络上的哪些 IP 地址开放。 在下面的示例中,我允许本地网络中的每个人都使用 TELNET 登录,但只允许本地 LAN 中的一台 PC 使用 TELNET 和 FTP。 请小心开放哪些内容以及对谁开放。
# /etc/hosts.allow: list of hosts that are
# allowed to access the system. See
# hosts_access(5) and /usr/doc/net/portmapper.txt
#
# Example:
#   ALL: LOCAL @some_netgroup
#   ALL: .foobar.edu EXCEPT terminalserver.foobar.edu
#
# Allow telnet connections from some of the local
# PCs in our LAN
telnet: 192.168.0.
#
# Allow ALL connection types from one of our PCs
# in our LAN
ALL: 192.168.0.10
© . All rights reserved.