Re: Creating a tap device.

2021-03-15 Thread john doe

TL-DR.

On 3/14/2021 4:54 PM, pe...@easthope.ca wrote:

From: "Alexander V. Makartsev" 
Date: Sun, 14 Mar 2021 11:41:47 +0500

But it wasn't creating a device with chosen name anywhere under "/dev" or 
"/dev/net/".
I believe, "/dev/net/tun" device is created when "tun" kernel module is 
inserted.


Crucial tip.  Thanks Alexander.

Consequently I made these arrangements.

(1) Put "tun" in /etc/modules.

peter@joule:/home/peter$ grep tun /etc/modules
tun



Is the tun module also for the tap module?
I could be rong but I would not mix both of them.


(2) Put "@reboot ip tuntap add mode tap tap0" in /etc/crontab.

peter@joule:/home/peter$ grep tap  /etc/crontab
@reboot ip tuntap add mode tap tap0

(3) Reboot.

(4) Verify that tap0 is present.

peter@joule:/home/peter$ ip link show dev tap0
6: tap0:  mtu 1500 qdisc pfifo_fast state UP mo
de DEFAULT group default qlen 1000
 link/ether 0a:c1:8e:81:78:aa brd ff:ff:ff:ff:ff:ff

Good.  Tomorrow will try a few more steps.



Note that with Libvirt and simply creating a bridge, makes guests
visible on the network.

--
John Doe



Re: Creating a tap device.

2021-03-14 Thread peter
From: deloptes 
Date: Sun, 14 Mar 2021 09:49:24 +0100
> 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.

Thanks,  ... P.


-- 
cell: +1 236 464 1479Bcc: peter at easthope. ca
VoIP: +1 604 670 0140



Re: Creating a tap device.

2021-03-14 Thread peter
From: "Alexander V. Makartsev" 
Date: Sun, 14 Mar 2021 11:41:47 +0500
> But it wasn't creating a device with chosen name anywhere under "/dev" or 
> "/dev/net/".
> I believe, "/dev/net/tun" device is created when "tun" kernel module is 
> inserted.

Crucial tip.  Thanks Alexander.

Consequently I made these arrangements.

(1) Put "tun" in /etc/modules.

peter@joule:/home/peter$ grep tun /etc/modules
tun

(2) Put "@reboot ip tuntap add mode tap tap0" in /etc/crontab.

peter@joule:/home/peter$ grep tap  /etc/crontab
@reboot ip tuntap add mode tap tap0

(3) Reboot.

(4) Verify that tap0 is present.

peter@joule:/home/peter$ ip link show dev tap0
6: tap0:  mtu 1500 qdisc pfifo_fast state UP mo
de DEFAULT group default qlen 1000
link/ether 0a:c1:8e:81:78:aa brd ff:ff:ff:ff:ff:ff

Good.  Tomorrow will try a few more steps.

Thanks again, P.

-- 
cell: +1 236 464 1479Bcc: peter at easthope. ca
VoIP: +1 604 670 0140



Re: Creating a tap device.

2021-03-14 Thread deloptes
pe...@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/




Re: Creating a tap device.

2021-03-13 Thread Alexander V. Makartsev

On 14.03.2021 09:55, pe...@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 can.
$ sudo ip tuntap add mode tap ether0-tap
$ sudo ip tuntap list
virbr1-nic: tap persist
ether0-tap: tap persist
$ sudo ip link list
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN mode 
DEFAULT group default qlen 1000

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ether0:  mtu 1500 qdisc pfifo_fast 
state UP mode DEFAULT group default qlen 1000

    link/ether 1c:1b:0d:01:02:03 brd ff:ff:ff:ff:ff:ff
3: virbr1:  mtu 1500 qdisc noqueue 
state DOWN mode DEFAULT group default qlen 1000

    link/ether 52:54:00:01:02:03 brd ff:ff:ff:ff:ff:ff
4: virbr1-nic:  mtu 1500 qdisc pfifo_fast master 
virbr1 state DOWN mode DEFAULT group default qlen 1000

    link/ether 52:54:00:01:02:03 brd ff:ff:ff:ff:ff:ff
5: ether0-tap:  mtu 1500 qdisc noop state DOWN mode 
DEFAULT group default qlen 1000

    link/ether 7e:63:1e:70:cf:c2 brd ff:ff:ff:ff:ff:ff
$ sudo ip tuntap del mode tap ether0-tap
$ sudo ip tuntap list
virbr1-nic: tap persist

But it wasn't creating a device with chosen name anywhere under "/dev" 
or "/dev/net/".
I believe, "/dev/net/tun" device is created when "tun" kernel module is 
inserted.


--
With kindest regards, Alexander.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄



Creating a tap device.

2021-03-13 Thread peter
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.

-- 
cell: +1 236 464 1479Bcc: peter at easthope. ca
VoIP: +1 604 670 0140