diff --git a/docs/drivers/virtualbox.md b/docs/drivers/virtualbox.md index c35a73c26d..a8261426b2 100644 --- a/docs/drivers/virtualbox.md +++ b/docs/drivers/virtualbox.md @@ -29,6 +29,8 @@ Options: - `--virtualbox-boot2docker-url`: The URL of the boot2docker image. Defaults to the latest available version. - `--virtualbox-import-boot2docker-vm`: The name of a Boot2Docker VM to import. - `--virtualbox-hostonly-cidr`: The CIDR of the host only adapter. + - `--virtualbox-hostonly-nictype`: Host Only Network Adapter Type. Possible values are are '82540EM' (Intel PRO/1000), 'Am79C973' (PCnet-FAST III) and 'virtio-net' Paravirtualized network adapter. + - `--virtualbox-hostonly-nicpromisc`: Host Only Network Adapter Promiscuous Mode. Possible options are deny , allow-vms, allow-all - `--virtualbox-no-share`: Disable the mount of your home directory The `--virtualbox-boot2docker-url` flag takes a few different forms. By @@ -59,12 +61,14 @@ upper bound of `192.168.24.254`. Environment variables and default values: -| CLI option | Environment variable | Default | -|--------------------------------------|------------------------------|--------------------------| -| `--virtualbox-memory` | `VIRTUALBOX_MEMORY_SIZE` | `1024` | -| `--virtualbox-cpu-count` | `VIRTUALBOX_CPU_COUNT` | `1` | -| `--virtualbox-disk-size` | `VIRTUALBOX_DISK_SIZE` | `20000` | -| `--virtualbox-boot2docker-url` | `VIRTUALBOX_BOOT2DOCKER_URL` | *Latest boot2docker url* | -| `--virtualbox-import-boot2docker-vm` | - | `boot2docker-vm` | -| `--virtualbox-hostonly-cidr` | `VIRTUALBOX_HOSTONLY_CIDR` | `192.168.99.1/24` | -| `--virtualbox-no-share` | - | `false` | +| CLI option | Environment variable | Default | +|--------------------------------------|-----------------------------------|--------------------------| +| `--virtualbox-memory` | `VIRTUALBOX_MEMORY_SIZE` | `1024` | +| `--virtualbox-cpu-count` | `VIRTUALBOX_CPU_COUNT` | `1` | +| `--virtualbox-disk-size` | `VIRTUALBOX_DISK_SIZE` | `20000` | +| `--virtualbox-boot2docker-url` | `VIRTUALBOX_BOOT2DOCKER_URL` | *Latest boot2docker url* | +| `--virtualbox-import-boot2docker-vm` | - | `boot2docker-vm` | +| `--virtualbox-hostonly-cidr` | `VIRTUALBOX_HOSTONLY_CIDR` | `192.168.99.1/24` | +| `--virtualbox-hostonly-nictype` | `VIRTUALBOX_HOSTONLY_NIC_TYPE` | `82540EM` | +| `--virtualbox-hostonly-nicpromisc` | `VIRTUALBOX_HOSTONLY_NIC_PROMISC` | `deny` | +| `--virtualbox-no-share` | - | `false` | diff --git a/drivers/virtualbox/virtualbox.go b/drivers/virtualbox/virtualbox.go index 0cd138ac7b..c7dab3e691 100644 --- a/drivers/virtualbox/virtualbox.go +++ b/drivers/virtualbox/virtualbox.go @@ -29,6 +29,8 @@ import ( const ( isoFilename = "boot2docker.iso" defaultHostOnlyCIDR = "192.168.99.1/24" + defaultNictype = "82540EM" + defaultNicpromisc = "deny" ) var ( @@ -43,6 +45,8 @@ type Driver struct { Boot2DockerURL string Boot2DockerImportVM string HostOnlyCIDR string + HostOnlyNicType string + HostOnlyPromiscMode string NoShare bool } @@ -92,6 +96,18 @@ func GetCreateFlags() []cli.Flag { Value: defaultHostOnlyCIDR, EnvVar: "VIRTUALBOX_HOSTONLY_CIDR", }, + cli.StringFlag{ + Name: "virtualbox-hostonly-nictype", + Usage: "Specify the Host Only Network Adapter Type", + Value: defaultNictype, + EnvVar: "VIRTUALBOX_HOSTONLY_NIC_TYPE", + }, + cli.StringFlag{ + Name: "virtualbox-hostonly-nicpromisc", + Usage: "Specify the Host Only Network Adapter Promiscuous Mode", + Value: defaultNicpromisc, + EnvVar: "VIRTUALBOX_HOSTONLY_NIC_PROMISC", + }, cli.BoolFlag{ Name: "virtualbox-no-share", Usage: "Disable the mount of your home directory", @@ -142,6 +158,8 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error { d.SSHUser = "docker" d.Boot2DockerImportVM = flags.String("virtualbox-import-boot2docker-vm") d.HostOnlyCIDR = flags.String("virtualbox-hostonly-cidr") + d.HostOnlyNicType = flags.String("virtualbox-hostonly-nictype") + d.HostOnlyPromiscMode = flags.String("virtualbox-hostonly-nicpromisc") d.NoShare = flags.Bool("virtualbox-no-share") return nil @@ -624,7 +642,8 @@ func (d *Driver) setupHostOnlyNetwork(machineName string) error { if err := vbm("modifyvm", machineName, "--nic2", "hostonly", - "--nictype2", "82540EM", + "--nictype2", d.HostOnlyNicType, + "--nicpromisc2", d.HostOnlyPromiscMode, "--hostonlyadapter2", hostOnlyNetwork.Name, "--cableconnected2", "on"); err != nil { return err