To disable the default route in the ifcfg config file, you can follow these steps:

  1. Open the ifcfg configuration file for the specific interface. The file is usually located in the "/etc/sysconfig/network-scripts/" directory and has a name like "ifcfg-<interface_name>". For example, if it is the eth0 interface, the file name would be "ifcfg-eth0".

  2. Edit the file using a text editor such as vi or nano. For example, run the command:

    sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
    
  3. Look for the line that starts with "DEFROUTE" and set its value to "no". If the line does not exist, add it at the end of the file. For example:

    DEFROUTE=no
    
  4. Save the changes and exit the text editor.

  5. Restart the network service to apply the changes. Use the appropriate command for your Linux distribution. For example, on CentOS/RHEL 7, use:

    sudo systemctl restart network
    

After following these steps, the default route for the specified interface should be disabled

how to disable default route in ifcfg config file

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

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