Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #233017 > unrolled thread
| Started by | peter@easthope.ca |
|---|---|
| First post | 2021-03-14 07:10 +0100 |
| Last post | 2021-03-14 18:00 +0100 |
| Articles | 6 — 4 participants |
Back to article view | Back to linux.debian.user
Creating a tap device. peter@easthope.ca - 2021-03-14 07:10 +0100
Re: Creating a tap device. "Alexander V. Makartsev" <avbetev@gmail.com> - 2021-03-14 07:50 +0100
Re: Creating a tap device. peter@easthope.ca - 2021-03-14 17:20 +0100
Re: Creating a tap device. john doe <johndoe65534@mail.com> - 2021-03-15 08:20 +0100
Re: Creating a tap device. deloptes <deloptes@gmail.com> - 2021-03-14 09:50 +0100
Re: Creating a tap device. peter@easthope.ca - 2021-03-14 18:00 +0100
| From | peter@easthope.ca |
|---|---|
| Date | 2021-03-14 07:10 +0100 |
| Subject | Creating a tap device. |
| Message-ID | <BSs6R-65d-1@gated-at.bofh.it> |
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 1479 Bcc: peter at easthope. ca VoIP: +1 604 670 0140
[toc] | [next] | [standalone]
| From | "Alexander V. Makartsev" <avbetev@gmail.com> |
|---|---|
| Date | 2021-03-14 07:50 +0100 |
| Message-ID | <BSsJz-6hC-1@gated-at.bofh.it> |
| In reply to | #233017 |
[Multipart message — attachments visible in raw view] — view raw
On 14.03.2021 09:55, 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 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: <LOOPBACK,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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: <NO-CARRIER,BROADCAST,MULTICAST,UP> 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: <BROADCAST,MULTICAST> 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: <BROADCAST,MULTICAST> 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 ⠈⠳⣄⠀⠀⠀⠀
[toc] | [prev] | [next] | [standalone]
| From | peter@easthope.ca |
|---|---|
| Date | 2021-03-14 17:20 +0100 |
| Message-ID | <BSBDc-3gf-7@gated-at.bofh.it> |
| In reply to | #233019 |
From: "Alexander V. Makartsev" <avbetev@gmail.com>
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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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 1479 Bcc: peter at easthope. ca
VoIP: +1 604 670 0140
[toc] | [prev] | [next] | [standalone]
| From | john doe <johndoe65534@mail.com> |
|---|---|
| Date | 2021-03-15 08:20 +0100 |
| Message-ID | <BSPGa-3qO-3@gated-at.bofh.it> |
| In reply to | #233061 |
TL-DR. On 3/14/2021 4:54 PM, peter@easthope.ca wrote: > From: "Alexander V. Makartsev" <avbetev@gmail.com> > 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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
[toc] | [prev] | [next] | [standalone]
| From | deloptes <deloptes@gmail.com> |
|---|---|
| Date | 2021-03-14 09:50 +0100 |
| Message-ID | <BSuBI-7pW-7@gated-at.bofh.it> |
| In reply to | #233017 |
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/
[toc] | [prev] | [next] | [standalone]
| From | peter@easthope.ca |
|---|---|
| Date | 2021-03-14 18:00 +0100 |
| Message-ID | <BSCfU-3tm-5@gated-at.bofh.it> |
| In reply to | #233022 |
From: deloptes <deloptes@gmail.com> 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 1479 Bcc: peter at easthope. ca VoIP: +1 604 670 0140
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web