"Automatically Connect" and Static vs Dynamic IP addresses

Issues related to configuring your network
Post Reply
darcyr
Posts: 6
Joined: 2020/01/24 15:16:58

"Automatically Connect" and Static vs Dynamic IP addresses

Post by darcyr » 2020/11/24 00:53:57

Hello!

I have been encountering this strange issue where we would set a static IP on an ethernet port, and when we restart the device, it suddenly swaps over to dynamic / DHCP.

What could cause this?

I wanted to check in on the "Automatically Connect" checkbox - does this mean that it will *try* to connect using the given settings, or that it will try to connect with whatever setting is set, and if it fails, try with DHCP?

I have been getting very frustrated with some networking teams as we try to install devices, running into all kinds of IP address issues.

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: "Automatically Connect" and Static vs Dynamic IP addresses

Post by jlehtone » 2020/11/24 14:59:01

darcyr wrote:
2020/11/24 00:53:57
we set a static IP on an ethernet port, and when we restart the device, it suddenly swaps over to dynamic / DHCP.
How do you set the IP?


PS. My preferred method to set static IP is by DHCP server handing out predetermined address for the device.

darcyr
Posts: 6
Joined: 2020/01/24 15:16:58

Re: "Automatically Connect" and Static vs Dynamic IP addresses

Post by darcyr » 2020/11/24 17:15:06

jlehtone wrote:
2020/11/24 14:59:01
darcyr wrote:
2020/11/24 00:53:57
we set a static IP on an ethernet port, and when we restart the device, it suddenly swaps over to dynamic / DHCP.
How do you set the IP?


PS. My preferred method to set static IP is by DHCP server handing out predetermined address for the device.
We are setting it using `nmtui`.

For your preferred method to set static IP, does this mean that the eth device is set to DHCP but theoretically ends up receiving a static one consistently?

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: "Automatically Connect" and Static vs Dynamic IP addresses

Post by jlehtone » 2020/11/24 19:04:13

darcyr wrote:
2020/11/24 17:15:06
We are setting it using `nmtui`.
That should make it stick.

You can list config with 'nmcli'.

Code: Select all

nmcli      # shows summary
nmcli d s  # shows device status
nmcli c s  # shows connections
When you know the name of UUID of connection (shown with nmcli c s) you can look details of one connection:

Code: Select all

nmcli c s conn_name  # all config
nmcli -f ipv4 c s conn_name  # just the 'ipv4' nm-settings
Note that when address is set manually (ipv4.method manual ipv4.addresses 1.2.3.4/5) the system will first shout (broadcast) out "Does anyone have 1.2.3.4 in use?" so that it won't cause address collision.

For your preferred method to set static IP, does this mean that the eth device is set to DHCP but theoretically ends up receiving a static one consistently?
Yes. The clients use DHCP to get config from server.
The server hands out specific address based on identifier (MAC address) of the client. (And only MACs known to the server do get address.)

The default "home DHCP" is set to give next available address from a pool to anyone.
While even that might tend to hand same address, there is no guarantee. Receiving "random" address = "dynamic".
One can also have a "dynamic pool", but only for known clients.
How much DHCP server can be configured does depend on the server. Even the cheap ones have some options.

darcyr
Posts: 6
Joined: 2020/01/24 15:16:58

Re: "Automatically Connect" and Static vs Dynamic IP addresses

Post by darcyr » 2020/11/24 20:44:57

These are the values being pulled. Is there anything suspicious here? The "enp4s0" profile just fell off from static to DHCP...

Code: Select all

[root@host ~]# nmcli -f ipv4 c s enp4s0
ipv4.method:                            manual
ipv4.dns:                               --
ipv4.dns-search:                        --
ipv4.dns-options:                       ""
ipv4.dns-priority:                      0
ipv4.addresses:                         10.120.78.50/23
ipv4.gateway:                           --
ipv4.routes:                            --
ipv4.route-metric:                      -1
ipv4.route-table:                       0 (unspec)
ipv4.routing-rules:                     --
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-timeout:                      0 (default)
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.dhcp-fqdn:                         --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv4.dad-timeout:                       -1 (default)

[root@host ~]# nmcli -f ipv4 c s "System eno1"
ipv4.method:                            manual
ipv4.dns:                               9.9.9.9,8.8.8.8
ipv4.dns-search:                        --
ipv4.dns-options:                       ""
ipv4.dns-priority:                      0
ipv4.addresses:                         192.168.0.245/24
ipv4.gateway:                           192.168.0.1
ipv4.routes:                            --
ipv4.route-metric:                      -1
ipv4.route-table:                       0 (unspec)
ipv4.routing-rules:                     --
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-timeout:                      0 (default)
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.dhcp-fqdn:                         --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv4.dad-timeout:                       -1 (default)

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: "Automatically Connect" and Static vs Dynamic IP addresses

Post by jlehtone » 2020/11/26 12:49:28

Looks "normal".

darcyr
Posts: 6
Joined: 2020/01/24 15:16:58

Re: "Automatically Connect" and Static vs Dynamic IP addresses

Post by darcyr » 2020/11/26 14:45:05

jlehtone wrote:
2020/11/26 12:49:28
Looks "normal".
So do you think it's possible the network itself is somehow forcing the port to use DHCP instead of the static IP that was set?

It only seems to do this *if* the DHCP connection will work and connect to the internet.

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: "Automatically Connect" and Static vs Dynamic IP addresses

Post by jlehtone » 2020/11/26 15:10:59

darcyr wrote:
2020/11/26 14:45:05
So do you think it's possible the network itself is somehow forcing the port to use DHCP instead of the static IP that was set?
No.

Post Reply