openvpn usage: how to modify ip address and how to remove a tun interface?

9

7

I used openvpn to create a tun interface on linux

openvpn --mktun --dev tun2
ip link set tun2 up
ip addr add 10.0.0.2/24 dev tun2

now I want to modify the ip address to 10.0.0.1/16, how to do it? besides, how to remove tun2

thanks

misteryes

Posted 2013-06-03T21:57:16.680

Reputation: 2 255

Answers

17

If you want to remove an ip address simply use del instead of `add.

So ip addr del 10.0.0.2/24 dev tun2 to remove an IP. But since you want to remove the interface that doesn't really matter.

To remove an tun* interface simply use ip link del name or in your case ip link delete tun2.

Zoredache

Posted 2013-06-03T21:57:16.680

Reputation: 18 453

Additionally, if you want it to stay deleted after reboot, use openvpn --rmtun --dev tun2. – aquaherd – 2016-08-29T13:44:30.873