First off what you're asking is not a simple answer. You should do some reading first then ask specific questions.
http://en.wikipedia.org/wiki/Virtual_LANGoogle is a great source to start with
However if you wanted to feed the switch from 1 Port then you have to set your router up to deal with VLAN TAGGING
In the example below I am feeding the switch with one of the SFP cages from an imaginary router that has VLAN 10 and 20 configured on it so it will send the packets TAGGED as either VLAN 10 or VLAN 20 then the switch will decide which virtual switch the packet is destined to. In reverse the switch will accept UNTAGGED packets into ports 1-12 and then TAG them as VLAN 10 before pushing them out port 25 to the router.
- vlan1.jpg (64.05 KiB) Viewed 6097 times
In the example below I just separated the switch into 2 virtual switches so you would need to feed each separately but no VLAN TAGGING is required and ports 1-12 will not talk to devices on ports 13-24. HOWEVER you would need to plug into port 25 or 26 to be able to get to the switch UI/CLI. Or you could assign a NON ROUTABLE IP to each VLAN to access the switch UI/CLI by clicking on the little gear after VLAN description.
- vlan2.jpg (65.13 KiB) Viewed 6097 times