From owner-freebsd-virtualization@freebsd.org Mon Sep 12 12:44:14 2016 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 414A7BD6B03 for ; Mon, 12 Sep 2016 12:44:14 +0000 (UTC) (envelope-from lars@e-new.0x20.net) Received: from mail.0x20.net (mail.0x20.net [217.69.76.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "0x20.net", Issuer "StartCom Class 1 DV Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E7032C6F for ; Mon, 12 Sep 2016 12:44:13 +0000 (UTC) (envelope-from lars@e-new.0x20.net) Received: from e-new.0x20.net (mail.0x20.net [IPv6:2001:aa8:fffb:1::3]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.0x20.net (Postfix) with ESMTPS id B76436E0081; Mon, 12 Sep 2016 14:44:10 +0200 (CEST) Received: from e-new.0x20.net (localhost [127.0.0.1]) by e-new.0x20.net (8.14.7/8.14.7) with ESMTP id u8CCiAcn038862; Mon, 12 Sep 2016 14:44:10 +0200 (CEST) (envelope-from lars@e-new.0x20.net) Received: (from lars@localhost) by e-new.0x20.net (8.14.7/8.14.7/Submit) id u8CCi9Jf038301; Mon, 12 Sep 2016 14:44:09 +0200 (CEST) (envelope-from lars) Date: Mon, 12 Sep 2016 14:44:09 +0200 From: Lars Engels To: Grzegorz Junka Cc: freebsd-virtualization@freebsd.org Subject: Re: Network unreachable in bhyve Message-ID: <20160912124409.GT92256@e-new.0x20.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bn6XL8m8Y51x7rzV" Content-Disposition: inline In-Reply-To: X-Editor: VIM - Vi IMproved 7.4 X-Operation-System: FreeBSD 8.4-RELEASE-p23 User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 12:44:14 -0000 --bn6XL8m8Y51x7rzV Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 12, 2016 at 12:21:48PM +0000, Grzegorz Junka wrote: > I am following the official guide: >=20 > https://www.freebsd.org/doc/handbook/virtualization-host-bhyve.html >=20 > After installing Centos6 and starting the guest there is no network=20 > inside the VM: >=20 > [root@localhost ~]# ping 8.8.8.8 > connect: Network is unreachable > [root@localhost ~]# ifconfig > lo Link encap:Local Loopback > inet addr:127.0.0.1 Mask:255.0.0.0 > inet6 addr: ::1/128 Scope:Host > UP LOOPBACK RUNNING MTU:65536 Metric:1 > RX packets:4 errors:0 dropped:0 overruns:0 frame:0 > TX packets:4 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:0 > RX bytes:260 (260.0 b) TX bytes:260 (260.0 b) >=20 > On the host: >=20 > root@ultrabook:~ # ifconfig > ath0: flags=3D8843 metric 0 mtu 2= 290 > ether 74:2f:68:cb:d6:2a > nd6 options=3D21 > media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng > status: associated > lo0: flags=3D8049 metric 0 mtu 16384 > options=3D600003 > inet6 ::1 prefixlen 128 > inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 > inet 127.0.0.1 netmask 0xff000000 > nd6 options=3D21 > bridge0: flags=3D8843 metric 0 mt= u 1500 > ether 02:6c:a7:69:c7:00 > nd6 options=3D9 > id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15 > maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200 > root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0 > member: tap0 flags=3D143 > ifmaxaddr 0 port 4 priority 128 path cost 2000000 > member: wlan0 flags=3D143 > ifmaxaddr 0 port 5 priority 128 path cost 66666 > tap0: flags=3D8943 metric= 0 mtu 1500 > options=3D80000 > ether 00:bd:b1:16:00:00 > nd6 options=3D29 > media: Ethernet autoselect > status: active > Opened by PID 1918 > wlan0: flags=3D8943 metri= c 0 mtu 1500 > ether 74:2f:68:cb:d6:2a > inet 192.168.8.101 netmask 0xffffff00 broadcast 192.168.8.255 > nd6 options=3D29 > media: IEEE 802.11 Wireless Ethernet MCS mode 11ng > status: associated > ssid HUAWEI-7DC4 channel 1 (2412 MHz 11g ht/20) bssid 94:fe:22:5= c:7d:c4 > regdomain 96 indoor ecm authmode WPA2/802.11i privacy ON > deftxkey UNDEF AES-CCM 2:128-bit txpower 20 bmiss 7 scanvalid 60 > protmode CTS ampdulimit 64k ampdudensity 8 shortgi wme burst > roaming MANUAL >=20 > I am using the following commands to load the kernel: >=20 > grub-bhyve -m device.map -r hd0,msdos1 -M 2048 centos > ls (hd0,msdos1)/ > linux (hd0,msdos1)/vmlinuz-2.6.32-642.el6.x86_64 root=3D/dev/mapper/Vo= lGroup-lv_root > initrd (hd0,msdos1)/initramfs-2.6.32-642.el6.x86_64.img > boot >=20 > and start the guest: >=20 > bhyve -c 4 -m 2048M -A -H -P \ > -s 0:0,hostbridge \ > -s 1:0,lpc \ > -s 2:0,virtio-net,tap0 \ > -s 3:0,virtio-blk,/dev/zvol/tank4/centos6v \ > -l com1,stdio \ > centos >=20 > The following has been added to /etc/rc.conf: >=20 > cloned_interfaces=3D"bridge0 tap0" > ifconfig_bridge0=3D"addm wlan0 addm tap0" >=20 > /boot/loader.conf >=20 > vmm_load=3D"YES" > nmdm_load=3D"YES" > if_bridge_load=3D"YES" > if_tap_load=3D"YES" >=20 > What I am missing? You cannot bridge the tap and wlan device. This only works with fixed ethernet devices. What you can do is set up NATing with pf / ipfw so your bhyve VMs are "behind" your host. --bn6XL8m8Y51x7rzV Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQF8BAEBCgBmBQJX1qMZXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ4RjQwMDE3RTRERjUzMTI1N0FGRTUxNDlF NTRDQjM3RDNBMDg5RDZEAAoJEOVMs306CJ1td2MH/jCGgMoIOJPTWxOGEU8q1SiF c2x7CBIsy1GqgX1xott+QgLGZm+I+V+NwkfeExYNKx0kdIV3ck5CLTfED9K6FGIM 87TyMDjjHvh05msXN5O9ONXoQsSbTPlajx5hOH++vd5YVb5k2/m39LEEbuiY+TM/ PZN3aGHilSQva4i0EWqMWZc0nlc3+RnNgQsF2N04M/wqqER4q+A3i2tXQfk/fJZ6 8nebqDRqkZxg01h/9c75KzwZOZxpjyd6lZ2yCqEl0BctAHRyHOYg0NpYfoHLAa4W +jpBkdcVj9Pkg/Pd7nUMzWNSd77j0z61Y59GDP0ZW8vKK+ENKLnrrfK+z7mDV84= =D6lZ -----END PGP SIGNATURE----- --bn6XL8m8Y51x7rzV--