In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how the configuration options of the files related to network configuration in CentOS are described. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
CentOS modifies network-related configuration files such as IP addresses
Find the IP address profile of the corresponding network card: ifcfg-eth number.
Path: / etc/sysconfig/network-scripts/ifcfg-eth digit
Description of configuration items in the file
The code is as follows:
DEVICE=eth0 # describes the device alias corresponding to the Nic, for example, it is eth0 in the file of ifcfg-eth0
BOOTPROTO=static # sets how the network card obtains the ip address. The options are: static (static), dhcp (to obtain IP through DHCP) or bootp (to obtain IP using BOOTP protocol)
BROADCAST=192.168.0.255 # Subnet broadcast address
HWADDR=00:17:F3:05:18:20 # Network Card physical address (MAC)
Use this IP address when IPADDR=192.168.0.2 # BOOTPROTO=static
IPV6INIT=no # initialization of IPv6 function
Whether IPV6_AUTOCONF=no # automatically configures IPv6
The network mask for the NETMASK=255.255.255.0 # Nic
NETWORK=192.168.1.0 # Network address corresponding to the Nic
ONBOOT=yes # whether this device is enabled when the system starts, or activated when the system starts up when yes
# TYPE=Ethernet # Network Type
# USERCTL=no # whether non-root users can control the device
Update on March 18, 2014: do not set the parameter NETWORK in CentOS, it has been officially deprecated, and the gateway may not be added successfully after setting it. Please see the latest blog post: problems caused by setting NETWORK in CentOS network configuration.
CentOS official help: http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-networkscripts-interfaces.html
Configuration files related to CentOS gateway configuration
Path: / etc/sysconfig/network
Description of configuration items in the file
The code is as follows:
NETWORKING=yes # indicates whether the system uses a network, usually yes. If no, the network is not used and many system services cannot be started
# NETWORKING_IPV6=no # whether to enable IPv6
# FORWARD_IPV4=no # whether to enable IP forwarding
# HOSTNAME=localhost.localdomain # set the hostname of this machine. The value should correspond to the hostname set in / etc/hosts. When commented out, the hostname or domain name is generally resolved first, and then the DNS is resolved.
GATEWAY=192.168.1.1 # set the IP address of the gateway
# GATEWAYDEV=gateway # Gateway device name
CentOS official help: http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-sysconfig-network.html
CentOS DNS-related configuration files
Path: / etc/resolv.conf
Description of configuration items in the file
The code is as follows:
# the most important thing is nameserver, others can be ignored
Nameserver 8.8.8.8 # google Domain name Server
Nameserver 8.8.4.4 # google Domain name Server
# search mitchellchu.com www.mitchellchu.com # define the search list of domain names
# domain mitchellchu.com # define a local domain name
# sortlist # sort the returned domain names
Network device restart
Service network restart
Or
/ etc/init.d/network restart
IP address modification
Effective immediately:
Ifconfig eth0 192.168.0.2 netmask 255.255.255.0
Take effect after restarting the network device
See modification of / etc/sysconfig/network-scripts/ifcfg-eth number
Modify the current gateway Default Gateway
Effective immediately:
Route add default gw 192.168.0.1 dev eth0
Effective after restarting the network device:
See: / etc/sysconfig/network configuration
Modify DNS
See: / etc/resolv.conf configuration
Effective immediately after modification
Modify hostname
Effective immediately:
Hostname centos1
Restart takes effect:
See: / etc/sysconfig/network configuration, note that there is also the configuration of / etc/hosts
On the CentOS network configuration-related file configuration options description is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.