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)06/01 Report--
This article mainly introduces "how to configure the centos network card to modify the ip address and modify the gateway". In the daily operation, I believe many people have doubts about how to configure the centos network card to modify the ip address and modify the gateway. The editor consulted all kinds of materials and sorted out a simple and easy-to-use operation method. I hope it will be helpful for everyone to answer the doubt about "how to configure the network card to modify the ip address and modify the gateway". Next, please follow the editor to study!
1. CentOS modifies IP address
Modify the configuration file of the IP address of the corresponding network card
The code is as follows:
# vi / etc/sysconfig/network-scripts/ifcfg-eth0
Modify the following
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
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
The code is as follows:
# vi / etc/resolv.conf
Modify the following
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
The code is as follows:
# service network restart
Or
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:
The code is as follows:
# hostname centos1
Start to take effect:
Modify / etc/sysconfig/network
Modify the configuration of the network card
The code is as follows:
# vi / etc/udev/rules.d/70-persistent-net.rules
At this point, the study on "how to configure the centos network card to modify the ip address and modify the gateway" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.