DHCP, Network Manager, Centos 7 – the curious case of two IPs working at the same time

Messing around with DHCP for the raspberry pi that’s going to be aggregating syslogs.

  • Raspberry Pi running 32 bit Centos 7;  primary interface addressed using DHCP.
  • I assigned it a static DHCP allocation, a different IP.
  • Restarted the NetworkManager service.
  • Nothing seemed to happen.
  • Logged out, logged back in (using the original IP.)
  • Still works.

I guess restarting Network Manager doesn’t restart the interfaces.

But ..

$ ssh root@192.168.1.247
[..]
# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
         inet 192.168.1.221 netmask 255.255.255.0 broadcast 192.168.1.255
         <snip>

It did.  But hang on … the IP address is not the one I accessed the server with!

# ip a list
1: lo: <LOOPBACK,UP,LOWER_UP> 
   <snip> 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    <snip>
    inet 192.168.1.221/24 brd 192.168.1.255 scope global noprefixroute dynamic eth0
       valid_lft 863962sec preferred_lft 863962sec
    inet 192.168.1.247/24 brd 192.168.1.255 scope global secondary noprefixroute dynamic eth0
       valid_lft 36515sec preferred_lft 36515sec
    <snip>

Of interest:

  1. It’s kept the old IP alive; I assume for the duration of the lease.
  2. A use case where ‘ip’ definitely trumps ‘ifconfig’. (old dog, new tricks)
  3. Not expected behaviour. Nice, but not expected.

Also: useful. Puppet is telling logging clients to use the old IP.  I need a bit of time to push around the IP change: Network Manager has handled the transition for me.

Original plan was a static IP for logging. But I hoped to keep DHCP for the host, because it turns out Network Manager is getting configured much better with DHCP than it would with a static IP.  The network manager module I’ve downloaded for Puppet isn’t as simple as it first looked, and needs some testing and investigation – so I’ve left that addition on the backlog.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s