Even after removing vlan entry in /etc/network interfaces file, ifconfig is showing the intreface

I had set up a vlan in interfaces file. Later on, even after removing the entries and restarting network, the ifconfig command is displaying that interface. Even ifdown isnt taking it down. Ifdown throws error message that the interface isnt configured.

Even after multiple times of examination, I am seeing the same thing again. Wondering why it worked in the same way in the Oracle VM Virtual Box also. Even after commenting-out in the interfaces file, networking restart, networking stop / start, ifdown && ifup, even machine reboot also..!! Same experience..!! Could somebody please try this and explain..?

2

3 Answers

I had this problem while I used Netplan to add a VLAN on Ubuntu 18.04 Bionic. It did no go away when I removed it from the Yaml file. I even wan't able to create a new VLAN with the same VLAN ID because the previous one was not removed.

I solved this using this command:

ip link delete name [VLAN-NAME]

Edit /etc/network/interfaces

sudo gedit /etc/network/interfaces

Remove the vlan entries

Now you have to restart the interface

sudo ifdown eth0 

you can ignore the error if it appears here then

sudo ifup etho 

Now check again ifconfig

If it still shows that entry you may need to make a system reboot.

11

If anybody comes across this now, I hope this helps!

Unfortunately, in order to get the interface to go away, you will need to re-create a valid config; this could be as simple as

DEVICE=eth2.508
BOOTPROTO=none
VLAN=yes

Bring up the interface with

ifup eth2.508

If successful, you can then bring the interface back down

ifdown eth2.508

At this point, you should see the interface removed from ifconfig, and can safely move the config file from your network scripts folder.

The lesson to be learned from this is to bring down an interface before deleting it!

I also strongly recommend moving the configs to an archive directory instead of deleting them in case a situation arises that it becomes required/desired again. On my CentOS servers, I would do

cd /etc/sysconfig/network-scripts
mkdir if-archive
mv ./eth2.508 ./if-archive/eth2.508.20170621-01

You'll notice the filename has yyyymmdd-vv appended to it; the -vv is for if you have multiple configs from the same date, you can manually increment this to keep multiple copies. If you don't have a need, don't add it.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like