<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/test-dhcp-relaying-with-netlab-ipspace-net-blog-3sa7elcbt" -->

---
title: Test DHCP Relaying with netlab « ipSpace.net blog
description: A hands-on walkthrough of testing DHCP relaying using netlab, since netlab lacks a native DHCP configuration module. The setup uses custom Jinja2 configuration...
canonical: https://daily.dev/posts/test-dhcp-relaying-with-netlab-ipspace-net-blog-3sa7elcbt
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Test DHCP Relaying with netlab « ipSpace.net blog | daily.dev
og:description: A hands-on walkthrough of testing DHCP relaying using netlab, since netlab lacks a native DHCP configuration module. The setup uses custom Jinja2 configuration...
og:url: https://daily.dev/posts/test-dhcp-relaying-with-netlab-ipspace-net-blog-3sa7elcbt
og:image: https://api.daily.dev/og/posts/3sA7ELCbt.png
og:image:alt: Test DHCP Relaying with netlab « 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.

# Test DHCP Relaying with netlab « ipSpace.net blog

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

## Summary

A hands-on walkthrough of testing DHCP relaying using netlab, since netlab lacks a native DHCP configuration module. The setup uses custom Jinja2 configuration templates and extra node/link attributes to configure a DHCP server (Cisco IOSv), a DHCP relay node (supporting Cisco IOS and Arista EOS), and a DHCP client. The lab topology uses OSPF between relay and server to enable relaying to the server's loopback address. Templates handle client interface configuration, relay helper-address setup, and DHCP pool creation on the server. The lab successfully demonstrates DHCP relay behavior conforming to RFC 2131, and the full topology and configs are available on GitHub.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.ipspace.net/2023/03/netlab-dhcp-relay>

## Questions this post answers

### How do I configure DHCP relaying in netlab when there is no built-in DHCP module?

Without a native DHCP module, netlab supports DHCP relaying through custom configuration templates combined with user-defined link and node attributes. Define boolean and string attributes (e.g., dhcp.client and dhcp.server) in defaults.attributes, assign them to nodes via groups, and write Jinja2 templates that iterate over interfaces to emit the correct helper-address, ip address dhcp, and pool configuration commands for each device role.

_Engineers building network labs with netlab track workarounds like this on daily.dev._

### How does a Cisco IOS DHCP server choose its server identifier when a request arrives via a relay agent?

Per RFC 2131 section 4.1, when a Cisco IOS DHCP server receives a request forwarded by a relay agent, it should use the IP address of the interface on which the message arrived as the server identifier — not the loopback address the relay forwarded to. This means the client sees the server's LAN interface address (e.g., 10.1.0.2) rather than the loopback (10.0.0.1) used by the relay.

_Networking engineers debugging DHCP relay behavior find RFC-level explanations like this on daily.dev._

## Similar posts on daily.dev

- [Managing DNS and DHCP on Linux](https://daily.dev/posts/managing-dns-and-dhcp-on-linux-lgqmlmse3) · Medium · 0 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/test-dhcp-relaying-with-netlab-ipspace-net-blog-3sa7elcbt)

```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":"Test DHCP Relaying with netlab « ipSpace.net blog","url":"https://daily.dev/posts/test-dhcp-relaying-with-netlab-ipspace-net-blog-3sa7elcbt","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/test-dhcp-relaying-with-netlab-ipspace-net-blog-3sa7elcbt"},"datePublished":"2026-08-11T08:56:13.595Z","dateModified":"2026-08-11T09:08:32.021Z","description":"A hands-on walkthrough of testing DHCP relaying using netlab, since netlab lacks a native DHCP configuration module. The setup uses custom Jinja2 configuration...","image":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","thumbnailUrl":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","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/test-dhcp-relaying-with-netlab-ipspace-net-blog-3sa7elcbt","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"networking,ansible","timeRequired":"PT5M"}
{"@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":"Test DHCP Relaying with netlab « ipSpace.net blog"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/test-dhcp-relaying-with-netlab-ipspace-net-blog-3sa7elcbt#faq","mainEntity":[{"@type":"Question","name":"How do I configure DHCP relaying in netlab when there is no built-in DHCP module?","acceptedAnswer":{"@type":"Answer","text":"Without a native DHCP module, netlab supports DHCP relaying through custom configuration templates combined with user-defined link and node attributes. Define boolean and string attributes (e.g., dhcp.client and dhcp.server) in defaults.attributes, assign them to nodes via groups, and write Jinja2 templates that iterate over interfaces to emit the correct helper-address, ip address dhcp, and pool configuration commands for each device role. Engineers building network labs with netlab track workarounds like this on daily.dev."}},{"@type":"Question","name":"How does a Cisco IOS DHCP server choose its server identifier when a request arrives via a relay agent?","acceptedAnswer":{"@type":"Answer","text":"Per RFC 2131 section 4.1, when a Cisco IOS DHCP server receives a request forwarded by a relay agent, it should use the IP address of the interface on which the message arrived as the server identifier — not the loopback address the relay forwarded to. This means the client sees the server's LAN interface address (e.g., 10.1.0.2) rather than the loopback (10.0.0.1) used by the relay. Networking engineers debugging DHCP relay behavior find RFC-level explanations like this on daily.dev."}}]}
```

