[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Creating a tap device.



peter@easthope.ca wrote:

> My previous message was meant for another list.  Apology for the
> disturbance.
> 
> I've set aside the instructions for qemu.  Trying to understand how a
> tap device is created.  "man ip" has minimal explanation of "ip tuntap".
> 
>
https://stackoverflow.com/questions/15626088/tap-interfaces-and-dev-net-tun-device-using-ip-tuntap-command
> prompts this.
> 
> peter@joule:/home/peter$ sudo ip tuntap add mode tap tap0
> [sudo] password for peter:
> open: No such file or directory
> 
> peter@joule:/home/peter$ ls -ld /dev/tu*
> lrwxrwxrwx 1 root root 12 Mar 13 07:34 /dev/tun -> /dev/net/tun
> 
> Can anyone succeed to create a tap device using ip in Debian 10?
> 
> Thx,            ... P.


I spent also some time finding a suitable way to configure qemu (for
aarch64), so came to the bridge interface option as this way I can do a
diskless setup.

note whoami -> is the user you intend to run the qemu and you can replace
eth0 with your ether device

======================
TAP NETWORK
======================

Setup
   Create a bridge
     brctl addbr br0
   Clear IP of eth0
     ip addr flush dev eth0
   Add eth0 to bridge
     brctl addif br0 eth0
   Create tap interface
     tunctl -t tap0 -u `whoami`
   Add tap0 to bridge
     brctl addif br0 tap0
   Make sure everything is up
     ifconfig eth0 up
     ifconfig tap0 up
     ifconfig br0 up
   Check if properly bridged
     brctl show
   Assign ip to br0
     dhclient -v br0

Cleanup
   Remove tap interface tap0 from bridge br0
        brctl delif br0 tap0
   Delete tap0
        tunctl -d tap0
   Remove eth0 from bridge
        brctl delif br0 eth0
   Bring bridge down
        ifconfig br0 down
   Remove bridge
        brctl delbr br0
   Bring eth0 up
        ifconfig eth0 up
   Check if an IP is assigned to eth0, if not request one
        dhclient -v eth0

https://wiki.qemu.org/Documentation/Networking
https://www.qemu.org/2018/05/31/nic-parameter/



Reply to: