Docker Community Forums

Share and learn in the Docker community.

How to bind a bridge to a specific NIC?


(Toontje) #1

Not so new to Docker, but not nearly an expert either.
I am trying to build a Docker environment where a custom bridge is connected to a specific NIC.
The use case is to have a dedicated isolated lab network running on a separate interface eth1 on my PC with devices and services which cannot see nor interfere with the office/production network which is running on eth0. One of the containers i am going to run is a DHCP server and i only want to give out IP addresses on eth1. Obviously I don’t want to give out IP addresses to the rest of the office over eth0.
I have been reading documentation, watching videos, doing online trainings, reading blogs. To me, what i want to achieve is something very basic, but i cannot seem to find how to do this.
Any ideas?


#2

I think you will need to do this with your firewall/iptables as opposed to relying on docker. I had to setup something similar due to VPN requirements. If you’re interested my recent post may be of use to you.

Basically you turn off docker’s iptable manipulation and then configure your own rules to keep things running without the hidden black magic.