<p>I gave up on finding a particularly clean solution and enabled host networking. In order to prevent port conflicts, I set up iptables forwarding and masquerade rules that switch the ports around behind the scenes depending on what IP address and port traffic is sent to or from.</p>
<p>This works for accessing the software GUI (it defaults to typical HTTPS port but can be reassigned with an environment variable) but not for all other features. Thankfully I can update the latency sensitive traffic ports as well. I wish there was a better way, but this does resolve my MTU issue, even if it is messy and imperfect.</p>

CC BY-SA 4.0
2024-03-12T02:00:44.740Z
2024-03-12T02:02:41.100Z
2024-03-12T02:02:41.100Z
user23564615
<p>I am attempting to run multiple (we'll say 2) instances of software in docker. This software is proprietary and 3rd party, so modifying it is not an option, and neither is using docker exec or attach to make changes from inside the containers.</p>
<p>The software in question launches a web GUI at port 80. It also receives traffic on port 50000. The traffic we expect to send to port 50000 is extremely latency sensitive and at 10G.</p>
<p>The host has multiple interfaces:</p>
<pre><code>bond0 172.16.2.10 
bond0:0 172.16.2.20
bond0:1 172.16.2.21
em3 172.16.3.10
em4 172.16.4.10
</code></pre>
<p>Bond0 is the host's primary connection to the LAN. The aliases 0 and 1 are there because we're running 2 copies of the software, and for simplicity it made sense if they each have their own IP. This might be the wrong approach, so I can remove these aliases if needed.</p>
<p>EM3 and 4 are fiber connections directly to an appliance that will be sending the 10G latency sensitive traffic on port 50000. EM3 is designated for the first instance and EM4 for the second. These assignments are physical and cannot be changed, but if I need to change the configuration of these connections that is fine.</p>
<p>Originally I used the default bridge network for all of this, mapping specific ports and IPs to each container. This worked excellently for connecting at first, the web UIs were accessible and the fiber connections were up. However, I ran into issues soon after: Docker's bridge network driver is limited to 1500 MTU, and the traffic headed over EM3 and EM4 requires an MTU of 9000. Attempts to set the bridge network at MTU 9000 using daemon.json or spinning up a new bridge network have proven unsuccessful.</p>
<p>I really would like to use <code>net=host</code> for these containers, but port conflicts would immediately occur and not all of the ports that the software requires are customizable. There is no way in the software to bind to specific network interfaces. I also explored <code>macvlan_mode=passthru</code>, setting up a macvlan for each network interface and assigning the relevant ones to containers, but I am not sure if this is the right path.</p>
<p>Anyone have any ideas?</p>

CC BY-SA 4.0
2024-03-12T01:23:02.250Z
[This article](https://www.civo.com/learn/fixing-networking-for-docker) suggests how to change the MTU used in Docker containers. I am not able to test this myself at the moment.
larsks
CC BY-SA 4.0
2024-03-12T01:56:52.623Z
Yes, I've reviewed that article in my search for a soluton. It works fine for switching between MTUs that docker's bridge driver supports (anything 1500 and below), but is not effective for enabling jumbo frames.
user23564615
<docker><networking>
How to run multiple identical docker containers using jumbo frames?
user23564615
# How to run multiple identical docker containers using jumbo frames?

(Asked by: username_0 on 2024-03-09)

I am attempting to run multiple (we'll say 2) instances of software in docker. This software is proprietary and 3rd party, so modifying it is not an option, and neither is using docker exec or attach to make changes from inside the containers.
The software in question launches a web GUI at port 80. It also receives traffic on port 50000. The traffic we expect to send to port 50000 is extremely latency sensitive and at 10G.
The host has multiple interfaces:
bond0 172.16.2.10 
bond0:0 172.16.2.20
bond0:1 172.16.2.21
em3 172.16.3.10
em4 172.16.4.10

Bond0 is the host's primary connection to the LAN. The aliases 0 and 1 are there because we're running 2 copies of the software, and for simplicity it made sense if they each have their own IP. This might be the wrong approach, so I can remove these aliases if needed.
EM3 and 4 are fiber connections directly to an appliance that will be sending the 10G latency sensitive traffic on port 50000. EM3 is designated for the first instance and EM4 for the second. These assignments are physical and cannot be changed, but if I need to change the configuration of these connections that is fine.
Originally I used the default bridge network for all of this, mapping specific ports and IPs to each container. This worked excellently for connecting at first, the web UIs were accessible and the fiber connections were up. However, I ran into issues soon after: Docker's bridge network driver is limited to 1500 MTU, and the traffic headed over EM3 and EM4 requires an MTU of 9000. Attempts to set the bridge network at MTU 9000 using daemon.json or spinning up a new bridge network have proven unsuccessful.
I really would like to use net=host for these containers, but port conflicts would immediately occur and not all of the ports that the software requires are customizable. There is no way in the software to bind to specific network interfaces. I also explored macvlan_mode=passthru, setting up a macvlan for each network interface and assigning the relevant ones to containers, but I am not sure if this is the right path.
Anyone have any ideas?

**Tags:** docker, networking

> **Comments:**
> **username_1**: [This article](https://www.civo.com/learn/fixing-networking-for-docker) suggests how to change the MTU used in Docker containers. I am not able to test this myself at the moment.  
> **username_0**: Yes, I've reviewed that article in my search for a soluton. It works fine for switching between MTUs that docker's bridge driver supports (anything 1500 and below), but is not effective for enabling jumbo frames.  

---

## 1 answers

### Answer by username_0 on 2024-03-12. Score: 0 | Accepted answer

I gave up on finding a particularly clean solution and enabled host networking. In order to prevent port conflicts, I set up iptables forwarding and masquerade rules that switch the ports around behind the scenes depending on what IP address and port traffic is sent to or from.

This works for accessing the software GUI (it defaults to typical HTTPS port but can be reassigned with an environment variable) but not for all other features. Thankfully I can update the latency sensitive traffic ports as well. I wish there was a better way, but this does resolve my MTU issue, even if it is messy and imperfect.


---

