How do I permanently disable specific network interface in Ubuntu 20.04
Hello,
I wish to permanently disable specific network interface in Ubuntu 20.04, but could not find a way to do it.
I tried the following two methods, plus server reboot and it did not help:
1. Added "iface eth0 inet manual" to /etc/network/interfaces
2. Added "optional: true" to "network: > ethernets: > %interface-id%" at a yaml file at /etc/netplan/
I read there is a 3rd way of disabling network driver, but I don't wish to go that deep.
Any ideas?
(BTW, why this site doesn't have a forum of "Networking"? looks very needed to me)
-
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. 0 -
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/shutdown-interface-eth1.sh B. I set the file as executable, using the following command: chmod +x /scripts/shutdown-interface-eth1.sh 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/shutdown-interface-eth1.sh Then I saved this change That's all folks! :) 0
Please sign in to leave a comment.
Comments
2 comments