Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

I have two physical networks, eth0 and eth1, but only eth0 is available for docker containers

Featured Replies

Topic title says it all. I have two ethernet ports on my mobo, which show up as eth0 and eth1 on unraid. I would like some docker containers to interface with only eth0, and others to interface only with eth1, however eth1 does not show up as an option when installing new docker container. Does anyone know how to get eth1 to be an option when creating a container? Screenshots attached, thank you.

Firefox 2025-01-11 11.25.08.jpeg

Firefox 2025-01-11 11.26.31.jpeg

Firefox 2025-01-11 11.27.04.jpeg

image.png

  • Community Expert

Post a screenshot from the docker settings, with advanced view enabled.

 

P.S. you should remove the gateway from eth1, or you can have connectivity issues, also having two NICs in the same subnet is not considered a valid config.

  • Author

Thank you for the advice @JorgeB! I've removed the gateway from eth1, and here are my most recent networking and docker settings. I really appreciate the help.

 

Firefox2025-01-1514_03_58.thumb.jpeg.c5e420275a3dce2098db733bd4a336fd.jpegFirefox2025-01-1514_05_06.thumb.jpeg.d83924c5c23aa53e8a95bd43cadc3207.jpeg

  • Community Expert

in this case I would recommended enabling bonding and have eth0 and eth1 in the bond.

 

While you can make your own docker network. I'm not sure that is what you need atm.

 

image.png.053af513a05e2fd1335304c5d04c1606.png

since both share a ip router to eth0 and there would be a conflict by adding a similar ip route to eth1. This is why I would recommend Bond

?what is the purpose for both eth0 and eth1 plugged in. what are you trying to accomplish?

  • Author

Thanks for the recommendation @bmartino1. What I'm trying to accomplish have some docker containers routed to the clear internet (eth0) and other containers routed through my VPN accelerator (eth1). On my router, I have 192.168.199.162 (eth0) routed to the clear internet and 192.168.199.163 (eth1) routed to my VPN accelerator.

 

I was hoping it would be as easy as telling some containers to use one interface or the other, but that's not the case so far. If there's a better way to accomplish this, I'm open to it! Thanks again.

  • Community Expert

As Jorge said ealier the issue is fighting same subnet.

We would first need to fix or make a additional subnet within your current to use apart from the dhcp server address from and have a new gateway.

as default vlan setups will traverse vlan1 untill told otherwise.

you may need to edit network settings and enable vlans. as we may need to edit some core network settings to accomplish this outside of unriads configurations.

First we need a gateway on eth1 this will be somewhat hard as eth0 is the same gateway and thus bonding was mention to fix this. But bonding will load balance and not separate traffic in this way for your interaction.

after the network settings and eth1 has a gateway and clear route set, we can then make a custom docker network.

##########

 

To fix the issue of routing on the same subnet (192.168.199.0/24) for eth0 and eth1 and configure Unraid to allow Docker containers to route through separate gateways (eth0 for clear internet and eth1 for the VPN), you need to perform the following:

 

Adjust Subnet or VLANs

Since eth0 and eth1 are currently in the same subnet, you need to separate them into different subnets or use VLANs to isolate traffic.

 

Option 1: Use a Different Subnet for eth1

Change the static IP of eth1 to a different subnet, such as 192.168.200.163/24.

Update your router settings to ensure 192.168.200.0/24 routes through the VPN accelerator.

 

Option 2: Use VLANs (if supported by your network)

Assign VLAN IDs to eth0 and eth1 to logically separate traffic on the same physical network.

 

Next Update Unraid Network Settings

After separating the subnets or VLANs:

 

Configure eth1:

Set the IPv4 address assignment for eth1 to Static.

Use the new subnet's IP (e.g., 192.168.200.163/24) and set the default gateway to your VPN accelerator.

 

Update Routing Table:

Ensure the route for the VPN gateway (e.g., 192.168.200.1) is associated with eth1

 

*This way your VPN traffic is clearly a 192.168.200.x network... and yor clearnet traffic is 192.168.199.x traffic...

 

Configure Docker Networks

To direct Docker containers to specific interfaces:

Go to Settings > Docker in Unraid.

Configure custom Docker networks:

Create a custom network (e.g., vpn_network) for containers using the VPN gateway. Use eth1 as the parent interface.

Keep the default bridge network for containers using the clear internet through eth0

 

Assign Docker Containers to Networks

When creating or modifying a container:

Choose the appropriate Docker network:

Use the default network (eth0) for containers on the clear internet.

Use vpn_network for containers you want routed through the VPN

 

image.png.17fddb0f7c7f9fbf0cebf1daaf267737.png

 

docker network create command in unraid.
 

docker network create \
  -d macvlan \
  --subnet=192.168.200.0/24 \
  --gateway=192.168.200.1 \
  -o parent=eth1 \
  vpn_macvlan

Explanation of the Command:

-d macvlan: Specifies the macvlan driver.

--subnet=192.168.200.0/24: Defines the subnet for the macvlan network. Adjust this to match your eth1 subnet.

--gateway=192.168.200.1: Sets the gateway for the macvlan network (your VPN accelerator gateway).

-o parent=eth1: Specifies the parent interface for the macvlan network.

vpn_macvlan: The name of the new macvlan network. (VPN_network earlier above)

 

you can use ipvlan if you want as well... I prefer macvlan myself.

 

but this requires editing your current network settigns outside of unraid.

  • Community Expert

as your current settings due to them both being and having the same ip subnet. Creating a docker network and telling the parent to be eth1 will not have a route off unraid due to IP routes. And the current iproute will conflict with eth0 default route.

Edited by bmartino1
Typo

  • Author

Hey @bmartino1, thank you for your thoughtful and well written advice. Ultimately I couldn't get this to work because my router doesn't properly support subnets or vlans, despite having sections for them in the router settings. I found this out the hard way after ~3 days of attempts at trying to get this to work. Nevertheless, I really appreciate you spending the time to try and help me out, I sent a donation your way.

  • Community Expert

? What router do you have?

...Unraid is not a networking device... but we can leverage it to be one and do things...

I may have a workaround weird weird way to accomplish this ... the issues still comes down to internal ip route issues....
First we need to double-check and setup some things in unraid... we will leverage unraids software bridge to accomplish routes...

Configure Network Interfaces in Unraid
Unraid WebUI > Settings > Network

Turn off bridging turn off bonding... we will be making our own br0 network and these setting will interfere

image.thumb.png.849e4e3223a27983efe87ffccc13df14.png
*It is recommended to static set an ip address for eth0 and eth1 --this will be needed latter.
I will use eth0 192.168.0.254

I will use eth1 192.168.0.253

 

VM Settings I see that your using virbr0 we should change that to vhost... this will simplify docker and vm access to network...

image.thumb.png.5360b3ffa003264011421be8d3305963.png

 

Under docker settings:
I recommend using macvlan as we want software mac address for routing clarifications latter...

image.thumb.png.fded8052466f6979f85679b8f0c547a6.png

 

With this we should have a default macvlan to eth0... this will exist, but not used as we will be making a custom br0 for this latter....

Next lets open the terminal and make our custom bridges..
*You may want to delete existing networks and reboot first...


With bridging off, bonding off, and the default macvlan unraid docker/vm setting. We are ready to make our own br0 networks...


Create the Bridge Interfaces and attach eth0/eth1
 

brctl addbr br0
brctl addif br0 eth0
brctl addbr br1
brctl addif br1 eth1


Next lets add our own br0/br1 ip dhcp 

 

ip addr add 192.168.1.1/24 dev br0
ip addr add 192.168.2.1/24 dev br1


Lets make sure the interface are up now.

ip link set dev eth0 up
ip link set dev br0 up
ip link set dev eth1 up
ip link set dev br1 up


so now br0 routes its traffic to eth0 and will be clear net. dockers can be set to a 192.168.1.x address latter when we make the docker network...
so now br1 routes its traffic to eth1 and will be vpn net. dockers can be set to a 192.168.2.x address latter when we make the docker network...

*-- ip routes should show br0 to eth0 br1 to eth1 which is what your fighting...

Verify as the unriad webui may not reflect everything...

brctl show
ip addr show
ip route

....

with confirmed lan ip and bridge shown, we are now ready to make a docker network 

Lets use macvlan...
 

docker network create -d macvlan \
  --subnet=192.168.1.0/24 \
  --gateway=192.168.1.1 \
  --ip-range=192.168.1.100/25 \
  -o parent=br0 \
  macvlan_br0

Explanation:

--subnet=192.168.1.0/24: The subnet for this network.

--gateway=192.168.1.1: Gateway of the subnet (IP of br0).

--ip-range=192.168.1.100/25: DHCP range starts at 192.168.1.100 and ends at 192.168.1.255.

-o parent=br0: Binds the macvlan network to the br0 interface.

macvlan_br0: Name of the Docker network.

 

docker network create -d macvlan \
  --subnet=192.168.2.0/24 \
  --gateway=192.168.2.1 \
  --ip-range=192.168.2.100/25 \
  -o parent=br1 \
  macvlan_br1

Explanation:

--subnet=192.168.2.0/24: The subnet for this network.

--gateway=192.168.2.1: Gateway of the subnet (IP of br1).

--ip-range=192.168.2.100/25: DHCP range starts at 192.168.2.100 and ends at 192.168.2.255.

-o parent=br1: Binds the macvlan network to the br1 interface.

macvlan_br1: Name of the Docker network.

 

verfy docker networks:
docker network ls

in theory, using software bridges this way you can isolate and use the interface with their own subnet.

otherwise, with br0 and br1 we will need to make a vm router to control this...
 

Edited by bmartino1
Typo

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.