Skip to main content

How do I permanently disable specific network interface in Ubuntu 20.04



  • cPRex Jurassic Moderator
    cPanel is relatively hands-off when it comes to networking, which is why we don't have a Forums area for that. Most networking questions end up at System Administration.
  • eitanc
    OK, I found a workaround to solve this indirectly, but it is rather good I think. The solution is made of two main steps that both are used in parallel: 1. Attach the interface to a dummy VLAN - At the management portal of the server's VPS - I created a dummy VLAN and attached the relevant interface to it, instead to the public IP. This interface is the only thing attached to this VLAN, so even if the interface will be "UP", it cannot communicate with anything, surely not the Internet 2. Shutdown the interface automatically each time the server starts: A. I created a script that shuts down the interface. Since I am using Ubuntu, it was: ip link set down (replace the placeholder of with the actual ID name of the interface, like eth1, hence ip link set eth1 down) (you can see the list of interfaces, their IP addresses, and if they are UP or DOWN - using the command of: ip addr) Let's assume the path of the file is /scripts/ B. I set the file as executable, using the following command: chmod +x /scripts/ C. I entered to the edit mode of Linux's scheduler, crontab, using: crontab -e D. I added the following line to the end of the jobs list @reboot /scripts/ Then I saved this change That's all folks! :)

Please sign in to leave a comment.