In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
What this article shares to you is about how to modify the DNS address in the Linux system. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
1. Modify hostname
The code is as follows:
# hostname Slyar
two。 Modify the IP address (eth0 is the name of the network card)
The code is as follows:
# ifconfig eth0 192.168.1.5 netmask 255.255.255.0
3. Modify the default gateway (eth0 is the name of the network card)
The code is as follows:
# route add default gw 192.168.1.1 dev eth0
4. Modify DNS
The code is as follows:
# vim / etc/resolv.conf
CentOS (RedHat) command line permanently modifies IP address, gateway, DNS
The command line permanently modifies the IP address, gateway, and DNS
1. Modify IP address
First check the number and name of your host network card. The relevant information is under / etc/sysconfig/network-scripts/.
You can see from the picture that I have two network cards, the first one is Ethernet physical network card, the number is 0, if you have more than one network card, the number is 0, 1, 2, 3. The second network card is a loop network card, which generally does not need to be set.
Using vim to edit you need to set up the IP network card, here I can only modify ifcfg-eth0, look at the picture, without much explanation, the previous state is the way it is written when BOOTPROTO is set to DHCP.
The code is as follows:
Vim / etc/sysconfig/network-scripts/ifcfg-eth0
The code is as follows:
DEVICE=eth0 # Nic name
BOOTPROTO=static # how to get ip (static/dhcp/bootp), without explanation
HWADDR=00:0C:29:B5:B2:69 # MAC address
IPADDR=12.168.1.5 # IP address
NETMASK=255.255.255.0 # Subnet Mask
NETWORK=192.168.1.0 # Network address
BROADCAST=192.168.0.255 # broadcast address
NBOOT=yes # Boot device
two。 Modify the gateway
The code is as follows:
Vim / etc/sysconfig/network
Add a gateway message
The code is as follows:
GATEWAY=192.168.1.1
3. Modify DNS
The code is as follows:
Vim / etc/resolv.conf
Just add DNS information.
The code is as follows:
Nameserver 192.168.1.1
4. Reload the network configuration
The code is as follows:
/ etc/init.d/network restart
The above is how to modify the DNS address in the Linux system. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.