Jump to content

Define Docker Incoming/Outgoing - Interface/VLAN/IP


Recommended Posts

Hey everyone,

i want to use a specific IP Address on an ETH Interface or an VLAN for the outgoing connections for my dockers.

As default the containers using the default eth0 IP Address from unraid with the Default Gateway.

 

I would like to achieve 2 things. All container incoming and outgoing traffic should be running on an specific IP Adress on an eth Interface or better an VLAN.

 

Example:

ETH0 = 192.168.0.1/24

ETH1 = 172.16.0.1/24

 

Default behavior: The containers use the ETH0 IP (192.168.0.1) for all outgoing traffic.
The incoming traffic would work on eth0 and eth1 as i see in my tests.

 

Wanted behavior: The containers connect to the outside with the ETH1 IP (172.16.0.0) and preferable are only accessible through the eth1 ip.

 

Please dont point me in the direction, to specify the container a local IP addresses directly (macvlan) from the local network, i want to use the custom_bridge functions and cant use dedicated IP Addresses from the local network.

 

I found some information to that, but i dont know how to achieve this in unraid, as i read this could be possible now also with ipvlan.

 

https://stackoverflow.com/a/32054957

Quote

If you want to be more restrictive and only allow container services to be contacted through a specific external interface on the host machine, you have two choices. When you invoke docker run you can use either -p IP:host_port:container_port or -p IP::port to specify the external interface for one particular binding. Or if you always want Docker port forwards to bind to one specific IP address, you can edit your system-wide Docker server settings and add the option --ip=IP_ADDRESS. Remember to restart your Docker server after editing this setting.

 

https://medium.com/@havloujian.joachim/advanced-docker-networking-outgoing-ip-921fc3090b09

https://docs.docker.com/network/ipvlan/

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...