vlan with dhcp server

Hi guys,
I’m trying to config dhcp server with vlan on RB951UI.
Here is my config.
/interface vlan

#    NAME                     MTU ARP        VLAN-ID INTERFACE                                     
   R  vlan40                  1500 enabled         40 ether5

/ip address

 #   ADDRESS            NETWORK         INTERFACE                                                                   
 3 D 50.0.0.3/24        50.0.0.0        ether1                                                                      
 5   40.0.0.1/24        40.0.0.0        vlan40

/ip dhcp-server

 #   NAME       INTERFACE     RELAY           ADDRESS-POOL     LEASE-TIME ADD-ARP       
     vlan40     vlan40                        vlan40           10m

I want my pc receive ip from vlan40 when i connect it using lan cable. But it’s not worked. Did i do something wrong ?
Any ideas is helpful. Thanks in advance.

Is your PC connected to vlan40?
Is it on a port that is sending vlan40 untagged or did you put some switch between them to remove the tag?
If not, this is not going to work.

my pc connected to ether5 which has vlan40 on it. Yeah i think it’s untagged. Can i remove the tag using only 1 router not adding one more switch ??

Show your config for ether5 and the VLAN.

my config on ether5 and vlan is exactly like my 1st post.
Interface vlan40 add to ether5 and i created dhcp server for vlan40.

Unless your PC is using inserting Vlan Tags it will be looking for DHCP on ether5.

Use the Torch function with all options enabled (in Winbox) and a timeout of 30 seconds and see whether dhcp request are being tagged or not.

You can also take a spare Mikrotik and add your vlan40 to ether1 and then bridge vlan40 to a spare ethernet port for the PC. Plug this spare routers ether1 into you first routers ether5 and it should work.

Ahh… overlooked that.
In this case it is normal that it does not work, a PC will not use VLAN tagging by itself unless you
configure it to do so, which is normally not possible in Windows. (it requires a server-grade ethernet card)

On Linux it is possible by creating a vlan40 interface just like on the MikroTik.