aboutsummaryrefslogtreecommitdiffstats
path: root/Network/tap-rm.sh
blob: fb23a6a9a809f0d3f2a629c1392b139cf5e2dce9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
########################################################################################################################
# tap-rm.sh
########################################################################################################################
#
# All rights reserved Ⓒ 2017-2023 sdxlive.com
#
# Written by Jean-Christophe Manciot <jcmanciot@sdxlive.com>
#
########################################################################################################################

########################################################################################################################
#
# Removing a tap interface.
#
########################################################################################################################
#
# Requirements:
# ------------
#
# We assume that the following packages are already installed:
#       - iproute2
#
########################################################################################################################
#
# Parameters:
# ----------
#
# - <tap_number>: integer for the tap<tap_number> interface
#
#######################################################################################################################
#
# Usage: example
# -----
#
# tap-rm.sh 0
#
########################################################################################################################
# set -x

tap_number=$1
PARAMETERS_NUMBER=1

case "$#" in
        ${PARAMETERS_NUMBER})
                ;;
        *)
                echo -e ''$_{1..180}'\b-'
                echo The number of the tap interface is expected as argument
                echo -e ''$_{1..180}'\b-'
                exit 1
                ;;
esac

sudo ip tuntap del dev tap${tap_number} mode tap

exit 0