6

I'm following this tutorial for making an Ubuntu active directory domain controller with Samba.

The problem I have run into, is that he is using Ubuntu Server 13.10, and I am using the latest, 18.04. Somewhere between these 2 versions, Ubuntu stopped using /etc/network/interfaces and started using netplan.

Therefore, when he says to modify /etc/network/interfaces, and add:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

address 192.168.2.100
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
dns-nameservers 192.168.1.100 8.8.8.8
dns-search <domain name>.local

I get an error message that says:

ifupdown has been replaced by netplan(5) on this system.

I did some research, and found that now this should be stored in /etc/netplan/01-netcfg.yaml. This file does not exist. Should I create it? Also, what is the equivalent of what he said to put in the file, for netplan?

Edit: The output for ls /etc/netplan is 50-cloud-init.yaml, and the output for cat /etc/netplan/*.yaml is:

# 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:
        enp0s3:
            addresses: []
            dhcp4: true
            optional: true
    version: 2
  • 1
    Please edit your question to add the result of the terminal commands: ls /etc/netplan and also: cat /etc/netplan/*.yaml Welcome to Ask Ubuntu. – chili555 Jul 3 '18 at 0:32
  • @chili555 I edited it with the information you requested. Thanks – user7391836 Jul 3 '18 at 1:22
  • Is this a cloud instance or a virtual machine or a simple (home?) server? – chili555 Jul 3 '18 at 20:31
  • Currently it's a virtual machine, but if it works, I will configure an actual server the same way. – user7391836 Jul 3 '18 at 20:37
  • Convert to a simple (home?) server or a cloud instance? – chili555 Jul 3 '18 at 20:43
3

First, let’s follow the recommendation included in the 50-cloud-init.yaml file. Please open a terminal and do:

sudo -i
echo "network: {config: disabled}"  >  /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
exit

Next, let’s remove the file and simultaneously back it up:

sudo mv /etc/netplan/50-cloud-init.yaml  ~/50-cloud-init.yaml

Next, verify the ethernet interface name with the command:

ifconfig

Substitute the interface you found below if not enp0s3.

Now let’s write a new file:

sudo nano /etc/netplan/01-netcfg.yaml

Write the following:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      addresses:
        - 192.168.2.100/24
      gateway4: 192.168.2.1
      nameservers:
          search: [<domain name>.local]
          addresses: [192.168.1.100, 8.8.8.8]

Spacing, indentation, etc. are crucial and must be exact. Proofread carefully twice. Save (Ctrl+o followed by Enter) and exit (Ctrl+x) the text editor.

Now do:

sudo netplan apply

Reboot.

| improve this answer | |
  • It worked for me when I changed the "1" in addresses: [192.168.1.100, 8.8.8.8] to a "2", to match 192.168.2.100/24. Is that a typo or is it supposed to be different? – user7391836 Jul 4 '18 at 23:12
  • 1
    I simply transferred your numbers from your original question. I assumed, guessed, really, that you used hypothetical numbers in your question. In fact, I suspect that the DNS nameserver should be 192.168.2.1 8.8.8.8. Glad it's working! – chili555 Jul 4 '18 at 23:49

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.