From nobody Sun May 15 16:10:29 2022 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 10B8B1ABC085 for ; Sun, 15 May 2022 16:10:52 +0000 (UTC) (envelope-from mike@karels.net) Received: from mail.karels.net (mail.karels.net [216.160.39.52]) by mx1.freebsd.org (Postfix) with ESMTP id 4L1S6L3rfDz3HsG for ; Sun, 15 May 2022 16:10:50 +0000 (UTC) (envelope-from mike@karels.net) Received: from mail.karels.net (localhost [127.0.0.1]) by mail.karels.net (8.16.1/8.16.1) with ESMTP id 24FGAUNC074119; Sun, 15 May 2022 11:10:30 -0500 (CDT) (envelope-from mike@karels.net) Received: from [10.0.2.130] ([10.0.1.1]) by mail.karels.net with ESMTPSA id fxfaAPYlgWKFIQEA4+wvSQ (envelope-from ); Sun, 15 May 2022 11:10:30 -0500 From: Mike Karels To: Benoit Chesneau Cc: freebsd-net@FreeBSD.org, Mario Marietto Subject: Re: tap0 don't receive anything in a vm Date: Sun, 15 May 2022 11:10:29 -0500 X-Mailer: MailMate (1.14r5818) Message-ID: <600615F2-5F92-46B4-8265-9E9C65D2A2CE@karels.net> In-Reply-To: References: List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4L1S6L3rfDz3HsG X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of mike@karels.net designates 216.160.39.52 as permitted sender) smtp.mailfrom=mike@karels.net X-Spamd-Result: default: False [-1.59 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[mike]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:216.160.39.52]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[karels.net]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_SPAM_SHORT(0.61)[0.612]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998]; MLMMJ_DEST(0.00)[freebsd-net]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:209, ipnet:216.160.36.0/22, country:US]; FREEMAIL_CC(0.00)[FreeBSD.org,gmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On 15 May 2022, at 10:53, Benoit Chesneau wrote: > Thanks but I have already set them to 1. This is kind of unexpected :/ > > ``` > # sysctl net.inet.ip.forwarding > net.inet.ip.forwarding: 1 > # sysctl net.link.tap.up_on_opennet.link.tap.up_on_open: 1 > ``` > > in the vm, pinging the IP hosts are OK: > ``` > # ifconfig vtnet0 > vtnet0: flags=3D8943 me= tric 0 mtu 1500 > options=3D80028 > ether 58:9c:fc:02:83:8a > hwaddr 58:9c:fc:02:83:8a > inet 10.1.0.2 netmask 0xffffff00 broadcast 10.1.0.255 > inet6 fe80::5a9c:fcff:fe02:838a%vtnet0 prefixlen 64 scopeid 0x1 > inet6 2a0e:e701:110b:102::3 prefixlen 64 > nd6 options=3D21 > media: Ethernet 10Gbase-T status: active > > # ping 10.1.0.1 > PING 10.1.0.1 (10.1.0.1): 56 data bytes > 64 bytes from 10.1.0.1: icmp_seq=3D0 ttl=3D64 time=3D0.192 ms > 64 bytes from 10.1.0.1: icmp_seq=3D1 ttl=3D64 time=3D0.223 ms > ^C > --- 10.1.0.1 ping statistics --- > 2 packets transmitted, 2 packets received, 0.0% packet loss > round-trip min/avg/max/stddev =3D 0.192/0.208/0.223/0.015 ms > # ping 10.2.0.11 > PING 10.2.0.11 (10.2.0.11): 56 data bytes > 64 bytes from 10.2.0.11: icmp_seq=3D0 ttl=3D64 time=3D0.204 ms64 bytes = from 10.2.0.11: icmp_seq=3D1 ttl=3D64 time=3D0.193 ms > > ``` > > But pinging the default gateway of the host doesn't work > > ``` > ping -t5 10.2.0.1 > PING 10.2.0.1 (10.2.0.1): 56 data bytes > > --- 10.2.0.1 ping statistics ---5 packets transmitted, 0 packets receiv= ed, 100.0% packet loss > ``` > > When I do a tcpdump on the tap0 interface on the Host I get the followi= ng result: > > ``` > # tcpdump -i tap0 > tcpdump: verbose output suppressed, use -v or -vv for full protocol dec= ode > listening on tap0, link-type EN10MB (Ethernet), capture size 262144 byt= es > 17:35:21.210796 IP 10.1.0.2.6065 > vm91.jn-hebergement.com.https: Flags= [S], seq 3549455562, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS= val 2252684480 ecr 0], length 0 > 17:35:23.347332 IP 10.1.0.2 > 10.2.0.1: ICMP echo request, id 5721, seq= 0, length 64 > 17:35:24.348907 IP 10.1.0.2 > 10.2.0.1: ICMP echo request, id 5721, seq= 1, length 64 > 17:35:24.410733 IP 10.1.0.2.6065 > vm91.jn-hebergement.com.https: Flags= [S], seq 3549455562, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS= val 2252687680 ecr 0], length 0 > 17:35:25.350038 IP 10.1.0.2 > 10.2.0.1: ICMP echo request, id 5721, seq= 2, length 64 > 17:35:26.351187 IP 10.1.0.2 > 10.2.0.1: ICMP echo request, id 5721, seq= 3, length 64 > 17:35:27.352990 IP 10.1.0.2 > 10.2.0.1: ICMP echo request, id 5721, seq= 4, length 64 > 17:35:27.611391 IP 10.1.0.2.6065 > vm91.jn-hebergement.com.https: Flags= [S], seq 3549455562, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS= val 2252690881 ecr 0], length 0 > 17:35:30.811451 IP 10.1.0.2.6065 > vm91.jn-hebergement.com.https: Flags= [S], seq 3549455562, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS= val 2252694080 ecr 0], length 0 > 17:35:30.998410 IP 10.1.0.2.1040 > 149.202.36.10.https: Flags [S], seq = 496616510, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 105406= 1401 ecr 0], length 0 > ^C > 10 packets captured > 10 packets received by filter0 packets dropped by kernel > ``` > > Any idea what's going on ? could it be related to th bhyve options set = by vm-bhyve starting a console ? > > ``` > May 15 17:55:25: [bhyve options: -c 1 -m 2G -Hwl bootrom,/usr/local/sha= re/uefi-firmware/BHYVE_UEFI_CSM.fd -U ac3dafab-bedb-11ec-b24d-1402ec690a8= 0 -u] > May 15 17:55:25: [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,virti= o-blk,/vms/utm/disk0.img -s 5:0,virtio-net,tap0,mac=3D58:9c:fc:07:c0:67 -= s 5:1,virtio-net,tap2,mac=3D58:9c:fc:06:05:0c] > ``` > > Any suggestion is welcome, Does 10.2.0.1 have a route back to the guest? Mike > ------- Original Message ------- > On Sunday, May 15th, 2022 at 14:47, Mario Marietto wrote: > >> /etc/sysctl.conf : >> >> net.link.tap.up_on_open=3D1 >> net.inet.ip.forwarding=3D1 >> >> Il giorno dom 15 mag 2022 alle ore 14:33 Benoit Chesneau ha scritto: >> >>> My goal is to setup a p2p connection between the host and a guest vm = and use the host as the nethop for the vm. I'm uskng bhyve for this setup= : >>> >>> 1. on the host i create a tap tap0 interface and assign to it the IP = 10.1.0,1 >>> 2. i create and start the vm using vm-bhyve. >>> 3. in the vm I set the vtnet0 interface to 10.1.0.2 and set the defau= lt router to 10.1.0.1. >>> >>> i can ping the host but nothing up. When i run tcpdump on the host fo= r this interface i can see the ping reply coming but it doesn't go to the= guest. Any idea what's wrong? could it be related to the setup of the co= nsole port in bhyve? -l com1,stdio . >>> >>> Thoughts? >>> >>> Beno=C3=AEt >> >> -- >> >> Mario.