How to permanently remove eth0.x in CentOS

52,001

Solution 1

I'm thinking you use Centos 7, where Network-Manager is default network configuration utility. Two interfaces eth0.1 and eth0.500 are vlan 1 and vlan 500 tagged. To show all interfaces use command: # nmcli connection show To delete both vlan interfaces use these commands: # nmcli con del eth0.1 and # nmcli con del eth0.500 You can find help there https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Configure_802_1Q_VLAN_Tagging_Using_the_Command_Line_Tool_nmcli.html

Solution 2

These are virtual devices, they do not have their own configuration files in /etc/sysconfig/network-scripts/ but are defined in the main configuration file, something along the lines of this:

iface eth0:1 inet static
    address 192.168.4.1
    netmask 255.255.255.0

You can delete the interface using ip link delete eth0.1 assuming you want to delete interface eth0.1. But if the main configuration file holds those lines or something similar as I wrote above then I think the interface will come back on reboot. To permanently remove it then find the lines that define the virtual interface and comment them out or remove them (I recommend commenting out, never know unless you need them some time again).

Solution 3

Before deleting the interface, just edit the file and set onboot=no then delete the interface with the command: ip link delete eth0.1 and eth0.500

Share:
52,001

Related videos on Youtube

roymaztang
Author by

roymaztang

Updated on September 18, 2022

Comments

  • roymaztang
    roymaztang over 1 year

    I'm trying to remove eth0.x and keep eth0. While ifconfig lists both eth0.1 and eth0.500, I didn't find their configuration files /etc/sysconfig/network-scripts/ifcfg-eth0.x.

    I tried ifconfig eth0.1 down and it worked. But after restarting the network, both eth0.1 and eth0.500 came back.

    Is there a way to permanently remove these two interfaces?

    • grochmal
      grochmal almost 8 years
      You can remove the network card from the machine (but note that then the eth* name can change on the next boot).
    • roymaztang
      roymaztang almost 8 years
      eth0.x and eth0 are on the same card. Is there a way to remove eth0.x without deleting eth0? @grochmal
  • thrig
    thrig almost 8 years
    That iface eth0:1 stuff looks like it's from Debian, and not what the RedHat ifup-aliases script looks for.
  • ojs
    ojs almost 8 years
    Ok, so this is different in Red Hat based distros, well unfortunately I am not that familiar with them. But somewhere in that system these virtual devices are defined, and the ip command should delete it just not permanently I guess.
  • ojs
    ojs almost 8 years
    Is there any mention of either eth0.1 or eth0.500 in one of the startup scripts in /etc/rc.d/? Something along the line of ip link add eth0.1. If so then comment that line out.
  • ojs
    ojs almost 8 years
    Or if you are in CentOS 7 then you are probably using systemd, then you need to look through startup scripts in /etc/systemd/system/. See this answer for a good explanation of how systemd startup scripts work.
  • roymaztang
    roymaztang almost 8 years
    @ojs I didn't find "eth0.x" in /etc/rc.d/ using grep -R "eth0" /etc/rc.d/*. The OS is CentOS 6.8, so there isn't a directory named /etc/systemd/
  • Irfy
    Irfy almost 7 years
    On Fedora24, I had a dummy bridge NIC device br0-nic left over, even after disabling and removing the br0 bridge. ip link delete br0-nic was the only thing that worked for me. +1