how to ignore dns server from dhcp in ifcfg config file
To ignore the DNS server from DHCP in the ifcfg config file, you can follow these steps:
-
Open the ifcfg config file for the network interface you want to configure. Typically, the file is located in the
/etc/sysconfig/network-scripts/directory and has a name likeifcfg-eth0orifcfg-enp0s3. -
Edit the file using a text editor such as nano or vi.
-
Locate the line that starts with
BOOTPROTO. This line specifies the protocol used for obtaining IP addresses. Change it fromBOOTPROTO=dhcptoBOOTPROTO=noneorBOOTPROTO=static. This will disable the DHCP client on the interface. -
Next, find the line that starts with
DNS1orDNS. This line specifies the DNS server(s) to use. Comment out or remove this line by adding a#at the beginning. -
Save the changes and exit the text editor.
-
Restart the network service to apply the changes. You can do this with the command:
sudo systemctl restart networkorsudo service network restart, depending on the Linux distribution you are using.
By following these steps, you have manually configured the network interface to use a static IP address and ignored the DNS server provided by DHCP
原文地址: http://www.cveoy.top/t/topic/iU3C 著作权归作者所有。请勿转载和采集!