Last active
August 29, 2015 14:11
-
-
Save paulc/9cb7f9beb580ff470e21 to your computer and use it in GitHub Desktop.
Freebsd - Bhyve Notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### /etc/start_if.vtnet0 | |
ifconfig vtnet0 link 00:50:56:00:72:c4 up | |
#### /etc/rc.conf | |
hostname="vm0" | |
ifconfig_vtnet0="inet 144.76.8.90 netmask 255.255.255.224" | |
defaultrouter="144.76.8.65" | |
sshd_enable="YES" | |
sendmail_enable="NONE" | |
dumpdev="NO" | |
#### /etc/resolv.conf | |
nameserver 8.8.8.8 | |
nameserver 8.8.4.4 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### /etc/rc.conf | |
hostname="freebsd10" | |
sshd_enable="YES" | |
sendmail_enable="NONE" | |
zfs_enable="YES" | |
ntpd_enable="YES" | |
pf_enable="YES" | |
gateway_enable="YES" | |
ifconfig_em0="inet 144.76.8.71 netmask 255.255.255.224" | |
cloned_interfaces="bridge0 tap0" | |
ifconfig_tap0="up" | |
ifconfig_bridge0="addm em0 addm tap0 up" | |
defaultrouter="144.76.8.65" | |
ifconfig_em0_ipv6="inet6 2a01:4f8:190:8346::1 prefixlen 64" | |
ipv6_default_interface="em0" | |
ipv6_defaultrouter="fe80::1%em0" | |
#### /etc/pf.conf | |
ext_if = "{ em0 }" | |
nat_if = "{ tap0 }" | |
#tcp_services = "{ ssh http }" | |
#udp_services = "{ domain }" | |
#nat pass on $ext_if from 10.0.0.0/8 to any -> $ext_if | |
#rdr pass on $ext_if inet proto tcp to port 8022 -> 10.0.0.2 port 22 | |
#set skip on lo1 | |
#antispoof for $ext_if | |
#block in log on $ext_if proto { udp tcp } | |
#pass out on $ext_if keep state | |
#pass in on $ext_if proto tcp to $ext_if port $tcp_services keep state | |
#pass in on $ext_if proto udp to $ext_if port $udp_services keep state | |
#### /etc/sysctl.conf | |
net.link.tap.up_on_open=1 | |
#### /boot/loader.conf | |
zfs_load="YES" | |
vfs.root.mountfrom="zfs:tank/root" | |
geom_mirror_load="YES" | |
vfs.zfs.zio.use_uma="0" | |
virtio_load="YES" | |
virtio_pci_load="YES" | |
virtio_blk_load="YES" | |
if_vtnet_load="YES" | |
virtio_balloon_load="YES" | |
vmm_load="YES" | |
nmdm_load="YES" | |
if_bridge_load="YES" | |
if_tap_load="YES" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create zvol | |
zfs create -o volmode=dev tank/vps | |
zfs create -V 10G tank/vps/vm0 | |
# Install VM | |
bhyveload -c /dev/nmdm0A -m 512M -d FreeBSD-10.1-RELEASE-amd64-disc1.iso vm0 | |
bhyve -c 2 -m 512M -A -H -P -s 0:0,hostbridge -s 1:0,virtio-net,tap0 -s 2:0,lpc -s 3:0,virtio-blk,/dev/zvol/tank/vps/vm0 -l com1,/dev/nmdm0A -s 31:0,ahci-cd,FreeBSD-10.1-RELEASE-amd64-disc1.iso vm0 | |
# Run VM | |
# sh /usr/share/examples/bhyve/vmrun.sh -C /dev/nmdm0A -d /dev/zvol/tank/vps/vm0 vm0 | |
# cu -l /dev/nmdm0B | |
bhyvectl --vm=vm0 --destroy | |
bhyveload -c /dev/nmdm0A -m 512M -d /dev/zvol/tank/vps/vm0 vm0 | |
bhyve -c 2 -m 512M -A -H -P -s 0:0,hostbridge -s 1:0,virtio-net,tap0 -s 2:0,lpc -s 3:0,virtio-blk,/dev/zvol/tank/vps/vm0 -l com1,/dev/nmdm0A vm0 | |
# Routing | |
# Setup tap0 (looses ip?) | |
# IPv6 ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment