Network-related configuration files
1./etc/sysconfig/Network
/Etc/sysconfig/Network: This file defines whether to enable the network function and the Host Name of the system. [[Email protected] network-Scripts] # Cat/etc/sysconfig/networknetworking = yeshostname = server3 [[email protected] network-Scripts] # description: networking = {Yes | no}: Yes indicates that the network is enabled, and no indicates that the network is not enabled. Hostname =: defines the host name. After the host name is set, the system restarts to take effect. Gateway: defines the gateway.
2./etc/sysconfig/network-scripts/ifcfg-ethx
/Etc/sysconfig/network-scripts/ifcfg-ethx: This file defines some network-related parameters.
Example:
[[Email protected] network-Scripts] # Cat/etc/sysconfig/network-scripts/ifcfg-bond0DEVICE = bond0bootproto = noneonboot = yestype = ethernetipaddr = login 255.255.255.0gateway = login = now.6init = Yes [[email protected] network-Scripts] # description: device: the device name. It must be the same as the name after ifcfg. Hwaddr: the MAC address of the defined network. Must be the same as the real MAC address of the NIC. Bootproto: defines the boot protocol used. If the IP address is configured statically, it can be set to none or static. If the IP address is obtained dynamically, It is dhcponboot: {Yes | no} and determines whether to enable the NIC automatically upon startup. Type: defines the NIC type. Here, ethernetipaddr defines the IP address. Netmask: defines the subnet mask. Prefix: this also defines the subnet mask, indicating the prefix length. It is available on some systems, and some cannot be used. However, netmask is available. Gateway: defines the gateway address. The gateway address is the default gateway. Userctl: {Yes | no}, whether to allow normal users to disable or enable the NIC. Ipv6init: {Yes | no}. Whether to enable IPv6. Peerdns: whether to use the obtained DNS parameters when bootproto = DHCP. Yes indicates use, no indicates not use. Dns1: defines the first DNS server. Dns2: defines the second DNS server. Dns3: defines the third DNS server. When configuring Nic binding, the following parameters are also used (usually configured on the slave Nic): MASTER: Specify the device name of the master Nic. For example, Master = bond0slave: {Yes | no} specifies whether the NIC is used as a server Load balancer instance. On the bond Nic, you do not need to specify the hwaddr parameter.
3./etc/sysconfig/network-scripts/route-ethx
/Etc/sysconfig/network-scripts/route-ethx: configure the route information that passes through this Nic.
The format of the host route is. 1. IP-address-host via gateway Description: IP-address-Host: indicates the host route entry. For example, 192.168.1.1 via 172.17.100.13.2 network route format IP-address-net/prefix via gateway Description: IP-address-Net: is a network route entry. For example, 192.168.1.0/24 Via 172.17.100.1 Format 2: address0 = x. x. x. xnetmask0 = x. x. x. xgateway0 = x. x. x. article X: address1 = x. x. x. xnetmask1 = x. x. x. xgateway1 = x. x. x. X ...... N (n is a number): addressn = x. x. x. xnetmaskn = x. x. x. xgatewayn = x. x. x. X format cannot be used together. Example: [[email protected] network-Scripts] # Cat route-bond0 192.168.1.0/24 Via container via 172.17.100.1 [[email protected] network-Scripts] # route-nkernel IP routing tabledestination gateway genmask flags metric ref use iface192.168.2.1 172.17.100.1 255.255.255.255 ugh 0 0 0 bond0192.168.1.0 172.17.100.1 255.255.0 ug 0 0 0 0 bond0172.17.100.0 0.0.0.0 255.255.0 u 0 0 0 bond0169.254. 0.0 0.0.0.0 255.255.0.0 U 1004 0 0 bond00.0.0.0 172.17.100.2 0.0.0.0 ug 0 0 0 bond0 [[email protected] network-Scripts] # flags: U: Indicates upg: gateway is required. H: indicates the host route.
4./etc/resolv. conf
/Etc/resolv. conf: Configure DNS information.
Example:
[[Email protected] network-Scripts] # Cat/etc/resolv. conf search frame. comnameserver 172.17.100.253nameserver 172.17.100.254 [[email protected] network-Scripts] # Description: Search: Specifies the search domain. Domain: Specifies the local region. Nameserver: defines the DNS server address. Up to 3.
5./etc/hosts
/Etc/hosts: Specifies the local parsing file.
The file format is as follows: Host IP address host name host alias example: [[email protected] ~] # Cat/etc/hosts127.0.0.1 localhost. localdomain localhost4 localhost4.localdomain4: 1 localhost. localdomain localhost6 localhost6.localdomain6 [[email protected] ~] #
This article is from the "Hezhang" blog, please be sure to keep this source http://hezhang.blog.51cto.com/1347601/1440494
Network-related configuration files