How to bind a Docker bridge to a specific NIC?
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?
networking docker
add a comment |
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?
networking docker
add a comment |
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?
networking docker
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?
networking docker
networking docker
asked Jan 11 at 13:08
Ton MachielsenTon Machielsen
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
For your issue, I think you can try to create a bridge and bind it to the NIC eht1. The steps will like this:
edit the eth1 config file ifcfg-eth1:

edit the bridge br0 config file ifcfg-br0:

restart the network service:
service network restart
find your docker config file and change the
DOCKER_NETWORK_OPTIONSinto:
DOCKER_NETWORK_OPTIONS="-b=br0"
restart your docker server
create your docker with no network:
docker run -itd --net=none --name=dockerName yourImage
set the network for your container and you need to install the tool pipework
git clone https://github.com/jpetazzo/pipework
cp ~/pipework/pipework /usr/local/bin/
pipework br0 dockerName 192.168.0.11/24@192.168.0.141
Note: the container's IP address is 192.168.0.11, the netmask is 24, and the gateway is 192.168.0.141. You can change some setting according to your requirement. Hope this will help you.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1393160%2fhow-to-bind-a-docker-bridge-to-a-specific-nic%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
For your issue, I think you can try to create a bridge and bind it to the NIC eht1. The steps will like this:
edit the eth1 config file ifcfg-eth1:

edit the bridge br0 config file ifcfg-br0:

restart the network service:
service network restart
find your docker config file and change the
DOCKER_NETWORK_OPTIONSinto:
DOCKER_NETWORK_OPTIONS="-b=br0"
restart your docker server
create your docker with no network:
docker run -itd --net=none --name=dockerName yourImage
set the network for your container and you need to install the tool pipework
git clone https://github.com/jpetazzo/pipework
cp ~/pipework/pipework /usr/local/bin/
pipework br0 dockerName 192.168.0.11/24@192.168.0.141
Note: the container's IP address is 192.168.0.11, the netmask is 24, and the gateway is 192.168.0.141. You can change some setting according to your requirement. Hope this will help you.
add a comment |
For your issue, I think you can try to create a bridge and bind it to the NIC eht1. The steps will like this:
edit the eth1 config file ifcfg-eth1:

edit the bridge br0 config file ifcfg-br0:

restart the network service:
service network restart
find your docker config file and change the
DOCKER_NETWORK_OPTIONSinto:
DOCKER_NETWORK_OPTIONS="-b=br0"
restart your docker server
create your docker with no network:
docker run -itd --net=none --name=dockerName yourImage
set the network for your container and you need to install the tool pipework
git clone https://github.com/jpetazzo/pipework
cp ~/pipework/pipework /usr/local/bin/
pipework br0 dockerName 192.168.0.11/24@192.168.0.141
Note: the container's IP address is 192.168.0.11, the netmask is 24, and the gateway is 192.168.0.141. You can change some setting according to your requirement. Hope this will help you.
add a comment |
For your issue, I think you can try to create a bridge and bind it to the NIC eht1. The steps will like this:
edit the eth1 config file ifcfg-eth1:

edit the bridge br0 config file ifcfg-br0:

restart the network service:
service network restart
find your docker config file and change the
DOCKER_NETWORK_OPTIONSinto:
DOCKER_NETWORK_OPTIONS="-b=br0"
restart your docker server
create your docker with no network:
docker run -itd --net=none --name=dockerName yourImage
set the network for your container and you need to install the tool pipework
git clone https://github.com/jpetazzo/pipework
cp ~/pipework/pipework /usr/local/bin/
pipework br0 dockerName 192.168.0.11/24@192.168.0.141
Note: the container's IP address is 192.168.0.11, the netmask is 24, and the gateway is 192.168.0.141. You can change some setting according to your requirement. Hope this will help you.
For your issue, I think you can try to create a bridge and bind it to the NIC eht1. The steps will like this:
edit the eth1 config file ifcfg-eth1:

edit the bridge br0 config file ifcfg-br0:

restart the network service:
service network restart
find your docker config file and change the
DOCKER_NETWORK_OPTIONSinto:
DOCKER_NETWORK_OPTIONS="-b=br0"
restart your docker server
create your docker with no network:
docker run -itd --net=none --name=dockerName yourImage
set the network for your container and you need to install the tool pipework
git clone https://github.com/jpetazzo/pipework
cp ~/pipework/pipework /usr/local/bin/
pipework br0 dockerName 192.168.0.11/24@192.168.0.141
Note: the container's IP address is 192.168.0.11, the netmask is 24, and the gateway is 192.168.0.141. You can change some setting according to your requirement. Hope this will help you.
answered Jan 14 at 9:10
Charles Xu - MSFTCharles Xu - MSFT
2584
2584
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1393160%2fhow-to-bind-a-docker-bridge-to-a-specific-nic%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown