In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly analyzes the relevant knowledge points of how to carry out the static distribution of IP, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn more about "how to allocate IP statically".
1. CentOS modifies IP address
Modify the configuration file of the IP address of the corresponding network card
Copy the code
The code is as follows:
# vi / etc/sysconfig/network-scripts/ifcfg-eth0
Modify the following
Copy the code
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 the way the network card obtains the ip address. The possible options are static,dhcp or bootp, corresponding to the statically specified ip address, the ip address obtained through the dhcp protocol, and the ip address obtained through the bootp protocol.
Subnet broadcast address corresponding to BROADCAST=192.168.0.255 #
Physical address of the network card corresponding to HWADDR=00:07:E9:05:E8:B4 #
IPADDR=12.168.1.2 # if you set the way for the Nic to obtain the ip address statically, this field specifies the ip address corresponding to the Nic
IPV6INIT=no
IPV6_AUTOCONF=no
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 to set this network interface when the system starts. If it is set to yes, the device will be activated when the system starts.
II. CentOS modify gateway
Modify the configuration file of the gateway of the corresponding network card
Copy the code
The code is as follows:
[root@centos] # vi / etc/sysconfig/network
Modify the following
NETWORKING=yes (indicates whether the system uses a network, which is generally set to yes. If set to no, the network cannot be used, and many system services will not start)
HOSTNAME=centos (set the hostname of this machine, which corresponds to the hostname set in / etc/hosts)
GATEWAY=192.168.1.1 (sets the IP address of the gateway connected locally. For example, the gateway is 10.0.0.2)
3. CentOS modifies DNS
Modify the configuration file of the DNS of the corresponding network card
Copy the code
The code is as follows:
# vi / etc/resolv.conf
Modify the following
Copy the code
The code is as follows:
Nameserver 8.8.8.8 # google Domain name Server
Nameserver 8.8.4.4 # google Domain name Server
Restart the network configuration
Copy the code
The code is as follows:
# service network restart
Or
Copy the code
The code is as follows:
# / etc/init.d/network restart
Modify IP address
Effective immediately:
# ifconfig eth0 192.168.0.2 netmask 255.255.255.0
Start to take effect:
Modify / etc/sysconfig/network-scripts/ifcfg-eth0
Modify gateway Default Gateway
Effective immediately:
# route add default gw 192.168.0.1 dev eth0
Start to take effect:
Modify / etc/sysconfig/network
Modify DNS
Modify / etc/resolv.conf
The modification can take effect immediately, and the startup is also effective.
Modify host name
Effective immediately:
Copy the code
The code is as follows:
# hostname centos1
Start to take effect:
Modify / etc/sysconfig/network
Modify the configuration of the network card
Copy the code
The code is as follows:
# vi / etc/udev/rules.d/70-persistent-net.rules
This is the end of the introduction on "how to allocate IP statically". More related content can be searched for previous articles, hoping to help you answer questions and questions, please support the website!
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.