host&host.conf&host.allow&host.deny action in Linux

It can realize emergency response disconnection: prevent the access link of this machine to malicious IP

/etc/host.conf

Configuration information declared for the parsing library

/etc/hostname

Configure hostname (permanent)

/etc/hosts

Configure ip address mapping

/etc/hosts.allow

Configure ip address whitelist

/etc/hosts.deny

Configure ip address blacklist

Analyze the execution sequence flow:

1. host.conf file:

order bind,hosts specifies the query order of the host name, here it is stipulated that the dns resolver is used first, and the hosts file is checked only if the resolution cannot be resolved

multi on Specifies whether the host specified in the "/etc/hosts" file can have multiple addresses. A host with multiple IP addresses is generally called a multi-homed host.

nospoof  on or off, specifies whether the spoofing of the host name is turned on/off

2. host file: the file responsible for the quick resolution of IP addresses and domain names

Format: IP address hostname/domain name

For example: 1.1.1.1  www.baidu.com

3./etc/resolv.conf:

This file is a configuration file used by the domain name resolver (resolver, a library that resolves IP addresses based on host names), and is also a configuration file for DNS domain name resolution.

Example:

domain centoscn.com declares the domain name of the host

search  www.centocn.com www.wgjlb.com       Its multiple parameters indicate the domain name query order

nameserver 8.8.8.8 indicates the IP address of the DNS server

nameserver 8.8.4.4

4. hosts.deny and hosts.allow: deny and allow files

These two files are often configured to prohibit or allow ssh and telnet logins, host.allow takes precedence

ssh allows a single ip

sshd:1.1.1.1

ssh ip segment

sshd:1.1.1.0/24

telnet single ip

in.telnetd:1.1.1.1

telnet ip segment

in.telnetd:1.1.1. 0/24

Restrict all services to this ip *:1.1.1.1 //Edit deny file

Guess you like

Origin blog.csdn.net/qq_63283137/article/details/128850854