zesa
Posts: 8
Joined: Fri Jul 06, 2018 9:46 pm

create DHCP server

Fri Jul 06, 2018 10:12 pm

Hi guys,

I have a fritzbox with his own dhcp server and a managed switch.
now i want to create a addional VPN ID on my switch with his own dhcp server over raspberry.

the raspberry is connected over wifi with the fritzbox and has internet.
the raspberry is connected over lan with VLAN002.

now my first step was configured static ips for wlan0 and eth0

Code: Select all

File: /etc/dhcpcd.conf    
# vlan ip gateway
interface eth0
static ip_address=192.168.17.1/24
static routers=192.168.17.1
static domain_name_servers=192.168.17.1

# connect to fritzbox
interface wlan0
static ip_address=192.168.178.15/24
static routers=192.168.178.1
static domain_name_servers=192.168.178.1
the next step was to install the dhcp server and configure the file:

Code: Select all

authoritative;
option domain-name "zesa.int";
option domain-name-servers 192.168.17.253;
option broadcast-address 192.168.17.0;
default-lease-time 600;
max-lease-time 7200;

subnet 192.168.17.0 netmask 255.255.240.0 {
   range 192.168.17.10 192.168.17.250;
   option routers 192.168.17.253;
   interface eth0;
}
but the dhcp server doesnt work.
and i dont know why:

Code: Select all

 isc-dhcp-server.service - LSB: DHCP server
   Loaded: loaded (/etc/init.d/isc-dhcp-server; generated; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-07-06 22:11:19 UTC; 2s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1579 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)
   CGroup: /system.slice/isc-dhcp-server.service
           └─894 /usr/sbin/dhcpd -4 -q -cf /etc/dhcp/dhcpd.conf eth0

Jul 06 22:11:19 emil isc-dhcp-server[1579]: Configuration file errors encountered -- exiting
Jul 06 22:11:19 emil isc-dhcp-server[1579]: If you think you have received this message due to a bug r
Jul 06 22:11:19 emil isc-dhcp-server[1579]: than a configuration issue please read the section on subm
Jul 06 22:11:19 emil isc-dhcp-server[1579]: bugs on either our web page at www.isc.org or in the READM
Jul 06 22:11:19 emil isc-dhcp-server[1579]: before submitting a bug.  These pages explain the proper
Jul 06 22:11:19 emil isc-dhcp-server[1579]: process and the information we find helpful for debugging.
Jul 06 22:11:19 emil isc-dhcp-server[1579]: exiting.
Jul 06 22:11:19 emil systemd[1]: Failed to start LSB: DHCP server.
Jul 06 22:11:19 emil systemd[1]: isc-dhcp-server.service: Unit entered failed state.
Jul 06 22:11:19 emil systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
any ideas?

thanks

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: create DHCP server

Sat Jul 07, 2018 3:41 pm

zesa wrote:
Fri Jul 06, 2018 10:12 pm

Code: Select all

subnet 192.168.17.0 netmask 255.255.240.0 {
Your netmask should be 255.255.255.0
Dnsmasq is easier to setup and it does DNS and DNS-DHCP.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

zesa
Posts: 8
Joined: Fri Jul 06, 2018 9:46 pm

Re: create DHCP server

Sun Jul 08, 2018 7:35 pm

doesnt work.
i had changed the subnet and installed also dnsmasq
see below.

what is the reason?


Code: Select all

sudo systemctl status dnsmasq
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2018-07-08 19:34:08 UTC; 5s ago
  Process: 20397 ExecStop=/etc/init.d/dnsmasq systemd-stop-resolvconf (code=exited, status=0/SUCCESS)
  Process: 589 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
  Process: 20450 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2)
  Process: 20447 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
 Main PID: 584 (code=exited, status=0/SUCCESS)

Jul 08 19:34:08 emil systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Jul 08 19:34:08 emil dnsmasq[20447]: dnsmasq: syntax check OK.
Jul 08 19:34:08 emil dnsmasq[20450]: dnsmasq: failed to bind DHCP server socket: Address already in use
Jul 08 19:34:08 emil systemd[1]: dnsmasq.service: Control process exited, code=exited status=2
Jul 08 19:34:08 emil systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Jul 08 19:34:08 emil systemd[1]: dnsmasq.service: Unit entered failed state.
Jul 08 19:34:08 emil systemd[1]: dnsmasq.service: Failed with result 'exit-code'.

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: create DHCP server

Sun Jul 08, 2018 9:21 pm

It's written there

Code: Select all

Jul 08 19:34:08 emil dnsmasq[20450]: dnsmasq: failed to bind DHCP server socket: Address already in use
1 - Uninstall dhcdp and reboot
2 - Remove option "bind-interfaces" from dnsmasq.conf if you included it
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

zesa
Posts: 8
Joined: Fri Jul 06, 2018 9:46 pm

Re: create DHCP server

Mon Jul 09, 2018 9:07 pm

ok thanks it looks fine.

now, how can I route from wlan0 -> eth0 (192.168.178.x -> 192.168.17.x)...

how can I do this?

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: create DHCP server

Mon Jul 09, 2018 9:11 pm

Good.
You have to setup routing between wlan and eth. That is a different topic.
I would advise you lookup the forums and if you don’t see the answer or can’t get it to work, open a new thread.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Beginners”