10

I have a basic understanding of VRFs, VLANs and subnets. I understand that VLANs operate on L2, and subnets and VRFs (lite) on L3. What I don't understand, is why you would choose one over the other when you mostly care about segmentation.


Imagine I have only 2 devices, and I don't want them to be able to talk to each other, but I do want them to be able to access the internet.

VLANs

Imagine I have only one switch and one router in my network. I could do as follows:

  • device 1 => VLAN 1
  • device 2 => VLAN 2
  • Internet => VLAN 3

Then, to prevent them from talking, I could allow traffic between vlan 1 and vlan 3, as well as traffic between vlan 2 and vlan 3. I would, however, drop all traffic flowing between vlan 1 and vlan 2. => Segmentation OK.

Subnets

Imagine I have two switches and one router in my network. I could do as follows:

  • subnet 1 => switch 1 => device 1
  • subnet 2 => switch 2 => device 2

Then, like I did with the VLANs, I could drop all packets flowing between subnet 1 and subnet 2. => Segmentation OK.

VRFs

Imagine I have multiple switches and one router. I could do as follows:

  • VRF 1 => Device 1
  • VRF 2 => Device 2

I do not explicitly have to prevent anything. By default, the two VRF's won't be able to talk to each other. => Segmentation OK.


Is there any other advantage to any of the three? What is the preferred method? Why would I combine the three? What else did I miss?

edit I'm really looking for an answer which compares the three options, especially VLAN (which might be using separate subnets) vs VRF segmentation.

7

Each fills a different purpose and all three may be part of an overall solution. Lets start with the oldest concept first.

Subnets are the IP worlds way of determining what devices are "assumed to be on-link". Devices within the same subnet will send unicast traffic directly to each other by default while devices in different subnets will send unicast traffic via a router by default.

You could put each subnet on a separate physical network. This forces traffic to go via the router, which can act as a firewall. That works fine if your isolation domains match up with your physical network layout but gets to be a PITA if they don't.

You can have multiple subnets on the same "link", but doing so does not provide a high degree of isolation between the devices. IPv4 unicast traffic and IPv6 global unicast traffic between different subnets will by default flow via your router where it can be filtered but broadcasts, IPv6 link local traffic and non-ip protocols will flow directly between the hosts. Furthermore if someone wants to bypass the router they can trivially do so by adding an extra IP address to their NIC.

VLANs take an Ethernet network and split it up into multiple seperate Virtual Ethernet networks. This lets you ensure that traffic goes via the router without constraining your physical network layout.

VRFs let you build multiple virtual routers in one box. They are a relatively recent idea and are mostly useful in large complex networks. Essentially while VLANs let you build multiple independent virtual Ethernet networks on the same infrastructure VRFs (used in conjunction with an appropriate virtual link layer such as VLANs or MPLS) let you build multiple independent IP networks on the same infrastructure. Some examples of where they might be useful.

  • If you are running a multi-tenant datacenter scenario each customer may have their own (possibly overlapping) set of subnets and want different routing and filtering rules.
  • In a large network you may want to route between subnets/vlans in the same security domain locally while sending cross security domain traffic to a central firewall.
  • If you are doing DDOS scrubbing you may want to separate unscrubbed traffic from scrubbed traffic.
  • If you have multiple classes of customer you may want to apply different routing rules to their traffic. For example you could route "economy" traffic on the cheapest path while routing "premium" traffic on the fastest path.
4

IP subnets and VLANs are not mutually exclusive -- you don't choose one or the other. It most cases, there is a one-to-one correspondence between VLANs and subnets.

In your first example, assuming you're using IP, you are still going to have to assign IP subnets to the VLANs. So you would assign a separate IP subnet to VLAN 1 and 2. It is up to you whether to filter by VLAN or IP address, although you'll find that since you have to route between the VLANs, filtering by IP is easier.

If the VRF example, you have the problem of the Internet connection. When traffic is received from the Internet, which VRF do you place it into? To make it work as you've described, you would need two Internet connections.

EDIT: The "R" in VRF stands for Routing. A VRF gives you, in effect, separate independent routers, and they can have overlapping addresses and different routes. The reason for VRFs is not segmentation, per se, but to allow separate routing calculations. As an example, in your VRF 1, the default route may point to the Internet, but in VRF 2, it may point somewhere else. You can't do that (easily) with a single router, and it's near impossible in a larger network.

  • Yes, there would probably be a one to one mapping with subnets - vlans,however theoretically it is not required. And i understand your comment about VRF, but it doesnt really answer my question : why choose VRFs instead of vlan-subnets? I made an edit to make that more clear. – Michael May 20 '16 at 15:43
  • Expanded my answer. – Ron Trunk May 20 '16 at 16:04
  • @RonTrunk , maybe add the VRF example of overlapping IP's, e.g. multi-tenant environment. – Pieter May 20 '16 at 21:02
  • I see. But with regards to segmentation: subnet segmentation has the same advantages as VRF segmentation? When I have two subnets, I would need to add a route in my router, is that correct? I do see that the difference is higher up in the routing tables that can be separate. Thanks. – Michael May 23 '16 at 17:47
  • Subnet segmentation by Itself is not enough. You also need access list to control traffic. – Ron Trunk May 23 '16 at 17:52
2
  • VLAN's are said to isolate broadcast and failure domains.
  • A single subnet is typically configured per VLAN and sets the IP (layer3) addressing.
  • VRF separates route tables on the same device.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.