3

I am trying to assign a series of static IP addresses to my homelab server so that I can run a media service.

I edited /etc/netplan/ with the following:

01-netcfg.yaml:

network:
version: 2
renderer: networkd
ethernets:
    enp0s20f0:
        dhcp4: no
        addresses: [192.168.0.100/24]
        gateway4: 192.168.0.1
        nameservers:
            addresses: [192.168.0.1,8.8.4.8,8.8.8.8]

Then I repeated for the other three ports I was assigning. e.g., 02-netcfg.yaml, etc.

When I run

sudo netplan apply

I get the correct IP addresses.
After a period of mins, I lose the assigned numbers and get new IPs from my router's DHCP.

I've also tried to set the static IPs via the router, but I get the same problem.

Any ideas?
(I'm happy to provide more logs as needed.)

UPDATE: Output from syslog

/var/log$ tail -100 syslog
Aug 19 12:13:06 mythtv-server systemd[1]: Starting Network Name Resolution...
Aug 19 12:13:06 mythtv-server systemd-resolved[14306]: Positive Trust Anchors:
Aug 19 12:13:06 mythtv-server systemd-resolved[14306]: . IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5
Aug 19 12:13:06 mythtv-server systemd-resolved[14306]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
Aug 19 12:13:06 mythtv-server systemd-resolved[14306]: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.in-addr.arpa 20.172.in-addr.arpa 21.172.in-addr.arpa 22.172.in-addr.arpa 23.172.in-addr.arpa 24.172.in-addr.arpa 25.172.in-addr.arpa 26.172.in-addr.arpa 27.172.in-addr.arpa 28.172.in-addr.arpa 29.172.in-addr.arpa 30.172.in-addr.arpa 31.172.in-addr.arpa 168.192.in-addr.arpa d.f.ip6.arpa corp home internal intranet lan local private test
Aug 19 12:13:06 mythtv-server systemd-resolved[14306]: Using system hostname 'mythtv-server'.
Aug 19 12:13:06 mythtv-server systemd[1]: Started Network Name Resolution.
Aug 19 12:13:10 mythtv-server dhclient[11809]: DHCPDISCOVER on enp0s20f3 to 255.255.255.255 port 67 interval 11 (xid=0x80e80479)
Aug 19 12:13:10 mythtv-server dhclient[11809]: send_packet: No such device or address
Aug 19 12:13:10 mythtv-server dhclient[11809]: dhclient.c:2438: Failed to send 300 byte long packet over enp0s20f3 interface.
Aug 19 12:13:10 mythtv-server dhclient[28319]: DHCPDISCOVER on enp0s20f3 to 255.255.255.255 port 67 interval 20 (xid=0x6ab1ec09)
Aug 19 12:13:10 mythtv-server dhclient[28319]: send_packet: No such device or address
Aug 19 12:13:10 mythtv-server dhclient[28319]: dhclient.c:2438: Failed to send 300 byte long packet over enp0s20f3 interface.
Aug 19 12:13:11 mythtv-server dhclient[27706]: DHCPDISCOVER on enp0s20f3 to 255.255.255.255 port 67 interval 12 (xid=0x9f278b66)
Aug 19 12:13:11 mythtv-server dhclient[27706]: send_packet: No such device or address
Aug 19 12:13:11 mythtv-server dhclient[27706]: dhclient.c:2438: Failed to send 300 byte long packet over enp0s20f3 interface.
Aug 19 12:13:15 mythtv-server dhclient[28739]: DHCPDISCOVER on enp0s20f1 to 255.255.255.255 port 67 interval 3 (xid=0xf969ca13)
Aug 19 12:13:15 mythtv-server dhclient[28739]: send_packet: No such device or address
Aug 19 12:13:15 mythtv-server dhclient[28739]: dhclient.c:2438: Failed to send 300 byte long packet over enp0s20f1 interface.
Aug 19 12:13:18 mythtv-server dhclient[11809]: DHCPDISCOVER on enp0s20f1 to 255.255.255.255 port 67 interval 7 (xid=0x8354462)
Aug 19 12:13:18 mythtv-server dhclient[11809]: send_packet: No such device or address
Aug 19 12:13:18 mythtv-server dhclient[11809]: dhclient.c:2438: Failed to send 300 byte long packet over enp0s20f1 interface.
Aug 19 12:13:18 mythtv-server dhclient[3290]: DHCPDISCOVER on enp0s20f3 to 255.255.255.255 port 67 interval 9 (xid=0xc9123118)
Aug 19 12:13:18 mythtv-server dhclient[3290]: send_packet: No such device or address
Aug 19 12:13:18 mythtv-server dhclient[3290]: dhclient.c:2438: Failed to send 300 byte long packet over enp0s20f3 interface.
Aug 19 12:13:18 mythtv-server dhclient[28739]: DHCPDISCOVER on enp0s20f1 to 255.255.255.255 port 67 interval 6 (xid=0xf969ca13)
Aug 19 12:13:18 mythtv-server dhclient[28739]: send_packet: No such device or address
Aug 19 12:13:18 mythtv-server dhclient[28739]: dhclient.c:2438: Failed to send 300 byte long packet over enp0s20f1 interface.
Aug 19 12:13:21 mythtv-server dhclient[11809]: DHCPDISCOVER on enp0s20f3 to 255.255.255.255 port 67 interval 15 (xid=0x80e80479)

UPDATE2: I've added the output from ip a

ip a
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: enp0s20f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
   link/ether ac:1f:6b:46:da:74 brd ff:ff:ff:ff:ff:ff
   inet 192.168.0.100/24 brd 192.168.0.255 scope global enp0s20f0
      valid_lft forever preferred_lft forever
   inet 192.168.0.6/24 brd 192.168.0.255 scope global secondary dynamic      enp0s20f0
      valid_lft 2391sec preferred_lft 2391sec
   inet6 2605:a000:45c9:3100::3/128 scope global dynamic noprefixroute 
      valid_lft 3277sec preferred_lft 1477sec
   inet6 2605:a000:45c9:3100:ae1f:6bff:fe46:da74/64 scope global dynamic mngtmpaddr noprefixroute 
      valid_lft 604796sec preferred_lft 604796sec
   inet6 fe80::ae1f:6bff:fe46:da74/64 scope link 
      valid_lft forever preferred_lft forever
3: enp0s20f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
   link/ether ac:1f:6b:46:da:75 brd ff:ff:ff:ff:ff:ff
4: enp0s20f2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
   link/ether ac:1f:6b:46:da:76 brd ff:ff:ff:ff:ff:ff
   inet 192.168.0.102/24 brd 192.168.0.255 scope global enp0s20f2
      valid_lft forever preferred_lft forever
   inet 192.168.0.68/24 brd 192.168.0.255 scope global secondary dynamic enp0s20f2
      valid_lft 2389sec preferred_lft 2389sec
   inet6 2605:a000:45c9:3100::2/128 scope global dynamic noprefixroute 
      valid_lft 3379sec preferred_lft 1579sec
   inet6 2605:a000:45c9:3100:ae1f:6bff:fe46:da76/64 scope global dynamic mngtmpaddr noprefixroute 
      valid_lft 604796sec preferred_lft 604796sec
   inet6 fe80::ae1f:6bff:fe46:da76/64 scope link 
      valid_lft forever preferred_lft forever
5: enp0s20f3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
   link/ether ac:1f:6b:46:da:77 brd ff:ff:ff:ff:ff:ff
Saxtheowl
  • 1,739
  • 2
  • 10
  • 20
crum
  • 29
  • Is the 24 bit mask intentional on your static IP? i.e. If you want that interface to have an address of 192.168.0.100, then the mask should be /32, otherwise, you’re liable to acquire any 192.168.0.x address. Or am I missing how netplan handles that config parameter? – Piotrek Aug 19 '18 at 03:46
  • Piotrek - I'm relatively new to this... does this thread cover cover what you are referring to? https://arstechnica.com/civis/viewtopic.php?t=751834 – crum Aug 19 '18 at 12:07
  • Both of these references use the /24 mask. https://www.techrepublic.com/article/how-to-configure-a-static-ip-address-in-ubuntu-server-18-04/ and https://linuxconfig.org/how-to-configure-static-ip-address-on-ubuntu-18-04-bionic-beaver-linux – crum Aug 19 '18 at 12:24
  • As an experiment - I tried the /32 idea. Didn't work. Still getting new IP addresses assigned. – crum Aug 19 '18 at 16:39
  • What is running dhclient on your system? Your configuration clearly shows dhcp4: no; and networkd never calls dhclient, it uses its own internal implementation. Something else on your system is trying to configure these interfaces via dhcp which is overriding the static addresses configured in netplan. Is this an upgrade from pre-18.04? Do you have configuration in /etc/network/interfaces still? – slangasek Aug 21 '18 at 22:15
  • @slangasek No this was not an upgrade. It was a new install. All the lines in /etc/network/interfaces are commented out. (i.e., leading with "#"). – crum Aug 29 '18 at 00:23
  • Ok but something is still running dhclient on your system and it is definitely not netplan because networkd does not call dhclient. So you need to figure out what that is. – slangasek Aug 30 '18 at 03:58
  • Ok. So after some rebooting and tinkering - I found that my router (DHPC server) was still assigned an IP, but I can also get to my server with the assigned static IP - in this case 192.168.0.100... so each port (I have two) has two valid IP addresses on my network. I tried setting my DHPC server to assign the static IP I wanted, but the setting wont stick. – crum Sep 01 '18 at 01:27
  • ... this isn't ideal. What if my DHPC server assigns 192.168.0.100 to another device? Not sure how to handle that one. – crum Sep 01 '18 at 01:28

2 Answers2

1

It could be NetworkManager service that does that. Just purge it, and hopefully it will work.

For more details on how to purge it, goto : How do I disable network manager permanently?

NB :

  • (Source : netplan vs NetworkManager on Ubuntu 18.04 and above)

    NetworkManager is normally used in desktop applications, and was used in all prior versions of Ubuntu.

  • If you are using netplan, it's totally safe to remove NetworkManager

  • Fixed the same issue for me on Ubuntu 18.04.3 LTS.

pymym213
  • 521
  • 4
  • 11
-1

Check out this related bug on netplan...

https://bugs.launchpad.net/netplan/+bug/1781652

You can easily migrate back to ifupdown if you still have issues with netplan. I sure did.