Hello,
I have a server with many services which I will move into docker for handling of different network interfaces. I need a fixed IP address and a fixed MAC address for every service to configure the Fitz!Box VPN access. The Fritz!Box can only filter on hand of the MAC address and configured it on hand of the IP address. It is not fine, but I can’t change it.
Now I’ve started my first test with ngix docker (simpel with default page):
tester@a1:~/docker run --name my-nginx -d -p 8080:80 nginx
tester@a1:~/docker$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8f1b8aa094d5 nginx "/docker-entrypoint.…" 10 seconds ago Up 9 seconds 0.0.0.0:8080->80/tcp, [::]:8080->80/tcp my-nginx
This can I test with open the webpage 192.168.7.27:8080, where the IP is the host IP. And this work.
After this I create my own network with:
tester@a1:~/docker network create -d macvlan --subnet=192.168.7.0/24 --gateway=192.168.7.1 -o parent=eno2 net-nginx
tester@a1:~/docker$ docker network ls
NETWORK ID NAME DRIVER SCOPE
f754992ec3d7 bridge bridge local
f4e13623c4cf host host local
7d460c43eb8f net-nginx macvlan local
8504b0e350b3 none null local
Now start nginx to a fixed IP address in the new network:
tester@a1:~/docker$ docker run --net net-nginx --ip 192.168.7.111 --name my-nginx-111 -d -p 8080:80 nginx
The test with open the webpage fails!
The network self is correct configured for me:
tester@a1:~/docker$ docker network inspect net-nginx
[
{
"Name": "net-nginx",
"Id": "8c8eeab402ed626a49e9aeffeed53d503a2436d071df1398c1ffa596b0defd0a",
"Created": "2025-03-20T12:51:26.047235535+01:00",
"Scope": "local",
"Driver": "macvlan",
"EnableIPv4": true,
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "192.168.7.0/24",
"Gateway": "192.168.7.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"bbcf972d9ea33ccb5fdf64eda2986f3bd9af043195c8ecbf06562148bdbf02bf": {
"Name": "my-nginx-111",
"EndpointID": "30e268295350da9423ea01717b6e3e19213cc5f3bb197857e22ee3d3bd3961bc",
"MacAddress": "0e:5d:6e:3e:75:98",
"IPv4Address": "192.168.7.111/24",
"IPv6Address": ""
}
},
"Options": {
"parent": "eno2"
},
"Labels": {}
}
]
Now I will test it with ping, it is easier and faster. So I’ve generate a debian docker with a fixed IP address:
tester@a1:~/docker$ docker run -it --name my-debian --net net-nginx --ip 192.178.7.111 -P debian bash
In the bash of the docker I can ping my other machines in the network. That works. A ping from a other machine to the my-debian dosn’t work.
What I missing is the port configuration of booth not working machine:
tester@a1:~/docker$ docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b24666900b04 debian "bash" 12 minutes ago Created my-debian
bbcf972d9ea3 nginx "/docker-entrypoint.…" 19 minutes ago Up 19 minutes my-nginx-111
c1f1e206058d nginx "/docker-entrypoint.…" 22 minutes ago Up 22 minutes 0.0.0.0:32768->80/tcp, [::]:32768->80/tcp my-nginx
All three containers create with -P and only the my-nginx have a port configuration.
What must I do that works? And how can I configure the MAC address?
Thanks for our help,
Bernd