Community discussions

MikroTik App
 
mjuliov
just joined
Topic Author
Posts: 9
Joined: Wed Aug 09, 2023 7:25 pm

VLAN DHDP-Relay

Fri Aug 11, 2023 10:15 pm

Hello everyone,
I am new to MikroTik, and have basic networks know-how

I have tried to reproduce the example from the manual
https://wiki.mikrotik.com/wiki/Manual:IP/DHCP_Relay

but instead of one router as DHCP-Relay and another as DHCP-Server, the two networks conected to the DHCP-Relay are two VLANs in the same DHCP-Server.
Here is my configuration
Interfaces:
[admin@VdP4071] /ip dhcp-relay> /interface print
Flags: D - dynamic, X - disabled, R - running, S - slave
# NAME TYPE ACTUAL-MTU L2MTU MAX-L2MTU
0 R ether1 ether 1500 1600 4076
1 R ether2 ether 1500 1598 2028
2 ether3 ether 1500 1598 2028
3 ether4 ether 1500 1598 2028
4 R ether5-Management ether 1500 1598 2028
5 X wlan1 wlan 1500 1600 2290
6 R General vlan 1500 1594
7 R Contaduria vlan 1500 1594


admin@VdP4071] > /ip address
[admin@VdP4071] /ip address> print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK INTERFACE
0 192.168.0.2/24 192.168.0.0 ether3
1 192.168.100.0/24 192.168.100.0 ether2
2 192.168.88.1/24 192.168.88.0 ether5-Management
3 D 190.192.187.201/24 190.192.187.0 ether1
4 192.16.30.1/24 192.16.30.0 Contaduria
5 192.168.1.1/24 192.168.1.0 General

DHCP Servers:
[admin@VdP4071] /ip address> /ip dhcp-server
[admin@VdP4071] /ip dhcp-server> print
Flags: D - dynamic, X - disabled, I - invalid
# NAME INTERFACE RELAY ADDRESS-POOL LEASE-TIME ADD-ARP
0 dhcp1 ether5-Man... *2 10m
1 dhcp2 ether2 192.168.1.1 pool1 10m

The problem is, when connecting a PC to the VLAN, it does not get IP address

I don't find anything wrong in this configuration, I mean, its a copy from the manual example.
Maybe what I want to do is not posible?

Thank you in advance,
Julio
 
User avatar
k6ccc
Forum Guru
Forum Guru
Posts: 1610
Joined: Fri May 13, 2016 12:01 am
Location: Glendora, CA, USA (near Los Angeles)
Contact:

Re: VLAN DHDP-Relay

Fri Aug 11, 2023 11:11 pm

Your description and minimal config does not really give enough useful information. Please post a network drawing and export your configuration. To export and paste your configuration (and I'm assuming you are using WebFig or Winbox), open a terminal window, and type (without the quotes) "/export hide-sensitive file=any-filename-you-wish". Then open the files section and right click on the filename you created and select download in order to download the file to your computer. It will be a text file with whatever name you saved to with an extension of .rsc. Suggest you then open the .rsc file in your favorite text editor and redact any sensitive information. Then in your message here, click the code display icon in the toolbar above the text entry (the code display icon is the 7th one from the left and looks like a square with a blob in the middle). Then paste the text from the file in between the two code words in brackets.
 
mjuliov
just joined
Topic Author
Posts: 9
Joined: Wed Aug 09, 2023 7:25 pm

Re: VLAN DHDP-Relay

Wed Aug 23, 2023 5:00 pm

Thank you for your response.
This is the configuration:
# aug/17/2023 15:59:19 by RouterOS 6.46.2
# software id = REA1-QLCC
#
# model = 751U-2HnD
# serial number = 46ED02E1EDC3
/interface wireless
set [ find default-name=wlan1 ] ssid=MikroTik
/interface ethernet
set [ find default-name=ether1 ] mac-address=00:50:7F:C0:87:79 name=\
ether1-WAN
set [ find default-name=ether2 ] name=ether2
set [ find default-name=ether3 ] name=ether3
set [ find default-name=ether5 ] name=ether5
/interface vlan
add interface=ether2 name=Ventas vlan-id=1
add interface=ether2 name=Contaduria vlan-id=2
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=pool1 ranges=192.168.1.100-192.168.1.199
add name=pool2 ranges=192.168.88.100-192.168.88.199
/ip dhcp-server
add address-pool=pool2 disabled=no interface=ether5-Management name=dhcp1
add address-pool=pool1 disabled=no interface=ether2 name=dhcp2 relay=\
192.168.1.1
/ip address
add address=192.168.0.2/24 interface=ether3 network=192.168.0.0
add address=192.168.100.1/24 interface=ether2 network=192.168.100.0
add address=192.168.88.1/24 interface=ether5 network=192.168.88.0
add address=192.16.30.1/24 interface=Contaduria network=192.16.30.0
add address=192.168.1.1/24 interface=Ventas network=192.168.1.0
/ip dhcp-client
add disabled=no interface=ether1-WAN
/ip dhcp-relay
add dhcp-server=192.168.100.1 disabled=no interface=Ventas local-address=\
192.168.1.1 name=relay-ether2
/ip dhcp-server network
add address=192.168.1.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.1.1
add address=192.168.88.0/24 dns-server=8.8.8.8 gateway=192.168.88.1
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/ip firewall filter
add action=passthrough chain=forward comment="Dummy rule to show counters"
add action=drop chain=input comment="Drop invalid " connection-state=invalid
add action=accept chain=input comment="Accept established connections" \
connection-state=established,related,untracked
add action=accept chain=input comment="Accept icmp" log-prefix=icmp protocol=\
icmp
add action=accept chain=input comment="allow UDP" protocol=udp
add action=accept chain=input comment="Accept SYN from LAN" connection-state=\
new in-interface=!ether1-WAN log-prefix=" "
add action=drop chain=input comment="Drop from WAN, else Accept" \
in-interface=ether1-WAN log-prefix="WAN "
add action=drop chain=forward comment="Drop invalid connections" \
connection-state=invalid ipsec-policy=in,ipsec
add action=accept chain=forward comment="Allow established connections" \
connection-state=established,related
add action=accept chain=forward protocol=icmp
/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether1-WAN
/ip firewall service-port
set sip disabled=yes
/ip route
add distance=1 dst-address=192.168.0.0/24 gateway=192.168.0.5
add disabled=yes distance=1 dst-address=192.168.1.0/24 gateway=192.168.1.1
/ip service
set telnet disabled=yes
set ftp disabled=yes
set www-ssl disabled=no
/system clock
set time-zone-name=America/Argentina/Buenos_Aires
/system identity
set name=MikroTik
/system logging
set 0 action=disk prefix=info
add action=disk prefix=firewall topics=firewall
You do not have the required permissions to view the files attached to this post.
 
McGremlin
Frequent Visitor
Frequent Visitor
Posts: 95
Joined: Fri Jun 16, 2023 12:12 pm

Re: VLAN DHDP-Relay

Wed Aug 23, 2023 7:53 pm

I have tried to reproduce the example from the manual
https://wiki.mikrotik.com/wiki/Manual:IP/DHCP_Relay

but instead of one router as DHCP-Relay and another as DHCP-Server, the two networks conected to the DHCP-Relay are two VLANs in the same DHCP-Server.
Could you explain why? Are you aware that you can have two DHCP servers, one per VLAN?
 
mjuliov
just joined
Topic Author
Posts: 9
Joined: Wed Aug 09, 2023 7:25 pm

Re: VLAN DHDP-Relay

Thu Aug 24, 2023 4:23 pm

I tried that option too, but didnt work
Of course associating the DHCP-Server with the VLAN interface instead of relaying is more straighforward

Thanks
 
McGremlin
Frequent Visitor
Frequent Visitor
Posts: 95
Joined: Fri Jun 16, 2023 12:12 pm

Re: VLAN DHDP-Relay

Thu Aug 24, 2023 9:39 pm

The problem is, when connecting a PC to the VLAN, it does not get IP address

I don't find anything wrong in this configuration, I mean, its a copy from the manual example.
Maybe what I want to do is not posible?
Option with 2 DHCP servers is 100% doable. I don't know about DHCP Relay and Server on one device.
I have 2 DHCP pools on my domain controller DHCP server which is in VLAN 50 - one for VLAN 50 and one for VLAN 253. On gateway I have a bunch of other vlans and DHCP servers, but I wanted to have this particular one (253) on DC, so I used DHCP Relay on Mikrotik to point it out for VLAN 253.
Is there a reason in your case for trying to use this functionality? Or you just want to get IP addresses dynamicly in both VLAN's? And do you need more assistance with this or at the moment it's "suspended" on the forum?
 
mjuliov
just joined
Topic Author
Posts: 9
Joined: Wed Aug 09, 2023 7:25 pm

Re: VLAN DHDP-Relay

Fri Aug 25, 2023 11:20 pm

Please refer to the scheme I have attached in a previous post.
I want the Vlan-2 to be a subnet for the Accounting department, and to be separated from the rest of the company, which is connected to the Vlan-1
If the subnet Vlan-2 could be physically conected to one of the router's hardware interfaces, and the Vlan-1 to another, then that solution would make the "software" much easier.
Unfortunately this is not posible, therefore I thought using VLANs for each subnet
But I am stuck, because the DHCP Server attached to the VLAN does not assign IP addresses to the PCs

Thanks in advance
 
tdw
Forum Guru
Forum Guru
Posts: 2118
Joined: Sat May 05, 2018 11:55 am

Re: VLAN DHDP-Relay

Fri Aug 25, 2023 11:43 pm

Using VLAN ID 1 is unwise unless you really know what you are doing, many vendors reserve VLAN ID 1 for untagged traffic.

So you are configuring the network drivers on the PCs to use VLAN IDs 1 and 2?
 
McGremlin
Frequent Visitor
Frequent Visitor
Posts: 95
Joined: Fri Jun 16, 2023 12:12 pm

Re: VLAN DHDP-Relay

Sun Aug 27, 2023 12:53 pm

The scheme isn't complete, it doesn't show switches. Did you configure vlans also on them? Use tagging or not on proper ports?
 
mjuliov
just joined
Topic Author
Posts: 9
Joined: Wed Aug 09, 2023 7:25 pm

Re: VLAN DHDP-Relay

Mon Aug 28, 2023 3:34 pm

Using VLAN ID 1 is unwise unless you really know what you are doing, many vendors reserve VLAN ID 1 for untagged traffic.

So you are configuring the network drivers on the PCs to use VLAN IDs 1 and 2?
I don't configure the PCs drivers. Just plain DHCP
Don't know how to do that
Is it necessary?

Thank you
 
mjuliov
just joined
Topic Author
Posts: 9
Joined: Wed Aug 09, 2023 7:25 pm

Re: VLAN DHDP-Relay

Mon Aug 28, 2023 3:40 pm

The scheme isn't complete, it doesn't show switches. Did you configure vlans also on them? Use tagging or not on proper ports?
I did not, you are right
But the switches I use are kind of dumb devices, what were called "hubs"
I don't know if VLANs are the right solution for my problem
What I need is to have 2 subnets that are conected to the same ethernet interface of the router.

Thank you
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 13666
Joined: Thu Mar 03, 2016 10:23 pm

Re: VLAN DHDP-Relay

Mon Aug 28, 2023 5:48 pm

But the switches I use are kind of dumb devices ...


What I need is to have 2 subnets that are conected to the same ethernet interface of the router.

This isn't possible. Or, it actually is partly ... you can have two IP addresses set on single router interface (for different subnets). But you can't have two DHCP servers.
 
tdw
Forum Guru
Forum Guru
Posts: 2118
Joined: Sat May 05, 2018 11:55 am

Re: VLAN DHDP-Relay

Mon Aug 28, 2023 6:17 pm

One DHCP server can issue static addresses for the multiple subnets attached to an interface, however it can only issue dynamic addresses from one pool as it has no idea how to differentiate which clients should be associated with which subnet. (Actually there are mechanisms which allow matching on vendor ID to select alternate pools, but this is unlikely to be of use for general networks with a variety of client devices).