Jump to content
ZataH

Docker fixed IP not working

10 posts in this topic Last Reply

Recommended Posts

I cant get fixed ip to work.

image.thumb.png.863d0745d72a7d4685bba0d23be4b30f.png

If I bash into the container. It show the correct IP, but I cant ping the gateway or internet. 

 

image.thumb.png.d076f93466fb649b6bc442d82235ab3f.png

Share this post


Link to post

What is the output of

docker network inspect br0

 

Share this post


Link to post
root@UNRAID:~# docker network inspect br0
[
    {
        "Name": "br0",
        "Id": "4727b45330d87b6e9a0cd5c591976f046661a7af882454365108f8e8d783f6ac",
        "Created": "2018-04-14T01:31:36.046721335+02:00",
        "Scope": "local",
        "Driver": "macvlan",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "192.168.88.0/24",
                    "IPRange": "192.168.88.64/27",
                    "Gateway": "192.168.88.1",
                    "AuxiliaryAddresses": {
                        "server": "192.168.88.18"
                    }
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "864251751e85bc3cdb3daee227d879c66c3f938437e93a53c2eab524cc6ad34b": {
                "Name": "muximux",
                "EndpointID": "da24bc53dc0582d7a38871a13834ee060a9e22bbcddd5c130aa6816f7980805a",
                "MacAddress": "02:42:c0:a8:58:55",
                "IPv4Address": "192.168.88.85/24",
                "IPv6Address": ""
            }
        },
        "Options": {
            "parent": "br0"
        },
        "Labels": {}
    }
]

 

Share this post


Link to post

The DHCP range for your containers is set as 192.168.88.64/27, which means a range from 192.168.88.64 to .95

 

When you assign a fixed address it should be outside the DHCP range to avoid possible conflicts. Instead of .85 take another number. Also keep in mind that this number should not fall in the DHCP range as set on your router.

 

Share this post


Link to post
5 minutes ago, bonienl said:

The DHCP range for your containers is set as 192.168.88.64/27, which means a range from 192.168.88.64 to .95

 

When you assign a fixed address it should be outside the DHCP range to avoid possible conflicts. Instead of .85 take another number. Also keep in mind that this number should not fall in the DHCP range as set on your router.

 

I had it without DHCP at first, but tried to activate it, since it didnt work.

docker inspect without dhcp

root@UNRAID:~# docker network inspect br0
[
    {
        "Name": "br0",
        "Id": "946d6ee3adc17818128233f82f290f17909787f82ac9ca0acd7cb9ab6d4b4c55",
        "Created": "2018-04-14T11:25:32.688558138+02:00",
        "Scope": "local",
        "Driver": "macvlan",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "192.168.88.0/24",
                    "Gateway": "192.168.88.1",
                    "AuxiliaryAddresses": {
                        "server": "192.168.88.18"
                    }
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "e95b0404137f8e295b6105dcef72ca103c2f665f0ef3aeb51751d8662b7f9480": {
                "Name": "muximux",
                "EndpointID": "43a95bc4d0e5ba78ee94ce409910edb0048d1b392901f6a1633f79979edfeca5",
                "MacAddress": "02:42:c0:a8:58:55",
                "IPv4Address": "192.168.88.85/24",
                "IPv6Address": ""
            }
        },
        "Options": {
            "parent": "br0"
        },
        "Labels": {}
    }
]

 And still doesnt work 

Share this post


Link to post

How does the routing look like from inside your container?

docker exec -it muximux bash
$ route -n

This is an example from my container

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.101.1      0.0.0.0         UG    0      0        0 eth0
10.0.101.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0

 

Share this post


Link to post
root@e95b0404137f:/$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.88.1    0.0.0.0         UG    0      0        0 eth0
192.168.88.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0

 

Share this post


Link to post

Everything on the unRAID side looks fine and is set as expected.

 

Perhaps it is an issue on your router? Does it have any firewall rules which may prevent communication?

 

Share this post


Link to post
On 14/04/2018 at 11:47 AM, bonienl said:

Everything on the unRAID side looks fine and is set as expected.

 

Perhaps it is an issue on your router? Does it have any firewall rules which may prevent communication?

 

 

Just wanted to give an update on this.

When I started the thread I was running UnRAID through vmware.

I have since then migrated to physical. And now it is working fine. So maybe vmware was blocking it somehow. 

Share this post


Link to post

There's a setting in most variants of vmware that prevents unknown/generated MAC addresses from appearing and working on a vswitch port connected to a VM.

That's what was probably blocking your docker network from working.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now