2

I'm new to Linux and learning. I'm not the person that set these systems up - but I need to understand and manage them now.

In /etc/netplan - both 01-netcfg.yaml and 50-cloud-init.yaml exist.

The 01 file - is static - showing 192.168.100.30 the 50 file - is dhcp

the 100.30 address is visible when I do an ipconfig -a. The 100.50 address is not visible anywhere that I have found. I don't need dhcp - the server should be set to the 100.30 static IP only.

Can I simply delete the 50-cloud-init.yaml file - or what is best practice?

results of ifconfig -a:

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:c0:4b:ea:91  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.30  netmask 255.255.255.0  broadcast 192.168.100.255
        inet6 fe80::215:5dff:fe00:700e  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:00:70:0e  txqueuelen 1000  (Ethernet)
        RX packets 17211039  bytes 1688816727 (1.6 GB)
        RX errors 0  dropped 4  overruns 0  frame 0
        TX packets 137882  bytes 550823194 (550.8 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 11147  bytes 843462 (843.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11147  bytes 843462 (843.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

@heynnema Contents of 01-netcfg.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses: [192.168.100.30/24]
      gateway4: 192.168.100.1
      nameservers:
        addresses: [192.168.100.26,192.168.100.19,8.8.8.8,8.8.4.4]

Contents of 50-cloud-init.yaml

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            addresses: []
            dhcp4: true
    version: 2

Contents of /etc/netork/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
muru
  • 207,228
jim459
  • 25

2 Answers2

2

The two files differ in that one uses static IP addresses, and the other uses dhcp. As long as the addresses are appropriate for your network, just use /etc/netplan/01-netcfg.yaml. Remove /etc/netplan/50-cloud-init.yaml.

Use this .yaml... but with no dhcp4, and max 3 DNS (comma-space) servers...

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses: [192.168.100.30/24]
      gateway4: 192.168.100.1
      nameservers:
        addresses: [192.168.100.26, 192.168.100.19]

sudo netplan --debug generate

sudo netplan apply

reboot

heynnema
  • 73,649
1

Both config yaml files have same interface name.

First netplan config file name is starting 01... According to the string order 01 is before 50. So 01-netcfg.yaml file works first.

And you have not DHCP server.

In this case, the file 50-cloud-init.yaml is not needed

Ramazan Oz
  • 31
  • 3