Jump to content

how to create another docker bridge to a different LAN ip?


Go to solution Solved by Tracenji,

Recommended Posts

Unraid: 6.12.4

 

hello, i recently installed unraid on a pc

there is a docker application i want to run but in order to access it like i want to i will have to run another docker so i cannot just run with direct access to physical LAN, but i would still like a different physical LAN adress

one of the ports of the docker is also used by an existing docker but i do not wish to change any of the ports

so how can i create another docker bridge with port mapping to a different physical LAN ip that is not the host ip? (if possible)


so if host IP was 192.168.1.100 and the default mapping would be 172.17.0.2:1000 -> 192.168.1.100:1000

how could i make a docker bridge that would be something like    172.18.0.2:1000 -> 192.168.1.150:1000

Link to comment
  • Solution

UPDATE: i managed to do it

 

managed to do it using a user script (plugin available in community apps)

user script runs at first array start with the command

ip addr add 192.168.1.150/24 dev br0

and then i also created a docker network by running this command in the unraid web terminal

docker network create --driver=bridge --opt com.docker.network.bridge.host_binding_ipv4=192.168.1.150 --opt com.docker.network.bridge.name=192.168.1.150 192.168.1.150

and now i have a custom network called "192.168.1.150" available in my docker configurations

 

NOTE: the Bridge network that comes with unraid does not bind to a specific IP, that means if a port is used by another docker bridge network then it will fail as the port is already bound, to avoid this, repeat the steps above with the host ip or a different IP, e.g. 192.168.1.200 (i did not test with the hosts ip address but i do not see any reason it would not work)

 

NOTE 2: you may want to reserve the IP addresses you add in your DHCP server (usually your router) so that other devices do not get assigned those IPs, just reserve them to some unused MAC address like 11:11:11:11:11:11

Edited by Tracenji
added NOTE 2
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...