so you basically have the following physical setup:
R -------(Port A)(VLANx)|
|
U1 ------(Port B)(VLAN1)|
|-S
U2 ------(Port C)(VLAN2)|
|
U3 ----(Port D)(VLAN1&2)|
First of all, VLANs are Virtual Layer 2 networks (See them as separate Ethernet network) and you can interconnect them by various means, but it's still only Layer 2 (Ethernet)
It is a single Ethernet broadcast domain. What is originated in one VLAN stays in it (ARP, DHCP requests, etc) It is more easy to use/troubleshoot than multiple IP networks on the same LAN/VLAN, because IP traffic from one VLAN isn't found on the other
If you want various Layer 3 Networks (IP) to be able to talk to each other, it needs to be routed. This can be done by Routers and/or Layer 3 Switches (switches capable of routing) If your switch ISN'T a L3 switch, then you MUST route with the Router, using multiple interfaces (one per VLAN)
Second. If you want more than one VLAN on a single router/switch/server port, you must use Tagging (AKA 802.1Q), which will add a header to ethernet frames to identify which VLAN they are (and a few other things, like CoS Priority, etc).
Lastly, as per your setup, your router isn't part of a VLAN, which means that by default it should be VLAN 1 on the switch. this means you are having 1.1.1.0/24 & 2.2.2.0/24 on the same VLAN. Not necessarily bad but still not optimal
I'll assume that you do not have an L3 capable switch
R -(802.1Q)-------(Port A)(802.1Q)|
|
U1 ---------------(Port B)(VLAN20)|
|-S
U2 ---------------(Port C)(VLAN30)|
|
U3 -(802.1Q)------(Port D)(802.1Q)|
I've used VLAN 10/20/30/40... Always a good practice NOT to use VLAN 1 as it's normally the Default (unconfigured) VLAN in a switch.
With R having 802.1Q configured with one IP interface on each VLAN
* VLAN 10 1.1.1.0/24
* VLAN 20 2.2.2.0/24
* VLAN 30 3.3.3.0/24
* VLAN 40 4.4.4.0/24, etc...
It also have DHCP server configured with multiple pools for any interfaces required
(search google for "debian dhcp multiple subnets" for example, as it's not a one liner explanation
Switch ports A & D are configured with 802.1Q Tagging, Port A permitting all VLANS and port D permitting at least VLAN 30 & 40
U3 having 802.1Q Tagging configured
If you have an L3 capable switch, then you can the following:
R ----------------(Port A)(VLAN10)|
|
U1 ---------------(Port B)(VLAN20)|
|-S
U2 ---------------(Port C)(VLAN30)|
|
U3 -(802.1Q)------(Port D)(802.1Q)|
With R, U1 & U2 being configured normally, U3 (and the switch port facing it) having 802.1Q tagging configured, and the other interfaces (2.2.2.0/24, 3.3.3.0/24 & 4.4.4.0/24) on the switch.
Note that no other VLAN except VLAN10 would have DHCP enabled (DHCP requests do not cross routing boundaries, unless DHCP forwarding is configured on the routing device, and the server is configured to serve multiple subnets).