Create TAP/TUN device CentOS 7

Here is how to do it on CentOS 7 / RedHat 7 where the command  tunctl is missing
and when you try to run ifconfig you get an error

~# ifconfig tap0 10.0.0.1/30
SIOCSIFADDR: No such device
tap0: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device

to solve this you may run this commands

1. first we must create the device using ip command

# ip tuntap add tap0 mode tap

2. run ifconfig

~# ifconfig tap0 10.0.0.1/30
~# ifconfig tap0
tap0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.0.0.1 netmask 255.255.255.252 broadcast 10.0.0.3
ether 32:f5:3a:44:a5:64 txqueuelen 500 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Posted in Tips and Tricks Tagged with: , , ,