Score:0

Ubuntu Server 20.04 installing a dhcp without internet access

br flag

I've just recently set up my Ubuntu Server 20.04 and now I'm trying to install a DHCP server.

But it always fails because I get

Temporary failure resolving 'archives.ubuntu.com'

Is there any way I can set up my network without internet access? Are there any alternatives?

Thanks in advance

Score:2
kr flag

You could use systemd-networkd.service to provide you with a DHCP-server, this is already installed at your Ubuntu machine.

Open a terminal and type networkctl and look for your network interface name which shall host your DHCP-server, for example eth0, after that change directory via cd /etc/systemd/network and create a network-file with a name as you like, for example via sudo nano eth0.network.

/etc/systemd/network/eth0.network

[Match]
Name=eth0   

[Network]
DHCPServer=yes
Address=192.168.0.1/24
ConfigureWithoutCarrier=yes

[DHCPServer]
PoolOffset=100
PoolSize=100

More options are to be found in manpage man systemd.network.

After you have finished your config, enable systemd-networkd.service via:

sudo systemctl enable systemd-networkd.service &&\
sudo systemctl restart systemd-networkd.service

And view your settings via networkctl again.

PS you should edit your /etc/resolv.conf via sudo nano /etc/resolv.conf and add some nameservers there, for example Google DNS: nameserver 8.8.8.8.

PPS better use systemd-resolved.service in combination with a bind9 server.

random person avatar
br flag
Do I need to make a static IP on my Server first? And I understand the Poolsize but what exactly is the PoolOffset?
paladin avatar
kr flag
Of course you need a static IP for your DHCP-server: `Address=192.168.0.1/24`. PS don't use ifconfig and also don't use ifupdown (don't use `/etc/network/interfaces`). `systemd-networkd.service` will handle all by itself.
paladin avatar
kr flag
You may read the manpage `man systemd.network`. `PoolOffset=100` means that the first DHCP assigned IP will start at `192.168.0.100`, instead of `192.168.0.0` (which is the network address, and 192.168.0.1 is your DHCP-server addresse, so without `PoolOffset=100`, the first assignable IP address would be `192.168.0.2`).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.