1

I have no idea what I've done - but it was all working fine, now it's not, and I cannot for the life of me figure out what is wrong.

How can I completely reset the network interfaces?

All I want to do is connect to the internet. I can see the server listed in the Router's Admin screen, with a dynamic IP address that has been generated through the Routers DHCP server.

I've tried deleting all contents within the /etc/network/interfaces file

I've tried deleting all YAML files within /etc/netplan, yet whenever I try to run the command netplan apply I keep getting the error "returned non-zero exit status 4" - Whatever that means.

I've a feeling that something has got screwed up along the way, and I just need to re-set everything then start from the beginning to get the server accessing the internet (outbound).

More Details

Previously when I had this working I had a static IP for the box on the network, and I could connect to the internet no problem - I've no idea what I changed between it working and not working. What was odd though was that when it stopped working I could see the box had 2x MAC addresses listed on the routers admin page, the static IP that I had configured and another MAC address with the server having it's own Dynamic IP address. All I can assume there is that I've plugged in the Ethernet cable into one of the different network ports in the back of the machine.

Here are the outputs to the files as requested;

lshw -C network

  *-network:0 DISABLED      
       description: Ethernet interface
       product: I350 Gigabit Network Connection
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:04:00.0
       logical name: enp4s0f0
       version: 01
       serial: 0c:c4:7a:2a:c8:8a
       size: 100Mbit/s
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=igb driverversion=5.4.0-k duplex=full firmware=1.63, 0x80000a05 latency=0 link=no multicast=yes port=twisted pair speed=100Mbit/s
       resources: irq:43 memory:c7120000-c713ffff ioport:6020(size=32) memory:c7144000-c7147fff memory:90000000-9001ffff memory:90020000-9003ffff
  *-network:1 DISABLED
       description: Ethernet interface
       product: I350 Gigabit Network Connection
       vendor: Intel Corporation
       physical id: 0.1
       bus info: pci@0000:04:00.1
       logical name: enp4s0f1
       version: 01
       serial: 0c:c4:7a:2a:c8:8b
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=igb driverversion=5.4.0-k firmware=1.63, 0x80000a05 latency=0 link=no multicast=yes port=twisted pair
       resources: irq:53 memory:c7100000-c711ffff ioport:6000(size=32) memory:c7140000-c7143fff memory:90040000-9005ffff memory:90060000-9007ffff
  *-network DISABLED
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:84:00.0
       logical name: enp132s0
       version: 06
       serial: 00:13:3b:11:40:dc
       size: 10Mbit/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=half latency=0 link=no multicast=yes port=MII speed=10Mbit/s
       resources: irq:37 ioport:e000(size=256) memory:f2204000-f2204fff memory:f2200000-f2203fff
  *-network DISABLED
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:85:00.0
       logical name: enp133s0
       version: 06
       serial: 00:13:3b:11:40:dd
       size: 10Mbit/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=half latency=0 link=no multicast=yes port=MII speed=10Mbit/s
       resources: irq:37 ioport:d000(size=256) memory:f2104000-f2104fff memory:f2100000-f2103fff

cat /etc/netplan/*.yaml

network:
 ethernets:
  enp4s0f0:
   addresses: [192.168.0.04/24]
   dhcp4: true
   gateway4: 192.168.0.1
   nameservers:
    addresses: [8.8.8.8,8.8.4.4]
 version: 2

Note: The above IP address, I'm not sure if I typed that (and did a typo when i did, since last time I was trying to get this working the server showed up in the Routers admin with a .104 IP, not a .04 IP - And at the time of writing this, the server isn't showing up in the Routers admin at all.

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

And here are the network details when I check within the Router's admin screen;

Router's IP Address: 192.168.0.1
Router's Subnet Mask: 255.255.255.0

Update 2

Ok, so after writing the above update about 5 minutes ago, I think I've actually got this working (sometimes all you need is some time to stop working on something then come back to it another day!)

So here's what I did, I simply changed the following file so it looks like this instead;

cat /etc/netplan/*.yaml

network:
 ethernets:
  enp4s0f0:
   dhcp4: true
 version: 2

Which I can only assume that because the other bits were in there previously, that Netplan thought that the router was configured with a static IP address rather than a dynamic IP address - or getting confused somewhere along the way since the settings look to be telling itself that it is both static (with the 'addresses' setting) and dynamic (with the 'dhcp4' setting) at the same time.

It'd be good to understand exactly why what I have changed actually works - is my assumption above correct?

In addition, does the filename of the .yaml file within /etc/netplan/ actually matter? Not really sure where this comes from, since I recall that the filename is different now than what it was previously when I was deleting / recreating the files.

BTW - This is just a test system I'm working on - hence why I can safely just delete things, screw it all up, and try and fix it :-) Trying to get a much better understanding of the Ubuntu/Linux architecture and playing around at the minute.

  • 1
    You won't make things better by deleting a bunch of system files. However, show me sudo lshw -C network and cat /etc/netplan/*.yaml and cat /etc/network/interfaces. Do you use static IP or dynamic (dhcp) addressing for the server? Give me the network detail. – heynnema May 25 '19 at 21:51
  • Thanks @heynnema I've updated the question with further information as requested. – Michael Cropper May 27 '19 at 13:30
1

Your /etc/netplan/*.yaml file is incorrect for two reasons:

  • you've mixed and matched dynamic and static definitions

  • you put an invalid static address that contains .04

If you need static addressing, the .yaml file should look something like this...

network:
  version: 2
  renderer: networkd
  ethernets:
    enp4s0f0:
      addresses: [192.168.0.4/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]

If you need dynamic addressing, the .yaml file should look something like this...

network:
  version: 2
  renderer: networkd
  ethernets:
    enp4s0f0:
      dhcp4: true
      dhcp4-overrides:
        use-dns: false
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]

sudo netplan --debug generate # make config files

sudo netplan apply # apply new configuration

reboot # confirm configuration

| improve this answer | |
  • Much appreciated, thanks for the clarification. – Michael Cropper May 27 '19 at 14:40

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.