0

I had problems to setup up a bond, i decided now to use only on interface without bonding.

But now i have 4 IPs on my two interfaces, 2x static and 2x DHCP. but it is configurated to only have the static addresse. Why is there still a DHCP-Address? All addresses are reachable.

EDIT: if i enter the following commands everything is fine, but after a boot again 4 IPs.
- ip address flush enp2s0
- ip address flush enp3s0
- netplan apply

current config:

  root@gemini:/etc/netplan# cat 01-netcfg.yaml
        # This file describes the network interfaces available on your system
        # For more information, see netplan(5).
        network:
          version: 2
          renderer: networkd
          ethernets:
            enp3s0:
              dhcp4: false
              dhcp6: false
              addresses: [192.168.88.8/24]
              gateway4: 192.168.88.1
              nameservers:
                search: [lan]
                addresses: [127.0.0.1, 192.168.88.1]

        enp2s0:
          addresses: [192.168.89.8/24]
          dhcp4: false
          dhcp6: false

output:

root@gemini:/etc/netplan# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:13:3b:21:bd:35 brd ff:ff:ff:ff:ff:ff
    inet 192.168.89.8/24 brd 192.168.89.255 scope global enp2s0
       valid_lft forever preferred_lft forever
    inet 192.168.88.131/24 brd 192.168.88.255 scope global enp2s0
       valid_lft forever preferred_lft forever
    inet6 2001:16b8:49d:d000:4a0f:31a2:4b9f:34e5/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 6775sec preferred_lft 3175sec
    inet6 2001:16b8:49d:d000:213:3bff:fe21:bd35/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 6775sec preferred_lft 3175sec
    inet6 fe80::213:3bff:fe21:bd35/64 scope link
       valid_lft forever preferred_lft forever
3: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether d0:50:99:1d:04:46 brd ff:ff:ff:ff:ff:ff
    inet 192.168.88.8/24 brd 192.168.88.255 scope global enp3s0
       valid_lft forever preferred_lft forever
    inet 192.168.88.143/24 brd 192.168.88.255 scope global secondary enp3s0
       valid_lft forever preferred_lft forever
    inet6 2001:16b8:49d:d000:65d1:f7ff:7ccf:111/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 6775sec preferred_lft 3175sec
    inet6 2001:16b8:49d:d000:d250:99ff:fe1d:446/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 6775sec preferred_lft 3175sec
    inet6 fe80::d250:99ff:fe1d:446/64 scope link
       valid_lft forever preferred_lft forever

after adding comments to enp2s0-lines:

root@gemini:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:13:3b:21:bd:35 brd ff:ff:ff:ff:ff:ff
    inet 192.168.88.131/24 brd 192.168.88.255 scope global enp2s0
       valid_lft forever preferred_lft forever
    inet6 2001:16b8:432:7a00:2aeb:3ee5:3206:4eb4/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 7049sec preferred_lft 3449sec
    inet6 fe80::16bb:68ed:8dd0:1ce/64 scope link
       valid_lft forever preferred_lft forever
3: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether d0:50:99:1d:04:46 brd ff:ff:ff:ff:ff:ff
    inet 192.168.88.8/24 brd 192.168.88.255 scope global enp3s0
       valid_lft forever preferred_lft forever
    inet 192.168.88.143/24 brd 192.168.88.255 scope global secondary enp3s0
       valid_lft forever preferred_lft forever
    inet6 2001:16b8:432:7a00:b020:677:85b1:37c8/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 7049sec preferred_lft 3449sec
    inet6 2001:16b8:432:7a00:d250:99ff:fe1d:446/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 7049sec preferred_lft 3449sec
    inet6 fe80::d250:99ff:fe1d:446/64 scope link
       valid_lft forever preferred_lft forever

..

    root@gemini:~# lshw -C network
      *-network
           description: Ethernet interface
           product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
           vendor: Realtek Semiconductor Co., Ltd.
           physical id: 0
           bus info: pci@0000:02:00.0
           logical name: enp2s0
           version: 06
           serial: 00:13:3b:21:bd:35
           size: 1Gbit/s
           capacity: 1Gbit/s
           width: 64 bits
           clock: 33MHz
           capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
           configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168e-3_0.0.4 03/27/12 ip=192.168.88.131 latency=0 link=yes multicast=yes port=MII speed=1Gbit/s
           resources: irq:17 ioport:e000(size=256) memory:d0804000-d0804fff memory:d0800000-d0803fff
      *-network
           description: Ethernet interface
           product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
           vendor: Realtek Semiconductor Co., Ltd.
           physical id: 0
           bus info: pci@0000:03:00.0
           logical name: enp3s0
           version: 11
           serial: d0:50:99:1d:04:46
           size: 1Gbit/s
           capacity: 1Gbit/s
           width: 64 bits
           clock: 33MHz
           capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
           configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168g-2_0.0.1 02/06/13 ip=192.168.88.8 latency=0 link=yes multicast=yes port=MII speed=1Gbit/s
           resources: irq:18 ioport:d000(size=256) memory:d0704000-d0704fff memory:d0700000-d0703fff
    root@gemini:~#

..
root@gemini:~# ls -al /etc/netplan
insgesamt 20
drwxr-xr-x   2 root root  4096 Jul 16 21:58 .
drwxr-xr-x 118 root root 12288 Jul 15 22:23 ..
-rw-r--r--   1 root root   457 Jul 16 21:58 01-netcfg.yaml
root@gemini:~#

...

root@gemini:~# cat /etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system.  See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
#    sudo apt install ifupdown
root@gemini:~#

root@gemini:~# cat /etc/netplan/*
network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      addresses: [192.168.88.8/24]
      gateway4: 192.168.88.1
      nameservers:
        search: [lan]
        addresses: [192.168.88.1]
root@gemini:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:13:3b:21:bd:35 brd ff:ff:ff:ff:ff:ff
    inet 192.168.88.131/24 brd 192.168.88.255 scope global enp2s0
       valid_lft forever preferred_lft forever
    inet6 2001:16b8:43f:b900:f085:3f0f:356d:c796/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 7126sec preferred_lft 3526sec
    inet6 fe80::16bb:68ed:8dd0:1ce/64 scope link
       valid_lft forever preferred_lft forever
3: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether d0:50:99:1d:04:46 brd ff:ff:ff:ff:ff:ff
    inet 192.168.88.8/24 brd 192.168.88.255 scope global enp3s0
       valid_lft forever preferred_lft forever
    inet 192.168.88.143/24 brd 192.168.88.255 scope global secondary enp3s0
       valid_lft forever preferred_lft forever
    inet6 2001:16b8:43f:b900:46ad:aeda:6b62:258a/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 7126sec preferred_lft 3526sec
    inet6 2001:16b8:43f:b900:d250:99ff:fe1d:446/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 7126sec preferred_lft 3526sec
    inet6 fe80::d250:99ff:fe1d:446/64 scope link
       valid_lft forever preferred_lft forever
  • Try adding a gateway to enp2s0 – heynnema Jul 13 at 22:27
  • Not working, still the same. – HrzM Jul 14 at 1:10
  • Comment out all of enp2s0, sudo netplan apply, REBOOT, see if enp3s0 still gets two addresses. – heynnema Jul 14 at 1:21
  • Show me sudo lshw -C network again. – heynnema Jul 14 at 1:27
  • Show me ls -al /etc/netplan – heynnema Jul 14 at 1:31
0

If you are setting dhcp4: false on each of these interfaces, and you are still getting IPs assigned via DHCP, then that is coming from somewhere outside of this file.

Either you have another yaml file in /etc/netplan which is overriding your dhcp4: false setting; or something external to netplan is calling dhcp for you.

Check if you have any dhclient processes running (ps awxf| grep dhclient) and if so, work out what has started those on your system. If you do have them, this is definitely external to networkd, which does not use dhclient for its dhcp requests.

  • ps awxf| grep dhclient shows nothing – HrzM Jul 20 at 22:47
  • Ok. That unfortunately makes it harder to figure out what is responsible. You may want to look at netstat output to figure out what process on your system is talking on DHCP ports and track it down from there. – slangasek Jul 22 at 2:16
0

Temporarily set /etc/netplan/01-netcfg.yaml to look like this...

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      addresses: [192.168.88.8/24]
      gateway4: 192.168.88.1
      nameservers:
        search: [lan]
        addresses: [192.168.88.1]

sudo netplan --debug generate # generate config files

sudo netplan apply # apply configuration

reboot # reboot the computer

ip addr # note if enp3s0 has only 1 IPv4 address (not two)... and that enp2s0 doesn't show up at all...

Update #1:

Set /etc/netplan/01-netcfg.yaml to look like this... (check the addresses)

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      addresses: [192.168.88.8/24]
      gateway4: 192.168.88.1
      nameservers:
        search: [lan]
        addresses: 192.168.88.1
    enp2s0:
      addresses: [192.168.89.8/24]
      gateway4: 192.168.89.1
      nameservers:
        addresses: 192.168.89.1

sudo netplan --debug generate # generate config files

sudo netplan apply # apply configuration

reboot # reboot the computer

  • sorry i don't understand what to do. for troubleshooting i flush the addresse with ip addr flush enp3s0 and enp2s0. – HrzM Jul 20 at 22:49
  • @HrzM Show me cat /etc/network/interfaces, Then use the .yaml code in my answer, reboot, and show me how many IPs enp3s0 gets, and that enps2s0 doesn't show up at all. Report back. – heynnema Jul 20 at 23:49
  • enp3s0 static and dhcp IP, enp2s0 dchp IP – HrzM Jul 21 at 0:45
  • Something is wrong. Somewhere you've added another file, probably a .yaml file, that includes the two ethernet interfaces, and that's why we're getting duplicates. Edit your question and show me the output of sudo netplan --debug generate and sudo netplan apply. Note Update #1 in my answer. – heynnema Jul 21 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.