Linux server hosts file configuration

angryTom
Release: 2020-02-03 17:35:18
Original
7532 people have browsed it

Linux server hosts file configuration

linux server hosts file configuration

The hosts file is a file in the Linux system responsible for rapid resolution of IP addresses and domain names, and is saved in ASCII format In the "/etc" directory, the file name is "hosts".

The hosts file contains the mapping between IP addresses and host names, and also includes aliases for the host names. In the absence of a domain name server, all network programs on the system query this file to resolve the IP address corresponding to a certain host name, otherwise they need to use a DNS service program to solve the problem. Usually, commonly used domain names and IP address mappings can be added to the hosts file to achieve quick and convenient access.

Let’s introduce the methods and steps to modify the hosts configuration file:

Required tools: vim/vi

1, Install vim editor

sudo apt install vim -y # debian sudo yum install vim -y # readhat
Copy after login

2. Use the editor to modify the hosts file

1. sudo vim /etc/hosts 2. 按下 i 键进入编辑模式
Copy after login

The format of the hosts file is as follows:

IP address host name/domain name

First part: network IP address;

Second part: host name or domain name;

Third part: host name Alias;

For example:

127.0.0.1 localhost.localdomain localhost 192.168.1.100 linmu100.com linmu100 192.168.1.120 ftpserver ftp120
Copy after login

3. Save after modification

1. 按下ESC 2. 输入 :wq
Copy after login

(Online video tutorial sharing:linux Video tutorial)

The above is the detailed content of Linux server hosts file configuration. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!