Skip to content

Instantly share code, notes, and snippets.

@shreddedbacon
Last active September 12, 2018 01:22
Show Gist options
  • Save shreddedbacon/349f478a6769b43d00b6501897d1d03d to your computer and use it in GitHub Desktop.
Save shreddedbacon/349f478a6769b43d00b6501897d1d03d to your computer and use it in GitHub Desktop.
a gist to set up bridged network for a BOSH director in vbox

create release

git clone https://github.com/cppforlife/bosh-virtualbox-cpi-release.git && cd bosh-virtualbox-cpi-release
git checkout bridged
bosh create-release --force --tarball /tmp/vbox-cpi-release

set up ops file

---
- type: replace
  path: /releases/name=bosh-virtualbox-cpi
  value:
    name: bosh-virtualbox-cpi
    url: file:///tmp/vbox-cpi-release 

- type: replace
  path: /networks/name=default/subnets/0/cloud_properties?
  value:
    type: bridged
    name: eno1

modify director vars file

vars file needs an IP in your LAN to assign to NatNetwork

internal_ip: 10.1.1.90
internal_gw: 10.1.1.1
internal_cidr: 10.1.1.0/24
outbound_network_name: NatNetwork

https://bosh.io/docs/warden-cpi/#resource-pools

VM Types / VM Extensions

Schema for cloud_properties section:

  • ports [Array, optional]: Allows to define port mapping between host and associated containers. Available in v30+.
  • host [String, required]: Port or range of ports. Example: 80.
  • container [String, optional]: Port or range of ports. Defaults to host defined port or range. Example: 80.
  • protocol [String, optional]: Connection protocol. Defaults to tcp. Example: udp.

We may add simple load balancing via iptables for testing if ports is forwarded to multiple containers.

Example:

vm_extensions:
- name: external-access
  cloud_properties:
    ports:
    # Forward 80 to 80 tcp
    - host: 80
    # Forward 443 to 8443 tcp
    - host: 443
      container: 8443
    # Forward 53 to 53 udp
    - host: 53
      protocol: udp
    # Forward 1000-2000 to 1000-2000 tcp
    - host: 1000-2000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment