In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "Centos how to set static IP and modify Centos configuration file", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Centos how to set static IP and modify Centos configuration file" bar!
In particular, it is worth mentioning that Centos setting IP has a lot to learn. Here we mainly introduce Centos setting static IP, including Centos configuration file, CentOS system TCP/IP network configuration, system boot and startup, daemon management, system monitoring, backup and recovery and so on.
Many virtual machines are installed using VirtualBox, and DHCP is used by default, but with more and more virtual machines, this method is very inconvenient, so it is necessary to set the machine's IP to Centos to set static IP to explain several items that need to be added:
IPADDRIP address
NETMASK subnet mask
NETWORK Gateway address
In general, if we want to change the host address to a static address or change the host name, several files that need to be modified include:
/ etc/sysconfig/network Centos set hostname and network configuration
/ etc/sysconfig/network-scripts/ifcfg-eth0 is set for a specific network card
/ etc/resolv.conf sets DNS
/ etc/hosts sets the specified domain name resolution address
Generally speaking, we only need to modify the Centos configuration file of the Nic. For example, my Centos configuration file is as follows:
The code is as follows:
DEVICE=eth0
BOOTPROTO=static
TYPE=Ethernet
NAME= "System etho0"
BROADCAST=192.168.56.255
HWADDR=08:00:27:24:F8:9B
IPADDR=192.168.56.101
IPV6INIT=yes
IPV6_AUTOCONF=yes
NETMASK=255.255.255.0
NETWORK=192.168.56.1
ONBOOT=yes
After setting the IP for Centos, restart the network card: service network restart
There is another way we can implement Centos to set static IP, and that is through the command ifconfig. Usually, we use it to view some information of the current network card, at the same time, it can also be used to set some network card information.
The modified command is as follows: ifconfig eth0 192.168.56.102
However, after this command is executed, you can only modify the address of the network card in the current session. Let's take a look at the configuration file of ifcfg-eth0.
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
HWADDR=08:00:27:43:73:2f
That is, after restarting the server, the IP will still be obtained as shown in the Centos configuration file. So, if you need to change IP to static IP, the best way to do this is by modifying the Centos configuration file.
Thank you for your reading, the above is "Centos how to set static IP and modify Centos configuration file" content, after the study of this article, I believe you on Centos how to set static IP and modify Centos configuration file this problem has a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.