Sign inSign up

ncsurfus/ethbridge

By ncsurfus

Updated about 2 years ago

A terrible way to get a linux bridge from the container to the host.

Image
0

6.8K

ncsurfus/ethbridge repository overview

ethbridge

This is a "sidecar" container that will create a vETH to a bridge on the host (or network namespace of your choosing) and the container. Additionally, this sidecar can also create a bridge inside the container and attach the container's vETH to the bridge. The sidecar can assign IP/Gateway information to the container's vETH or bridge. By configuring the host to use a bridge as its main source of connectivity, then this basically acts similar to macvlan, except the behavior is closer to a normal interface - and gives you total control over the network configuration. You can also configure mac addresses and enable IPv6 autoconf.

Should you use this?

Probably not, unless you have reasons not to use the host network mode and you want a hacked up solution that should've been a docker plugin.

docker-compose example

Make sure to include --always-recreate-deps in your command so the sidecar is replaced anytime your container is replaced.

docker-compose up -d --always-recreate-deps

version: "3"
services:
  gns3: # your container here
    image: ncsurfus/gns3:latest
    restart: unless-stopped
    network_mode: none # Don't need one! The sidecar creates it!

  ethbridge:
    image: ncsurfus/ethbridge:latest
    restart: unless-stopped
    privileged: true
    network_mode: service:gns3 
    pid: service:gns3
    environment:
      - HOST_BRIDGE=br0
      - IP=192.168.88.235/24 # IPv6 coming soon!
      - GATEWAY=192.168.88.1
      - IPv6=autoconf
      - MAC=00:0f:4b:00:00:01
      - USE_CONTAINER_BRIDGE=True # If true, then the container gets it's own br0
    volumes:
      - /proc/1/ns/net:/var/run/netns/host # Any namespace works, just map it to: /var/run/netns/host

Tag summary

Content type

Image

Digest

sha256:70f0984c4

Size

168.3 MB

Last updated

about 2 years ago

docker pull ncsurfus/ethbridge:alt-20240821