How to install and configure DHCP server on Ubuntu

Поділитися
Вставка
  • Опубліковано 31 січ 2025

КОМЕНТАРІ • 28

  • @StudioSWATcraftCZ
    @StudioSWATcraftCZ Рік тому +1

    Hi! I passed your video step by step but my client computer did not get ip address from dhcp server. The problem is that client cant listening on port 68. I used command: sudo netstat -ulnp | grep 68 but I could not see that ... :( Do you have any idea? I use Virtual box for both devices (dhcp and client) I have Ubuntu 22.4.3

    • @GulianTechnology
      @GulianTechnology  Рік тому

      Make sure that the dhclient is running on the client machine. Otherwise, you will not find UDP port 68 in a listening state.
      Output from my machine.
      petru@petru-ubuntu:~$ ps aux | grep dhclient
      petru 3428 0.0 0.0 9072 2304 pts/0 S+ 14:41 0:00 grep --color=auto dhclient
      petru@petru-ubuntu:~$ sudo dhclient
      petru@petru-ubuntu:~$ ps aux | grep dhclient
      root 3650 0.0 0.0 4060 3072 ? Ss 14:44 0:00 dhclient
      petru 3745 0.0 0.0 9072 2304 pts/0 S+ 14:44 0:00 grep --color=auto dhclient
      petru@petru-ubuntu:~$ sudo netstat -ulnp | grep dhclient
      udp 0 0 0.0.0.0:68 0.0.0.0:* 3650/dhclient
      petru@petru-ubuntu:~$

    • @StudioSWATcraftCZ
      @StudioSWATcraftCZ Рік тому +1

      Alright I will try it. Do I have to change something in virtual box? Like adapter or something like that? @@GulianTechnology

    • @GulianTechnology
      @GulianTechnology  Рік тому

      @@StudioSWATcraftCZ As far as I know, you do not need to change anything.

  • @JayRamirez-o8o
    @JayRamirez-o8o Рік тому +1

    When checking the server status. My own showed Active: failed. I'm trying to exit this page to go back to the page where I can start inputting commands but the command u used to exit isn't doing it. I'm sure it's that ESC :x

    • @GulianTechnology
      @GulianTechnology  Рік тому

      You need to press the 'q' on your keyboard and you will be able to exit from the command systemctl status isc-dhcp-server. To have the DHCPd server in an active state you need to have an interface with an IP address from the CIDR range defined in the dhpd.conf file.
      petru@petru-ubuntu:~$ systemctl status isc-dhcp-server
      × isc-dhcp-server.service - ISC DHCP IPv4 server
      Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; enabled; preset: e>
      Active: failed (Result: exit-code) since Thu 2024-01-11 11:48:24 GMT; 9min ago
      Duration: 56ms
      Docs: man:dhcpd(8)
      Main PID: 1786 (code=exited, status=1/FAILURE)
      CPU: 19ms
      Jan 11 11:48:24 petru-ubuntu sh[1786]: bugs on either our web page at www.isc.org or>
      Jan 11 11:48:24 petru-ubuntu dhcpd[1786]: before submitting a bug. These pages expl>
      Jan 11 11:48:24 petru-ubuntu sh[1786]: before submitting a bug. These pages explain>
      Jan 11 11:48:24 petru-ubuntu dhcpd[1786]: process and the information we find helpfu>
      Jan 11 11:48:24 petru-ubuntu sh[1786]: process and the information we find helpful f>
      Jan 11 11:48:24 petru-ubuntu dhcpd[1786]:
      Jan 11 11:48:24 petru-ubuntu dhcpd[1786]: exiting.
      Jan 11 11:48:24 petru-ubuntu sh[1786]: exiting.
      Jan 11 11:48:24 petru-ubuntu systemd[1]: isc-dhcp-server.service: Main process exite>
      Jan 11 11:48:24 petru-ubuntu systemd[1]: isc-dhcp-server.service: Failed with result>
      lines 1-18/18 (END)

    • @GulianTechnology
      @GulianTechnology  Рік тому

      After configuring the IP address on the interface from the same CIDR range defined in the dhpd.conf file.
      petru@petru-ubuntu:~$ systemctl status isc-dhcp-server
      ● isc-dhcp-server.service - ISC DHCP IPv4 server
      Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; enabled; preset: e>
      Active: active (running) since Thu 2024-01-11 12:01:31 GMT; 3min 0s ago
      Docs: man:dhcpd(8)
      Main PID: 3270 (dhcpd)
      Tasks: 1 (limit: 4557)
      Memory: 3.7M
      CPU: 12ms
      CGroup: /system.slice/isc-dhcp-server.service
      └─3270 dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcpd.>
      Jan 11 12:01:31 petru-ubuntu dhcpd[3270]: in your dhcpd.conf file for the network>
      Jan 11 12:01:31 petru-ubuntu dhcpd[3270]: to which interface ens37 is attached. **
      Jan 11 12:01:31 petru-ubuntu dhcpd[3270]:
      Jan 11 12:01:31 petru-ubuntu dhcpd[3270]: Listening on LPF/ens33/00:0c:29:cf:9c:36/1>
      Jan 11 12:01:31 petru-ubuntu sh[3270]: Listening on LPF/ens33/00:0c:29:cf:9c:36/172.>
      Jan 11 12:01:31 petru-ubuntu sh[3270]: Sending on LPF/ens33/00:0c:29:cf:9c:36/172.>
      Jan 11 12:01:31 petru-ubuntu sh[3270]: Sending on Socket/fallback/fallback-net
      Jan 11 12:01:31 petru-ubuntu dhcpd[3270]: Sending on LPF/ens33/00:0c:29:cf:9c:36/1>
      Jan 11 12:01:31 petru-ubuntu dhcpd[3270]: Sending on Socket/fallback/fallback-net
      petru@petru-ubuntu:~$

  • @aditijadia7336
    @aditijadia7336 Місяць тому +1

    I followed the video step-by-step, yet I see Active:failed. I do not wish to add the ip addr to the enp1s0, rather need a permanent solution. I have Ubuntu lionux as an OS. Can you guide me further? Thank you!

    • @GulianTechnology
      @GulianTechnology  Місяць тому

      @aditijadia7336 Check the blog post for more details: gulian.uk/how-to-install-and-configure-dhcp-server-on-ubuntu/. If the service still doesn't work, please share the configuration of your DHCP server and the output of the ip address show command.

  • @cseiter
    @cseiter 6 місяців тому

    Thank you for this guide. Just got an offline network up and running with clients getting DHCP from the server. The only issue I ran in to was I was trying for a class B subnet and the conf file didn't like it. Once I ran "journalctl -n 50 -u isc-dhcp-server.service" it showed in the config file what I did wrong.

    • @GulianTechnology
      @GulianTechnology  6 місяців тому

      You're welcome, @cseiter! I'm glad it was helpful to you. :)

  • @MichaelvanDieman
    @MichaelvanDieman Рік тому +1

    Is there a way I can contact you to discuss more?

    • @GulianTechnology
      @GulianTechnology  Рік тому

      You can find me here: www.linkedin.com/in/petru-gulian/ or here: office@gulian.uk

  • @MichaelvanDieman
    @MichaelvanDieman Рік тому +1

    Helo, I have followed all your steps but still get an error.

    • @GulianTechnology
      @GulianTechnology  Рік тому

      What error do you see? You can share it in a comment. If we manage to solve this issue, others will also benefit from it.

    • @MichaelvanDieman
      @MichaelvanDieman Рік тому +1

      @@GulianTechnology I receive and error stating that it's not configured to any interfaces, now just to give you some perspective, I'm running a LTE modem/router on WiFi but trying to get DHCP on the Gigabit Port, the LTE router is providing DHCP itself, but I disconnect from it when I try to run the Ubuntu machine as server

    • @MichaelvanDieman
      @MichaelvanDieman Рік тому +1

      I release that I have nothing plugged in on the LAN port, should I connect a small switch?? Also the whole idea is- I want to decommission my windows server and move the firewall traffic from the windows to the Linux machine which will act as a server

    • @GulianTechnology
      @GulianTechnology  Рік тому

      Please share the output of these 3 commands:
      1. ip add show
      2. systemctl status isc-dhcp-server
      3. cat /etc/dhcp/dhcpd.conf

    • @GulianTechnology
      @GulianTechnology  Рік тому

      "I release that I have nothing plugged in on the LAN port, should I connect a small switch??" - Of course, you need to have something connected to the port on which DHCP will be running.