Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How linux modifies dns

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of how linux modifies dns, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this linux article on how to modify dns. Let's take a look at it.

Methods: 1. Use the "vi / etc/resolv.conf" command to modify the dns;2, use the "vi / etc/sysconfig/network-scripts/ifcfg-eth0" command to modify the dns items in the file, and restart the network card to take effect after modification.

The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How does linux modify dns

Method 1. Modify / etc/resolv.conf (recommended)

[root@bin ~] # vi / etc/resolv.confnameserver 8.8.8.8nameserver 8.8.4.4

The modification will take effect immediately without any additional processing! Therefore, this method is recommended.

Method 2. Modify / etc/sysconfig/network-scripts/ifcfg-eth0 file

[root@bin ~] # vi / etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0ONBOOT=yesBOOTPROTO=dhcpDNS2=8.8.4.4TYPE=EthernetDNS1=8.8.8.8IPV6INIT=noUSERCTL=noPEERDNS=yes

This method will not take effect until the Nic is restarted. You can restart the Nic with the following command:

Service network restart

How to check the native DNS

1. View / etc/resolv.con file

[oboth@localhost ~] $cat / etc/resolv.conf nameserver 114.114.114.114nameserver 8.8.8.8

2. Use the nslookup command to view DNS information

[oboth@localhost ~] $nslookup qq.comServer: 114.114.114.114Address: 114.114.114.114#53Name: qq.comAddress: 123.151.137.18Name: qq.comAddress: 61.129.7.47Name: qq.comAddress: 183.3.226.35

3. Use the dig command to view DNS information

[oboth@localhost] $dig; DiG 9.11.25-RedHat-9.11.25-2.fc33;; global options: + cmd;; Got answer:;;-> > HEADER

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report