How to get rid of veth interfaces?

9,675

Why are those veth interfaces present ?

Possibly because you are using a Virtualization Platform such as vmware or virtualbox or vagrant.

Getting rid of veth interfaces !

I suppose a better solution exists, but for the time being you can do it this way.

  • Getting the name of interfaces

    ifconfig | grep "^veth" | cut -d' ' -f1
    

    Here grep "^veth" selects only those interfaces (listed by ifconfig) that start with veth and cut shows only the names by delimiting the contents and showing only first field.

  • Now we have to shut down the drivers for these interface using

    ifconfig vethxxxxxx down
    

    Also, you can do it by using ip command ( as suggested by @dirkt in comments ).

    ip link set $veth down
    

    But since there are too many of them, use for loop like this :

    for veth in $(ifconfig | grep "^veth" | cut -d' ' -f1)
    do
        ifconfig $veth down    # OR this ip link set $veth down
    done
    
  • Here's one-liner for copy paste :

    for veth in $(ifconfig | grep "^veth" | cut -d' ' -f1); do ifconfig $veth down; done
    

Feel free to add in more stuff to the answer.

Share:
9,675

Related videos on Youtube

blueFast
Author by

blueFast

Updated on September 18, 2022

Comments

  • blueFast
    blueFast almost 2 years

    I am not sure why / when, some veth interfaces have appeared in my system (Ubuntu 16.0. LTS):

    » ifconfig | grep veth
    veth4556676 Link encap:Ethernet  HWaddr ee:b9:b9:ed:71:a6  
    veth8747335 Link encap:Ethernet  HWaddr 66:40:47:fd:1f:a7  
    veth13905bf Link encap:Ethernet  HWaddr ae:73:8f:f7:9d:d4  
    veth2636dd7 Link encap:Ethernet  HWaddr fa:b8:3c:d4:52:9c  
    veth42de626 Link encap:Ethernet  HWaddr 92:08:43:90:6e:f3  
    veth4eedb05 Link encap:Ethernet  HWaddr 66:5f:b8:e7:52:05  
    veth7534db0 Link encap:Ethernet  HWaddr 16:9c:06:e6:f2:aa  
    veth83508c7 Link encap:Ethernet  HWaddr 5a:55:6c:ee:e5:7b  
    veth8f275d6 Link encap:Ethernet  HWaddr 46:18:a1:52:7f:e9  
    veth9f370c9 Link encap:Ethernet  HWaddr da:9e:49:37:b4:16  
    vethb96da94 Link encap:Ethernet  HWaddr 42:11:90:11:8a:f4  
    vethba463c9 Link encap:Ethernet  HWaddr 06:40:d5:9a:79:7a  
    vethd820900 Link encap:Ethernet  HWaddr a2:94:53:c8:53:bf  
    vethdd077a0 Link encap:Ethernet  HWaddr 1a:f9:00:93:05:5e  
    vethef191e6 Link encap:Ethernet  HWaddr b2:b0:e1:68:50:7c  
    vethf70a6f9 Link encap:Ethernet  HWaddr a6:a7:72:dd:88:69  
    

    This happens in a freshly rebooted system. I have two questions:

    1. Why are those veth interfaces present?
    2. How can I get rid of them?

    Note: I have lately been doing some Vagrant / VirtualBox related stuff, so that could be the reason.

    • davidgo
      davidgo over 6 years
      veth interfaces are virtual interfaces used for bridging VMs - I'm not familiar with Vagrant, but I'd expect this is the cause - as this looks quite similar to what happens with Docker.
    • C0deDaedalus
      C0deDaedalus over 6 years
      Certainly veth are virtual ethernet interfaces used for providing an internet connection to virtual machines.
    • C0deDaedalus
      C0deDaedalus about 6 years
  • dirkt
    dirkt over 6 years
    BTW, I'd recommend using ip over the older ifconfig - ip can make use of network features of the kernel ifconfig can't use, though it's not important for this particular problem.
  • C0deDaedalus
    C0deDaedalus over 6 years
    @dirkt, Thanks for your suggestion. As I don't use command much frequently, could you please edit the answer for using ip command. Thanks.