Basic Linux / Debian networking question

I have just provisioned a Debian 9 VM.

My /etc/network/interfaces file reads

auto ens32

iface ens32 inet static
	address 172.16.50.210
	netmask 255.255.255.0
	broadcast 172.16.50.254
	network 172.16.50.0
	gateway 172.16.50.254

Open in new window

Yet for some reason, I end up with the system having one DHCP address and the static one I'd like for the file above.

I'm sure I am missing something obvious... but what??
LVL 2
Alexandre TakacsCTOAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nociSoftware EngineerCommented:
broadcast should be:  172.16.50.255
(last 4 into a 5)...
Or leave the line out, then it will be computed....
same for network, you can leave that out.
Alexandre TakacsCTOAuthor Commented:
Thanks - good catche(s) - corrected.

But doesn't address my underlying issue - still end up with a multi-homed system (one IP via DHCP, one static)
nociSoftware EngineerCommented:
Dual homed means there are 2 ethernet adapters...
Then 2 adapters descriptions are needed.
Is there a misspelling  in the name?
What is the output from:

ip addr show 

Open in new window

Get Blueprints for Increased Customer Retention

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Alexandre TakacsCTOAuthor Commented:
You are correct - multihomed ins not the word to use here.

Still

bitnami@debian:~$ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 00:0c:29:88:c7:ca brd ff:ff:ff:ff:ff:ff
    inet 172.16.50.100/24 brd 172.16.50.255 scope global dynamic ens32
       valid_lft 255623sec preferred_lft 255623sec
    inet 172.16.50.210/24 brd 172.16.50.255 scope global secondary ens32
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe88:c7ca/64 scope link
       valid_lft forever preferred_lft forever
bitnami@debian:~$

Open in new window

Dr. KlahnPrincipal Software EngineerCommented:
Uninstall the DHCP service.

apt remove dhcp-client isc-dhcp-client isc-dhcp-common

If this fails to solve the issue, then look for one of the other DHCP clients being installed instead of the default dhcp-client or isc-dhcp-client.

Also note that if the system has not been rebooted since changing /etc/interfaces, those changes will not be applied until the next reboot.
Alexandre TakacsCTOAuthor Commented:
Getting a bit crazy... I have removed dhcp client - rebooted - still two IP, one being apparently visa DHCP !!
Dr. KlahnPrincipal Software EngineerCommented:
Did the system actually uninstall anything when the Apt command was issued?
Alexandre TakacsCTOAuthor Commented:
> Did the system actually uninstall anything when the Apt command was issued?

Yes it did - as a matter of fact:

bitnami@debian:~$ sudo apt remove dhcp-client isc-dhcp-client isc-dhcp-common   Reading package lists... Done
Building dependency tree
Reading state information... Done
Virtual packages like 'dhcp-client' can't be removed
Package 'isc-dhcp-client' is not installed, so not removed
Package 'isc-dhcp-common' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
bitnami@debian:~$

Open in new window


It is not anymore installed ... yet I still gat a DHCP IP !!
Dr. KlahnPrincipal Software EngineerCommented:
No, it did not uninstall anything.  There is still a DHCP client in the system.

I'll take a further look at this later on.  I believe the problem is related to the recent "deprecation" of the old startup method, and replacement by the new one which is much harder to deal with.
Alexandre TakacsCTOAuthor Commented:
Well it certainly reported a desinstall the first time I ran the command.

Then the second time it reports that the client is not installed (my lattest trace).

But I agree there is still something getting a DHCP (I clearly see the lease request on the router side) address!
nociSoftware EngineerCommented:
There are more posibiities for dhcp clients..  dhclient f.e  there used to be even more like pump,  dhcpcd   (i am not sure if NetworkManager has support by itself)

Can you also check the /etc/networking/interfaces.d      directory if there is another definition of the interface there?
Alexandre TakacsCTOAuthor Commented:
/etc/networking/interfaces.d contains a file "setup" with following content

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dynamic

Open in new window

I have amended the last line to read as
iface eth0 inet static

Open in new window

but still does results in the same result
nociSoftware EngineerCommented:
No that one operates on the eth0 interface if there is none it won't affect ens32

Any chance of VM  tooling doing anything?
can you provide a ps -axf output, to see what processes are active?
Alexandre TakacsCTOAuthor Commented:
We are running ESX - I don't think there are any networking shenanigans there...


bitnami@debian:~$ ps -axf
  PID TTY      STAT   TIME COMMAND
    2 ?        S      0:00 [kthreadd]
    3 ?        S      0:00  \_ [ksoftirqd/0]
    4 ?        S      0:00  \_ [kworker/0:0]
    5 ?        S<     0:00  \_ [kworker/0:0H]
    7 ?        S      0:00  \_ [rcu_sched]
    8 ?        S      0:00  \_ [rcu_bh]
    9 ?        S      0:00  \_ [migration/0]
   10 ?        S<     0:00  \_ [lru-add-drain]
   11 ?        S      0:00  \_ [watchdog/0]
   12 ?        S      0:00  \_ [cpuhp/0]
   13 ?        S      0:00  \_ [cpuhp/1]
   14 ?        S      0:00  \_ [watchdog/1]
   15 ?        S      0:00  \_ [migration/1]
   16 ?        S      0:00  \_ [ksoftirqd/1]
   18 ?        S<     0:00  \_ [kworker/1:0H]
   19 ?        S      0:00  \_ [cpuhp/2]
   20 ?        S      0:00  \_ [watchdog/2]
   21 ?        S      0:00  \_ [migration/2]
   22 ?        S      0:00  \_ [ksoftirqd/2]
   24 ?        S<     0:00  \_ [kworker/2:0H]
   25 ?        S      0:00  \_ [cpuhp/3]
   26 ?        S      0:00  \_ [watchdog/3]
   27 ?        S      0:00  \_ [migration/3]
   28 ?        S      0:00  \_ [ksoftirqd/3]
   30 ?        S<     0:00  \_ [kworker/3:0H]
   31 ?        S      0:00  \_ [kdevtmpfs]
   32 ?        S<     0:00  \_ [netns]
   33 ?        S      0:00  \_ [khungtaskd]
   34 ?        S      0:00  \_ [oom_reaper]
   35 ?        S<     0:00  \_ [writeback]
   36 ?        S      0:00  \_ [kcompactd0]
   38 ?        SN     0:00  \_ [ksmd]
   39 ?        SN     0:00  \_ [khugepaged]
   40 ?        S<     0:00  \_ [crypto]
   41 ?        S<     0:00  \_ [kintegrityd]
   42 ?        S<     0:00  \_ [bioset]
   43 ?        S<     0:00  \_ [kblockd]
   44 ?        S      0:00  \_ [kworker/1:1]
   45 ?        S<     0:00  \_ [devfreq_wq]
   46 ?        S<     0:00  \_ [watchdogd]
   47 ?        S      0:00  \_ [kswapd0]
   48 ?        S<     0:00  \_ [vmstat]
   60 ?        S<     0:00  \_ [kthrotld]
   61 ?        S      0:00  \_ [kworker/3:1]
   62 ?        S      0:00  \_ [kworker/2:1]
   63 ?        S<     0:00  \_ [ipv6_addrconf]
   96 ?        S<     0:00  \_ [bioset]
   97 ?        S<     0:00  \_ [bioset]
   98 ?        S<     0:00  \_ [bioset]
   99 ?        S<     0:00  \_ [bioset]
  100 ?        S<     0:00  \_ [bioset]
  101 ?        S<     0:00  \_ [bioset]
  102 ?        S<     0:00  \_ [bioset]
  103 ?        S<     0:00  \_ [bioset]
  104 ?        S      0:00  \_ [kworker/u8:1]
  106 ?        S<     0:00  \_ [ata_sff]
  108 ?        S<     0:00  \_ [mpt_poll_0]
  109 ?        S<     0:00  \_ [mpt/0]
  136 ?        S      0:00  \_ [scsi_eh_0]
  137 ?        S<     0:00  \_ [scsi_tmf_0]
  138 ?        S<     0:00  \_ [bioset]
  139 ?        S      0:00  \_ [scsi_eh_1]
  141 ?        S<     0:00  \_ [scsi_tmf_1]
  142 ?        S      0:00  \_ [scsi_eh_2]
  143 ?        S<     0:00  \_ [scsi_tmf_2]
  145 ?        S      0:00  \_ [kworker/u8:2]
  161 ?        S<     0:00  \_ [kworker/1:1H]
  162 ?        S<     0:00  \_ [kworker/0:1H]
  163 ?        S<     0:00  \_ [kworker/3:1H]
  164 ?        S<     0:00  \_ [kworker/2:1H]
  181 ?        S<     0:00  \_ [kworker/u9:0]
  191 ?        S      0:00  \_ [jbd2/sda1-8]
  192 ?        S<     0:00  \_ [ext4-rsv-conver]
  219 ?        S      0:00  \_ [kauditd]
  229 ?        S      0:00  \_ [kworker/1:2]
  264 ?        S      0:00  \_ [kworker/0:2]
  283 ?        S<     0:00  \_ [ttm_swap]
  337 ?        S<     0:00  \_ [edac-poller]
 1848 ?        S      0:00  \_ [kworker/3:0]
 1850 ?        S      0:00  \_ [kworker/2:0]
    1 ?        Ss     0:01 /sbin/init
  217 ?        Ss     0:00 /lib/systemd/systemd-journald
  218 ?        Ss     0:01 /usr/bin/vmtoolsd
  243 ?        Ss     0:00 /lib/systemd/systemd-udevd
  254 ?        Ss     0:00 /lib/systemd/systemd-networkd
  276 ?        Ssl    0:00 /lib/systemd/systemd-timesyncd
  277 ?        Ss     0:00 /usr/sbin/haveged --Foreground --verbose=1 -w 1024
  317 ?        Ssl    0:00 /usr/sbin/syslog-ng -F
  318 ?        Ss     0:00 /usr/sbin/irqbalance --foreground
  319 ?        Ss     0:00 /usr/sbin/atd -f
  320 ?        Ss     0:00 /usr/sbin/cron -f
  322 ?        Ss     0:00 /usr/bin/VGAuthService
  446 ?        Ss     0:00 /usr/sbin/sshd -D
 1665 ?        Ss     0:00  \_ sshd: bitnami [priv]
 1673 ?        S      0:00      \_ sshd: bitnami@pts/0
 1674 pts/0    Ss     0:00          \_ -bash
 1979 pts/0    R+     0:00              \_ ps -axf
  537 tty1     Ss+    0:00 /sbin/agetty --noclear tty1 linux
  545 tty2     Ss+    0:00 /sbin/agetty --noclear tty2 linux
  553 tty3     Ss+    0:00 /sbin/agetty --noclear tty3 linux
  561 tty4     Ss+    0:00 /sbin/agetty --noclear tty4 linux
  569 tty5     Ss+    0:00 /sbin/agetty --noclear tty5 linux
  577 tty6     Ss+    0:00 /sbin/agetty --noclear tty6 linux
  601 ?        S      0:00 /bin/sh /opt/bitnami/mysql/bin/mysqld_safe --defaults
  933 ?        Sl     0:01  \_ /opt/bitnami/mysql/bin/mysqld.bin --defaults-file
  961 ?        Ss     0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webm
  990 ?        Ss     0:00 php-fpm: master process (/opt/bitnami/php/etc/php-fpm
  991 ?        S      0:02  \_ php-fpm: pool owncloud
  992 ?        S      0:01  \_ php-fpm: pool owncloud
 1330 ?        S      0:01  \_ php-fpm: pool owncloud
  999 ?        Ss     0:00 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/ap
 1004 ?        Sl     0:00  \_ /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnam
 1005 ?        Sl     0:00  \_ /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnam
 1006 ?        Sl     0:00  \_ /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnam
 1262 ?        Sl     0:00  \_ /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnam
 1409 ?        Ssl    0:00 /usr/bin/gonit
bitnami@debian:~$

Open in new window

nociSoftware EngineerCommented:
I think the culplrit is the systemd-networkd, to put it mildly i am not a huge fan of systemd....  (i have no systemd based system in my environment... ).

You will need to either disable the systemd-networkd settings and use Debian or use systemd settings and drop debian settings....
Here is a readable description:   https://wiki.archlinux.org/index.php/Systemd-networkd#Wired_adapter_using_a_static_IP
(It is a different linux, but the systemd part is the same ... :-| )
Dr. KlahnPrincipal Software EngineerCommented:
Virtual packages like 'dhcp-client' can't be removed

This one must be defeated in the startup scripts.  Debian dropped the good old reliable SysV boot and replaced it with systemd, which is a bugger.  I suspect if you look in the systemd startup scripts you will find that it is still activating DHCP.

IMO, remove systemd and go back to SysV startup.

(Ah, I see noci posted the same thing at the same time I was writing.)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alexandre TakacsCTOAuthor Commented:
Ok I found a file 99-dhcp.network in /etc/systemd/network that reads

[Match]
Name=en*

[Network]
DHCP=yes

Open in new window


set DHCP to no

and finally no more DHCP !

bitnami@debian:~$ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 00:0c:29:88:c7:ca brd ff:ff:ff:ff:ff:ff
    inet 172.16.50.210/24 brd 172.16.50.255 scope global ens32
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe88:c7ca/64 scope link
       valid_lft forever preferred_lft forever

Open in new window

wow - wasn't that trivial after all - somewhat reassured... :)
Alexandre TakacsCTOAuthor Commented:
thanks for your help - I think you both contributed equally here
nociSoftware EngineerCommented:
NP., problem solved, that's important...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.