Article title: configure static IP addresses in Linux and set DNS and host names. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
The configuration file is located:
/Etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = static
IPADDR = 192.168.0.3
NETMASK = 255.255.255.0
GATEWAY = 192.168.0.1
Make the IP address take effect:
/Sbin/ifdown eth0
/Sbin/ifup eth0
Configure dns resolution
Echo "nameserver 211.98.1.28">/etc/resolv. conf
Notify gateway to update information:
/Etc/init. d/network restart
① Introduction
DNS is the Domain Name System, which can convert a Domain Name such as www.21php.com to an IP address such as 211.152.50.35. if there is no DNS, when you browse the website 21php.com, you must use numbers that are so hard to remember as 211.152.50.35. The DNS server provides the DNS service. There are three types of DNS servers: Cache-only server, Primary Name server, and Second Name Server ).
The detailed principles, workflows, terms, and concepts of DNS are limited by space. Can read special articles such as DNS-HOWTO to learn.
② Configure the primary DNS server
First, let's make the following assumptions: server A is the primary domain name server of 21php.com, its IP address is 11.0.0.1, server B is the secondary domain name server of 21php.com, and its IP address is 11.0.0.2;
Next we configure the primary DNS server 11.0.0.1 as 21PHP. COM.
The dns function in Linux is implemented through the bind software. After the bind software is installed, several inherent files are generated, which can be divided into two categories: Configuration files under the/etc directory and dns record files under the/var/named directory. Add other related files to set up the dns server. The following is a list and description of all files related to dns settings.
Hosts, host. conf, resolv. conf, named. boot, and named. conf are located in the/etc directory.
1. in the "hosts" file, the host name and IP address are defined, and the IP address and host name of the computer that will run dns are also defined. Content:
127.0.0.1 localhost. localdomain localhost
2. "host. conf file [Boban Note: Originally written as hosts. conf], "order hosts bind" statement, specifying the resolution order for the host name is first found in hosts, and then found in the dns server record. "Multi on" allows a host name to correspond to multiple IP addresses. Content:
Order hosts, bind
Multi on
Nospoof on
3. in the "resolv. conf" file, "nameserver 10.0.0.211" specifies the address of the dns server. Note: This file is essential for computers that do not use dns servers (non-windows systems; Windows systems set this file in "Network properties. If you have not set the local machine as a dns server, you must specify the address of a dns server to resolve the domain name. You can write up to three addresses as the candidate dns server for the previous failure. "Domain zrs.com" specifies the default domain. File content:
Domain 21php.com
Nameserver 11.0.0.1
[1] [2] [3] Next page