6

I’m running an Ubuntu 17.10 server for my game servers since its the only platform where Steam is supported by Valve. It’s a new Ubuntu 17.10 install without any major changes in the install.

I have set a static IP address in /etc/network/interfaces but my card keeps recieving a DHCP address as well. So basically the server has my static ip 192.168.1.13 and a DHCP address 192.168.1.226.

But how can I stop the dhcpclient from acquiring a DHCP assigned IP address?

My network interface shows:

auto ens18
iface ens18 inet static
    address 192.168.1.13
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 192.168.1.1
0

2 Answers 2

6

Networking changed in Ubuntu 17.10 so adding anything to /etc/network/interfaces won't change anything. It now uses Netplan.

To disable DHCP and set a static IP:

First, find out what your network interface is called, run ls /sys/class/net

The output will probably be something like enp6s0 lo.

lo is the loopback interface so enp6s0 will be your network interface (in this example).

Create a new config file inside of /etc/netplan

e.g sudo nano /etc/netplan/02-netcfg.yaml

Enter the following to configure a static IP of 192.168.1.13 where enp6s0 is the name of your network interface.

network:
    version: 2
    renderer: networkd
    ethernets:
        enp6s0:
            addresses: [192.168.1.13/24]
            dhcp4: no
            gateway4: 192.168.1.1

Then run the following two commands:

sudo netplan generate
sudo netplan apply
1
  • Probably, you need add nameservers: addresses: [192.168.1.1] at the end of file Commented Aug 3, 2020 at 12:41
1

If you are on Ubuntu 20.04 on a RaspberryPI, cloud-init is the culprit as can be witnessed from the file /etc/netplan/50-cloud-init.yaml

Simply delete the file or comment out the offending lines

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .