To ignore the DNS server from DHCP in the ifcfg config file, you can follow these steps:

  1. 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 like ifcfg-eth0 or ifcfg-enp0s3.

  2. Edit the file using a text editor such as nano or vi.

  3. Locate the line that starts with BOOTPROTO. This line specifies the protocol used for obtaining IP addresses. Change it from BOOTPROTO=dhcp to BOOTPROTO=none or BOOTPROTO=static. This will disable the DHCP client on the interface.

  4. Next, find the line that starts with DNS1 or DNS. This line specifies the DNS server(s) to use. Comment out or remove this line by adding a # at the beginning.

  5. Save the changes and exit the text editor.

  6. Restart the network service to apply the changes. You can do this with the command: sudo systemctl restart network or sudo 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

how to ignore dns server from dhcp in ifcfg config file

原文地址: http://www.cveoy.top/t/topic/iU3C 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录