Add vmnet support to linuxkit run hyperkit

Allows routed networking, so long as you runhyperkit as root.

This has quite a few downsides, including the requirement to
run as root in order to set up the networking, but some people
really want VMs that are routable from the host.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack
2017-06-16 10:54:32 -07:00
parent dc2bd181bb
commit c20f10f7f8
3 changed files with 14 additions and 2 deletions

View File

@@ -98,6 +98,9 @@ type HyperKit struct {
// VSock guest CID
VSockGuestCID int `json:"vsock_guest_cid"`
// VMNet whether to create vmnet network
VMNet bool `json:"vmnet"`
// 9P sockets
Sockets9P []Socket9P `json:"9p_sockets"`
@@ -415,6 +418,11 @@ func (h *HyperKit) buildArgs(cmdline string) {
nextSlot++
}
if h.VMNet {
a = append(a, "-s", fmt.Sprintf("%d:0,virtio-net", nextSlot))
nextSlot++
}
if h.UUID != "" {
a = append(a, "-U", h.UUID)
}