4

I can neither bring down nor delete this tun interface which is added on startup.

Here's the output when I run ifconfig:

eth0      Link encap:Ethernet  HWaddr 50:b7:c3:92:38:e2  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:38993 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38993 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:5827743 (5.8 MB)  TX bytes:5827743 (5.8 MB)

tun       Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet6 addr: <some ipv6 address, hidden for privacy>/128 Scope:Global
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1280  Metric:1
          RX packets:2772 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2301 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:1883371 (1.8 MB)  TX bytes:216571 (216.5 KB)

virbr0    Link encap:Ethernet  HWaddr f2:49:d0:5b:ef:80  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr c8:f7:33:ac:34:56  
          inet addr:192.168.219.130  Bcast:192.168.219.255  Mask:255.255.255.0
          inet6 addr: fe80::caf7:33ff:feac:3456/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1586404 errors:0 dropped:0 overruns:0 frame:0
          TX packets:909338 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2115233714 (2.1 GB)  TX bytes:95329457 (95.3 MB)

Through the tun interface enables me to access the IPv6 network via a tunnel, it slows me down so much because of the system's behavior prioritizing IPv6 network over IPv4 and trying to connect to web servers via that tunnel.

In an attempt to disable it, I ran sudo ifconfig tun down, and this came up:

$ sudo ifconfig tun down
[sudo] password for theuser: 
$ sudo ifconfig tun
tun       Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
      POINTOPOINT NOARP MULTICAST  MTU:1280  Metric:1
      RX packets:3250 errors:0 dropped:0 overruns:0 frame:0
      TX packets:2730 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:500 
      RX bytes:2194591 (2.1 MB)  TX bytes:264663 (264.6 KB)

$ sleep 10
$ sudo ifconfig tun
tun       Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
      inet6 addr: 2001:5c0:1400:a::d9/128 Scope:Global
      UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1280  Metric:1
      RX packets:6 errors:0 dropped:0 overruns:0 frame:0
      TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:500 
      RX bytes:416 (416.0 B)  TX bytes:982 (982.0 B)

$   

It brings itself up again just after few seconds! Even worse, when I try to delete that tunnel:

$ sudo ip tuntap del dev tun mode tun
ioctl(TUNSETIFF): Device or resource busy

Surprisingly, dmesg seems to show nothing special about it:

[    0.997669] tun: Universal TUN/TAP device driver, 1.6
[    0.998470] tun: (C) 1999-2004 Max Krasnyansky <[email protected]>
[43633.762740] Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev-tun instead.
[43995.971465] Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev-tun instead.
[43996.550325] Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev-tun instead.
[44538.652492] Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev-tun instead.
[44630.584862] Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev-tun instead.
[44630.627822] Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev-tun instead.
[44630.744474] Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev-tun instead.
[44630.858219] Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev-tun instead.
...

EDIT: running the command sudo ip link delete tun shows nothing and simply does not work.

EDIT:

$ sudo tunctl -d tun
TUNSETIFF: Invalid argument
$
2
  • If you don't want the IPv6 tunnel, then why don't you uninstall the package that starts it? AFAIK no such package is installed per default, so you must have installed it yourself. The configured IPv6 address belongs to GOGO6 so I assume it is the gogoc package that you need to uninstall.
    – Dubu
    Jul 10, 2015 at 6:13
  • @Dubu Wow thanks, It worked! I had forgot the name of the package providing the IPv6 tunnel....why don't you post it as an answer? ;)
    – minmaxavg
    Jul 10, 2015 at 7:06

3 Answers 3

7

To delete the device tun0, I used

sudo ip link set dev tun0 down

It worked.

2
  • 2
    That's equivalent to sudo ifconfig tun down which I have already tried.
    – minmaxavg
    Mar 9, 2018 at 22:27
  • worked for me too. Jan 7, 2019 at 1:05
5

As far as I know, no IPv6 tunnel software is installed per default, so you must have installed it yourself and it should suffice to uninstall the corresponding package again.

The configured IPv6 address in the ifconfig output belongs to a block assigned to GOGO6 (2001:5c0:1000::/36), so I assume it is the gogoc package that you need to uninstall.

2

You can use the command tunctl, first install the package:

sudo apt-get install uml-utilities

Then to delete a tun interface use the command:

sudo tunctl -d tun

Take a look on man tunctl:

Name

        tunctl - create and manage persistent TUN/TAP interfaces

-d  interfacename

        Delete the specified interfacename (set it to non-persistent)
1
  • It says TUNSETIFF: Invalid argument. well.... :(
    – minmaxavg
    Jul 9, 2015 at 10:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .