Ubuntu, remove network TAP interface
Asked Answered
H

3

22

I'm creating a network interface via a program in order to build a bridge between a simulated network (NS-3) and the real Linux host. So when the "bridged" node receive a packet in NS-3, the real Linux host receive the packet.

But when I run the program again, it can't "erase" or delete the network interface because "device or resource is busy".

I tried to shut the interface down (ifconfig <myInterface> down), restart the networking service (service networking restart), tried to delete the TAP interface with tunctl (tunctl -d myInterface), but even after hours, I'm still not able to delete or reuse this interface. "Device or resource is busy".

Can you please explain me how to delete or erase or reuse the interface?

Horal answered 8/7, 2013 at 14:34 Comment(0)
P
42

You can use sudo ip link delete tap# to delete the interface itself.

Patino answered 27/4, 2015 at 16:20 Comment(2)
Works on Ubuntu 16.04, after getting the Device or resource busy error. I made sure to still call sudo tunctl -d tap0 afterwards.Synthiasyntonic
hmm. i get a RTNETLINK answers: Operation not supported.Annmarie
J
-4

just type ip link set tap# down and it dissapears.

Jibe answered 1/8, 2013 at 14:46 Comment(3)
Isn't this is the same as using ifconfig down? It does not remove the interface.Impetigo
It's not correct since ip link or ifconfig tap# still show the tun/tap device but in down statusMiscalculate
The interface is not removed, is still there. It is just not shown with ifconfig.Munition
J
-4

You can also edit out network devices by use of this file then restarting computer.... vi /etc/udev/rules.d/70-persistent-net.rules

Jibe answered 1/8, 2013 at 21:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.