Creating tun/tap devices on Linux

I am trying to create tap devices on the host machine using the command:

sudo ip tuntap add mode tap br0p0

but I get the following error message:

Object "tuntap" is unknown, try "ip help". 

What should I do? I am working on Ubuntu 10.04


Solution 1:

Your command is correct, the problem is your version of ip is lacking support for tuntap. In Ubuntu 10.04 you will need to use tunctl unfortunately, or else time for a dist-upgrade! tuntap support was added to IP from Maverick (Ubuntu 10.10).

You can verify this by doing ip help and looking at the line that looks like:

where OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable | tunnel | tuntap | maddr | mroute | monitor | xfrm }

If you don't see tuntap, you're going to be needing tunctl I'm afraid!

You would use tunctl -p -t br0p0 for a TAP interface or tunctl -n -t br0p0 to create a TUN interface. Then obviously the usual ifconfig/router commands to get the interface up.

Have a scan over the tunctl man page for some worked examples.