how to ignore dns server obtained from dhcp in ifcfg config file
To ignore the DNS server obtained from DHCP in the ifcfg config file, you need to modify the configuration file as follows:
-
Open the configuration file for the specific network interface. The file is typically located in the
/etc/sysconfig/network-scripts/directory and has a name likeifcfg-ethXorifcfg-enX, whereXis the interface number. -
Edit the file using a text editor such as vi or nano.
-
Look for the line that starts with
DNS1=orDNS2=. These lines specify the DNS servers obtained from the DHCP server. -
Comment out or remove the line(s) by adding a
#at the beginning of the line(s). This will prevent the system from using the DNS server obtained from DHCP. -
Save the file and exit the text editor.
-
Restart the network service for the changes to take effect. You can do this by running the following command:
systemctl restart network
By following these steps, you have effectively ignored the DNS server obtained from DHCP in the ifcfg config file
原文地址: http://www.cveoy.top/t/topic/iU3K 著作权归作者所有。请勿转载和采集!