<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/netlab-combining-vlans-with-vrfs-ipspace-net-blog-be52vt5r0" -->

---
title: netlab: Combining VLANs with VRFs « ipSpace.net blog
description: A short tutorial showing how to combine VLANs with VRFs in netlab (formerly netsim-tools). By adding a `vrf` attribute directly to a VLAN definition, all VLAN...
canonical: https://daily.dev/posts/netlab-combining-vlans-with-vrfs-ipspace-net-blog-be52vt5r0
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: netlab: Combining VLANs with VRFs « ipSpace.net blog | daily.dev
og:description: A short tutorial showing how to combine VLANs with VRFs in netlab (formerly netsim-tools). By adding a `vrf` attribute directly to a VLAN definition, all VLAN...
og:url: https://daily.dev/posts/netlab-combining-vlans-with-vrfs-ipspace-net-blog-be52vt5r0
og:image: https://api.daily.dev/og/posts/bE52vt5R0.png
og:image:alt: netlab: Combining VLANs with VRFs « ipSpace.net blog
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# netlab: Combining VLANs with VRFs « ipSpace.net blog

**[ipSpace.net Blog](https://daily.dev/sources/ipspace)** · 3 min read · 0 upvotes · 0 comments

## Summary

A short tutorial showing how to combine VLANs with VRFs in netlab (formerly netsim-tools). By adding a `vrf` attribute directly to a VLAN definition, all VLAN interfaces for that VLAN are automatically placed in the corresponding VRF. The post extends a VLAN trunk lab topology by defining red and blue VRFs, assigning each VLAN to its VRF, and enabling the VRF module on switches. The resulting Arista cEOS configuration — including route distinguishers, trunk interfaces, and per-VRF IP routing — is generated automatically from just a few extra lines in the topology file.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.ipspace.net/2022/06/netsim-vlan-vrf>

## Questions this post answers

### How do I assign a VLAN to a VRF in netlab topology files?

Add a `vrf` attribute directly inside the VLAN definition in the topology file. For example, setting `vrf: red` under the `red` VLAN entry causes netlab to automatically place all VLAN interfaces created for that VLAN into the `red` VRF. Route distinguishers and route targets are allocated automatically, though they can be overridden manually.

_Network engineers building multi-VRF labs track netlab patterns and topology tricks on daily.dev._

### Does netlab automatically assign route distinguishers and route targets to VRFs?

Yes, netlab automatically allocates route distinguishers and route targets to VRFs when they are defined. You can override these values if you need specific RD/RT assignments or are building complex topologies that require particular values.

_Engineers designing complex VRF topologies find netlab discussions and updates on daily.dev._

## Similar posts on daily.dev

- [MPLS/VPN with SR-MPLS Core « ipSpace.net blog](https://daily.dev/posts/mpls-vpn-with-sr-mpls-core-ipspace-net-blog-nw3uwiphe) · ipSpace.net Blog · 0 upvotes · 0 comments

---

Tags: [#networking](https://daily.dev/tags/networking)

[View this post on daily.dev](https://daily.dev/posts/netlab-combining-vlans-with-vrfs-ipspace-net-blog-be52vt5r0)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"netlab: Combining VLANs with VRFs « ipSpace.net blog","url":"https://daily.dev/posts/netlab-combining-vlans-with-vrfs-ipspace-net-blog-be52vt5r0","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/netlab-combining-vlans-with-vrfs-ipspace-net-blog-be52vt5r0"},"datePublished":"2026-08-11T08:52:25.959Z","dateModified":"2026-08-11T09:01:24.820Z","description":"A short tutorial showing how to combine VLANs with VRFs in netlab (formerly netsim-tools). By adding a `vrf` attribute directly to a VLAN definition, all VLAN...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/67e860bdfc5e8272c56b05d4b3ced3c6?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/67e860bdfc5e8272c56b05d4b3ced3c6?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"ipSpace.net Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"ipSpace.net Blog","logo":"https://media.daily.dev/image/upload/s--xS7E82MT--/f_auto,q_auto/v1786438303/logos/ipspace?_a=BAMAMicg0","url":"https://daily.dev/sources/ipspace"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/netlab-combining-vlans-with-vrfs-ipspace-net-blog-be52vt5r0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"networking","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"ipSpace.net Blog","item":"https://daily.dev/sources/ipspace"},{"@type":"ListItem","position":3,"name":"netlab: Combining VLANs with VRFs « ipSpace.net blog"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/netlab-combining-vlans-with-vrfs-ipspace-net-blog-be52vt5r0#faq","mainEntity":[{"@type":"Question","name":"How do I assign a VLAN to a VRF in netlab topology files?","acceptedAnswer":{"@type":"Answer","text":"Add a `vrf` attribute directly inside the VLAN definition in the topology file. For example, setting `vrf: red` under the `red` VLAN entry causes netlab to automatically place all VLAN interfaces created for that VLAN into the `red` VRF. Route distinguishers and route targets are allocated automatically, though they can be overridden manually. Network engineers building multi-VRF labs track netlab patterns and topology tricks on daily.dev."}},{"@type":"Question","name":"Does netlab automatically assign route distinguishers and route targets to VRFs?","acceptedAnswer":{"@type":"Answer","text":"Yes, netlab automatically allocates route distinguishers and route targets to VRFs when they are defined. You can override these values if you need specific RD/RT assignments or are building complex topologies that require particular values. Engineers designing complex VRF topologies find netlab discussions and updates on daily.dev."}}]}
```

