Community discussions

MikroTik App
 
evansnp
just joined
Topic Author
Posts: 2
Joined: Tue Mar 07, 2023 3:41 pm

Unable to get address from DHCP server on VLAN

Wed Mar 08, 2023 12:18 pm

I'm in the process of replacing two Cisco small business switches with two CRS326-24G-2S+, but have fallen at the first hurdle of getting DHCP to work on VLAN interfaces. The end result that I am striving for is this: Switch1 (CEB-Office) will have a PPOE connection on ether1 (currently just a routed link to my home network), and a trunk to switch2 on ether24. There will be two VLANs, 11 & 42, and the remaining ports will be assigned as needed. My issue is that I cannot get the DHCP servers to offer addresses to clients. I have followed various courses that tell me how to do it, but whatever I do it still doesn't work. Below is a test config that I created after flattening the switch:
# mar/08/2023 10:00:15 by RouterOS 7.8
# software id = Y9ZI-EIWZ
#
# model = CRS326-24G-2S+
# serial number = xxxxxxxxxxx
/interface bridge
add ingress-filtering=no name=bridge vlan-filtering=yes
/interface vlan
add interface=ether24 name=vlan11 vlan-id=11
add interface=ether24 name=vlan42 vlan-id=42
add interface=bridge name=vlan99 vlan-id=99
/interface ethernet switch
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip hotspot profile
set [ find default=yes ] html-directory=hotspot
/ip pool
add name=dhcp_pool0 ranges=192.168.11.2-192.168.11.254
add name=dhcp_pool1 ranges=192.168.42.2-192.168.42.254
add name=dhcp_pool2 ranges=192.168.11.2-192.168.11.254
add name=dhcp_pool3 ranges=192.168.42.2-192.168.42.254
/ip dhcp-server
add address-pool=dhcp_pool2 interface=vlan11 name=dhcp1
add address-pool=dhcp_pool3 interface=vlan42 name=dhcp2
/port
set 0 name=serial0
/interface bridge port
add bridge=bridge interface=ether2 pvid=11
add bridge=bridge interface=ether9 pvid=42
add bridge=bridge interface=ether24
/ip neighbor discovery-settings
set discover-interface-list=!dynamic
/interface bridge vlan
add bridge=bridge tagged=ether24 untagged=ether2 vlan-ids=11
add bridge=bridge tagged=ether24 untagged=ether9 vlan-ids=42
add bridge=bridge tagged=ether24,bridge vlan-ids=99
/ip address
add address=192.168.99.1/24 interface=vlan99 network=192.168.99.0
add address=192.168.11.1/24 interface=vlan11 network=192.168.11.0
add address=192.168.42.1/24 interface=vlan42 network=192.168.42.0
/ip dhcp-client
add interface=ether1
/ip dhcp-server network
add address=192.168.11.0/24 gateway=192.168.11.1
add address=192.168.42.0/24 gateway=192.168.42.1
/system clock
set time-zone-name=Europe/London
/system identity
set name=CEB-Office
/system routerboard settings
set boot-os=router-os
Any help gratefully received :-)
 
sid5632
Long time Member
Long time Member
Posts: 554
Joined: Fri Feb 17, 2017 6:05 pm

Re: Unable to get address from DHCP server on VLAN  [SOLVED]

Thu Mar 09, 2023 1:06 am

/interface vlan
add interface=ether24 name=vlan11 vlan-id=11
add interface=ether24 name=vlan42 vlan-id=42
These should be "interface=bridge".
/ip pool
add name=dhcp_pool0 ranges=192.168.11.2-192.168.11.254
add name=dhcp_pool1 ranges=192.168.42.2-192.168.42.254
add name=dhcp_pool2 ranges=192.168.11.2-192.168.11.254
add name=dhcp_pool3 ranges=192.168.42.2-192.168.42.254
Delete the obvious duplicates. You're not using pool0 and pool1.
/ip dhcp-server
add address-pool=dhcp_pool2 interface=vlan11 name=dhcp1
add address-pool=dhcp_pool3 interface=vlan42 name=dhcp2
You need to add "disabled=no" to both.
/interface bridge vlan
add bridge=bridge tagged=ether24 untagged=ether2 vlan-ids=11
add bridge=bridge tagged=ether24 untagged=ether9 vlan-ids=42
add bridge=bridge tagged=ether24,bridge vlan-ids=99
Remove the untagged=etherX items on both. They are inferred from the bridge port configuration.
You also need to add "bridge" to the tagged list, like you did for vlan99. Those three lines should be the same, apart from the vlan-ids obviously.
 
evansnp
just joined
Topic Author
Posts: 2
Joined: Tue Mar 07, 2023 3:41 pm

Re: Unable to get address from DHCP server on VLAN

Fri Mar 10, 2023 12:29 pm

Thanks @sid5632 , that's done the trick :-) Thanks a million for your help!

Who is online

Users browsing this forum: yosue111 and 36 guests