ref: 176154fc604d73d24ae22536fce161059261f1ec
parent: 690d1ec36bef165df763f5012f15f352fa882f39
author: stanley lieber <stanley.lieber@gmail.com>
date: Wed Dec 7 16:19:53 EST 2016
fqa.ms fqa3.ms: update QEMU OpenBSD TAP instructions
--- a/fqa.ms
+++ b/fqa.ms
@@ -479,7 +479,7 @@
.ihtml a
.ihtml a <a href="fqa3.html#3.3.1.4.2">
-3.3.1.4.2 - OpenBSD tun(4)
+3.3.1.4.2 - OpenBSD TAP
.ihtml a
.ihtml a <a href="fqa3.html#3.3.1.4.3">
--- a/fqa3.ms
+++ b/fqa3.ms
@@ -2377,60 +2377,72 @@
.html - <a name="3.3.1.4.2" />
.ihtml h5 <h5>
.SH
-3.3.1.4.2 - OpenBSD tun(4)
+3.3.1.4.2 - OpenBSD TAP
.R
.ihtml h5
-Tested: OpenBSD/amd64 4.9-CURRENT, qemu-0.9.1p18, kqemu-1.3.0pre11p3
+Tested: OpenBSD/amd64 6.0-STABLE, qemu-2.6.0
-Configure a
-.ihtml a <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=tun&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html">
-tun(4)
-.ihtml a
-interface with an IP address selected for your
-.CW
-qemu
-.R
-network. Configure bridging between the
-.ihtml a <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=tun&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html">
-.CW tun(4)
-.ihtml a
-interface and your machine's external interface. Finally, configure NAT or rules to pass traffic for the
-.CW
-qemu
-.R
-network in
-.ihtml a <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pf.conf&apropos=0&sektion=5&manpath=OpenBSD+Current&arch=i386&format=html">
-.CW pf.conf .
-.ihtml a
-Reboot.
-
-To launch
-.CW qemu
-as a regular user:
+.B Note:
+Read over this first. Be careful not to clobber any system settings you may already have configured. If you don't understand something, read the relevant man pages until you do. Feel free to substitute arbitrary network values below.
.P1
-sudo sh -c "sudo -C 4 -u $USER qemu -m 768 \e
--net nic,vlan=0,model=rtl8139,macaddr=52:54:00:12:33.36 \e
--net tap,vlan=0,fd=3,script=no -no-fd-bootchk \e
--hda 9front.qcow2.img 3<>/dev/tun0"
-.P2
+# as root
+pkg_add bzip2 qemu ssvnc wget
+echo inet 192.168.54.1 255.255.255.0 NONE >/etc/hostname.vether0
+ed /etc/pf.conf
+/ext_if
+a
+int_if="vether0"
-Read:
-.ihtml a <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=hostname.if&sektion=5&arch=i386&apropos=0&manpath=OpenBSD+Current">
-.CW hostname.if(5) ,
-.ihtml a
-.ihtml a <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pf.conf&apropos=0&sektion=5&manpath=OpenBSD+Current&arch=i386&format=html">
-.CW pf.conf(5) ,
-.ihtml a <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=tun&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html">
-.CW tun(4)
-.ihtml a
+match out from $int_if:network to any nat-to ($ext_if:0)
+.
+w
+q
+pfctl -f /etc/pf.conf
+echo link0 up >/etc/hostname.tap0
+echo add vether0 add tap0 up >/etc/hostname.bridge0
+sh /etc/netstart
+>/etc/dhcpd.conf
+ed /etc/dhcpd.conf
+i
+option domain-name "example.com";
+option domain-name-servers 192.168.54.1;
-See also:
-.ihtml a <a href="http://brycv.com/blog/2013/notes-on-openbsd-in-qemu-on-openbsd/">
-.I
-Notes on OpenBSD in QEMU on OpenBSD
-.R
-.ihtml a
+subnet 192.168.54.0 netmask 255.255.255.0 {
+ option routers 192.168.54.1;
+
+ range 192.168.54.100 192.168.54.199;
+}
+.
+w
+q
+rcctl enable dhcpd
+rcctl start dhcpd
+ed /var/unbound/etc/unbound.conf
+/access-control
+i
+ access-control: 192.168.54.0/24 allow
+.
+w
+q
+echo \'permit setenv { -ENV PS1=$DOAS_PS1 SSH_AUTH_SOCK } :wheel\' \\
+ >/etc/doas.conf
+
+# as user who is in wheel group
+mkdir -p $HOME/9 $HOME/bin
+cd $HOME/9
+qemu-img -f qcow2 9front.qcow2.img 30G
+wget http://9front.org/iso/9front-5561.df1dc1ff2475.iso.bz2 # adjust for current iso
+bunzip2 9front-5561.df1dc1ff2475.iso.bz2
+mv 9front-5561.df1dc1ff2475.iso 9front.iso
+cd $HOME/bin
+wget http://openbsd.stanleylieber.com/rc/q9
+chmod 775 q9
+cd
+doas -u root q9 -i # boot from iso (install)
+doas -u root q9 # boot from qcow image (after completing the install)
+q9 -v # connect to qemu via vnc
+.P2
.html - <a name="3.3.1.4.3" />
.ihtml h5 <h5>