How to destroy tun device (created by ssh -w)? - Networking

This is a discussion on How to destroy tun device (created by ssh -w)? - Networking ; I've tun devices created via "ssh -w". Sometimes, the connection is broken in a way that leaves the tun device around. I can remove the device via "rmmod tun", but this kills *all* tun devices. I'd like to be a ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: How to destroy tun device (created by ssh -w)?

  1. How to destroy tun device (created by ssh -w)?


    I've tun devices created via "ssh -w". Sometimes, the connection is
    broken in a way that leaves the tun device around. I can remove the
    device via "rmmod tun", but this kills *all* tun devices. I'd like to be
    a little less bloodthirsty than that.

    I thought perhaps "/sbin/ip tunnel del tun9", but that yields: "ioctl:
    Operation not supported". So apparently it's not the right type of
    device for this. Which does make sense as "ip tunnel show" doesn't show
    this tun device either.

    But ifconfig does show it, as does "ip link show".

    Any suggestions on how to delete the tun device?

    Thanks...Andrew

  2. Re: How to destroy tun device (created by ssh -w)?

    Hello,

    Andrew Gideon a écrit :
    > I've tun devices created via "ssh -w". Sometimes, the connection is
    > broken in a way that leaves the tun device around. I can remove the
    > device via "rmmod tun", but this kills *all* tun devices. I'd like to be
    > a little less bloodthirsty than that.
    >
    > I thought perhaps "/sbin/ip tunnel del tun9", but that yields: "ioctl:
    > Operation not supported". So apparently it's not the right type of
    > device for this.


    No it's not. "ip tunnel" manages only kernel-mode tunnels such as
    IP-in-IP, GRE or IPv6-in-IPv4 over IP. Not user-mode TUN/TAP devices.

    > Any suggestions on how to delete the tun device?


    Try tunctl from UML (User-mode Linux).

    However I am a bit surprised that the tun device created by ssh is
    persistent after ssh exits, because this is useless.

  3. Re: How to destroy tun device (created by ssh -w)?

    Andrew Gideon wrote:
    > I've tun devices created via "ssh -w". Sometimes, the connection is
    > broken in a way that leaves the tun device around. I can remove the
    > device via "rmmod tun", but this kills *all* tun devices. I'd like to be
    > a little less bloodthirsty than that.
    >
    > I thought perhaps "/sbin/ip tunnel del tun9", but that yields: "ioctl:
    > Operation not supported". So apparently it's not the right type of
    > device for this. Which does make sense as "ip tunnel show" doesn't show
    > this tun device either.
    >
    > But ifconfig does show it, as does "ip link show".
    >
    > Any suggestions on how to delete the tun device?
    >
    > Thanks...Andrew


    use 'tunctl'

  4. Re: How to destroy tun device (created by ssh -w)?

    On Fri, 04 Apr 2008 12:16:57 +0200, Pascal Hambourg wrote:

    > However I am a bit surprised that the tun device created by ssh is
    > persistent after ssh exits, because this is useless.


    Well, I'm guessing that some resource is being held by some mechanism
    somewhere in there . It only happens sometimes, and it does appear
    to eventually time out. I've not yet figured out the pattern, but I
    think it make be related to moving between networks (ie. when I shut my
    laptop down at home and bring it back online elsewhere). It's not 100%
    even in that case, though.

    I'll try tunctl when this next occurs.

    - Andrew

  5. Re: How to destroy tun device (created by ssh -w)?

    On Fri, 04 Apr 2008 23:36:27 +0000, Andrew Gideon wrote:

    > I'll try tunctl when this next occurs.


    Sorry. I meant to add "thanks" to the two of you that suggested this.

    Thanks...

    Andrew

  6. Re: How to destroy tun device (created by ssh -w)?

    On Fri, 04 Apr 2008 23:36:27 +0000, Andrew Gideon wrote:

    >> However I am a bit surprised that the tun device created by ssh is
    >> persistent after ssh exits, because this is useless.

    >
    > Well, I'm guessing that some resource is being held by some mechanism
    > somewhere in there .


    Ugh. The sshd was still running. I'd missed that, though in looking
    again I see it very clearly in the ps output.

    Thanks again...

    Andrew

+ Reply to Thread