From owner-freebsd-virtualization@freebsd.org Mon Sep 12 12:49:46 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 A4A13BD6CB8 for ; Mon, 12 Sep 2016 12:49:46 +0000 (UTC) (envelope-from list1@gjunka.com) Received: from msa1.earth.yoonka.com (yoonka.com [185.24.122.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "msa1.earth.yoonka.com", Issuer "msa1.earth.yoonka.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 39B6DE84 for ; Mon, 12 Sep 2016 12:49:46 +0000 (UTC) (envelope-from list1@gjunka.com) Received: from ultrabook.yoonka.com (ip-109-84-2-155.web.vodafone.de [109.84.2.155]) (authenticated bits=0) by msa1.earth.yoonka.com (8.15.2/8.15.2) with ESMTPSA id u8CCnhcw049876 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for ; Mon, 12 Sep 2016 12:49:44 GMT (envelope-from list1@gjunka.com) X-Authentication-Warning: msa1.earth.yoonka.com: Host ip-109-84-2-155.web.vodafone.de [109.84.2.155] claimed to be ultrabook.yoonka.com Subject: Re: Network unreachable in bhyve To: freebsd-virtualization@freebsd.org References: From: Grzegorz Junka Message-ID: <1dec6b7a-9a33-43ec-e16c-ca74d8a9433d@gjunka.com> Date: Mon, 12 Sep 2016 12:49:38 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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:49:46 -0000 On 12/09/2016 12:21, Grzegorz Junka wrote: > I am following the official guide: > > https://www.freebsd.org/doc/handbook/virtualization-host-bhyve.html > > After installing Centos6 and starting the guest there is no network > inside the VM: > > [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) > > On the host: > > root@ultrabook:~ # ifconfig > ath0: flags=8843 metric 0 mtu > 2290 > ether 74:2f:68:cb:d6:2a > nd6 options=21 > media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng > status: associated > lo0: flags=8049 metric 0 mtu 16384 > options=600003 > inet6 ::1 prefixlen 128 > inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 > inet 127.0.0.1 netmask 0xff000000 > nd6 options=21 > bridge0: flags=8843 metric 0 > mtu 1500 > ether 02:6c:a7:69:c7:00 > nd6 options=9 > 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=143 > ifmaxaddr 0 port 4 priority 128 path cost 2000000 > member: wlan0 flags=143 > ifmaxaddr 0 port 5 priority 128 path cost 66666 > tap0: flags=8943 > metric 0 mtu 1500 > options=80000 > ether 00:bd:b1:16:00:00 > nd6 options=29 > media: Ethernet autoselect > status: active > Opened by PID 1918 > wlan0: flags=8943 > metric 0 mtu 1500 > ether 74:2f:68:cb:d6:2a > inet 192.168.8.101 netmask 0xffffff00 broadcast 192.168.8.255 > nd6 options=29 > 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:5c: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 > > I am using the following commands to load the kernel: > > 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=/dev/mapper/VolGroup-lv_root > initrd (hd0,msdos1)/initramfs-2.6.32-642.el6.x86_64.img > boot > > and start the guest: > > 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 > > The following has been added to /etc/rc.conf: > > cloned_interfaces="bridge0 tap0" > ifconfig_bridge0="addm wlan0 addm tap0" > > /boot/loader.conf > > vmm_load="YES" > nmdm_load="YES" > if_bridge_load="YES" > if_tap_load="YES" > > What I am missing? > > Grzegorz > I tried to set up the network following this guide: http://www.krizna.com/centos/how-to-setup-network-in-centos-6/ The dhcp option didn't work (can't obtain the IP). When assigning the IP statically the network can be started but then only the host is visible. Neither the DNS nor the gateway are visible: [root@localhost network-scripts]# pwd /etc/sysconfig/network-scripts [root@localhost network-scripts]# cat ifcfg-eth0 DEVICE=eth0 HWADDR=00:A0:98:54:5C:86 TYPE=Ethernet UUID=d8a635d0-dd47-4d50-ba34-63076ba00775 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO="static" IPADDR=192.168.8.120 NETMASK=255.255.255.0 GATEWAY=192.168.8.1 DNS1=8.8.8.8 DNS2=4.2.2.2 [root@localhost network-scripts]# ping 192.168.8.101 PING 192.168.8.101 (192.168.8.101) 56(84) bytes of data. 64 bytes from 192.168.8.101: icmp_seq=1 ttl=64 time=0.450 ms 64 bytes from 192.168.8.101: icmp_seq=2 ttl=64 time=0.197 ms --- 192.168.8.101 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1640ms rtt min/avg/max/mdev = 0.197/0.323/0.450/0.127 ms [root@localhost network-scripts]# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. From 192.168.8.120 icmp_seq=1 Destination Host Unreachable From 192.168.8.120 icmp_seq=2 Destination Host Unreachable From 192.168.8.120 icmp_seq=3 Destination Host Unreachable --- 8.8.8.8 ping statistics --- 4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3341ms pipe 3 [root@localhost network-scripts]# ping 192.168.8.1 PING 192.168.8.1 (192.168.8.1) 56(84) bytes of data. From 192.168.8.120 icmp_seq=1 Destination Host Unreachable From 192.168.8.120 icmp_seq=2 Destination Host Unreachable From 192.168.8.120 icmp_seq=3 Destination Host Unreachable --- 192.168.8.1 ping statistics --- 4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3395ms pipe 3 Am I missing some additional setting on the host? Grzegorz