5

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?

roymaztang
  • 133
  • 1
  • 2
  • 7
  • You can remove the network card from the machine (but note that then the eth* name can change on the next boot). – grochmal Jul 27 '16 at 20:54
  • eth0.x and eth0 are on the same card. Is there a way to remove eth0.x without deleting eth0? @grochmal – roymaztang Jul 27 '16 at 20:57

3 Answers3

2

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

Khirgiy Mikhail
  • 332
  • 1
  • 5
1

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).

heemayl
  • 56,300
ojs
  • 932
  • 2
    That iface eth0:1 stuff looks like it's from Debian, and not what the RedHat ifup-aliases script looks for. – thrig Jul 27 '16 at 21:21
  • Which configuration file? I didn't find the keyword "eth0:1" or "eth0.1" in /etc/sysconfig/network-scripts/ – roymaztang Jul 27 '16 at 21:47
  • 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 Jul 27 '16 at 22:00
  • 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 Jul 27 '16 at 22:18
  • 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. – ojs Jul 27 '16 at 22:25
  • @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/ – roymaztang Jul 29 '16 at 14:39
  • 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 – Irfy Aug 02 '17 at 10:42
1

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

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255