From 87127d003fcaf24e717f9bfd60d37784637e476d Mon Sep 17 00:00:00 2001 From: Ivan Pepelnjak Date: Mon, 6 Mar 2023 15:32:07 +0100 Subject: [PATCH] Simple DHCP relaying scenario --- DHCP/relay/README.md | 13 ++++++++++++ DHCP/relay/dhcp-client/ios.j2 | 5 +++++ DHCP/relay/dhcp-relay.png | Bin 0 -> 11375 bytes DHCP/relay/dhcp-relay/eos.j2 | 4 ++++ DHCP/relay/dhcp-relay/ios.j2 | 4 ++++ DHCP/relay/dhcp-server.j2 | 20 ++++++++++++++++++ DHCP/relay/graph.dot | 21 +++++++++++++++++++ DHCP/relay/topology.yml | 37 ++++++++++++++++++++++++++++++++++ tools | 2 +- 9 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 DHCP/relay/README.md create mode 100644 DHCP/relay/dhcp-client/ios.j2 create mode 100644 DHCP/relay/dhcp-relay.png create mode 100644 DHCP/relay/dhcp-relay/eos.j2 create mode 100644 DHCP/relay/dhcp-relay/ios.j2 create mode 100644 DHCP/relay/dhcp-server.j2 create mode 100644 DHCP/relay/graph.dot create mode 100644 DHCP/relay/topology.yml diff --git a/DHCP/relay/README.md b/DHCP/relay/README.md new file mode 100644 index 0000000..af40c7d --- /dev/null +++ b/DHCP/relay/README.md @@ -0,0 +1,13 @@ +# DHCP relaying + +This directory contains *netlab* topology file for a simple DHCP relaying scenario. + +![DHCP relaying topology](dhcp-relay.png) + +After starting the lab, the *user* device should get DHCP-assigned IP address on its lab-facing interface. + +## Changing Device Types + +This topology can be used with Cisco IOSv or Arista EOSv. To test it with other devices, add custom configuration template to `dhcp-relay` directory. + +The easiest way to change the device types is to edit the topology file. You could also use the **netlab up** [CLI arguments](https://netsim-tools.readthedocs.io/en/latest/netlab/up.html#usage) -- to change the DHCP relay device type, use `-s nodes.relay.device=xxx` CLI argument. diff --git a/DHCP/relay/dhcp-client/ios.j2 b/DHCP/relay/dhcp-client/ios.j2 new file mode 100644 index 0000000..1c868db --- /dev/null +++ b/DHCP/relay/dhcp-client/ios.j2 @@ -0,0 +1,5 @@ +{% for intf in interfaces if intf.dhcp.client is defined and intf.dhcp.client %} +interface {{ intf.ifname }} + no ip address + ip address dhcp +{% endfor %} \ No newline at end of file diff --git a/DHCP/relay/dhcp-relay.png b/DHCP/relay/dhcp-relay.png new file mode 100644 index 0000000000000000000000000000000000000000..be4afd0af0a8b98ce563736bf3c4164d3ac3b221 GIT binary patch literal 11375 zcmZXa19Y5E*T7>NO&T}0(b#6AjqRrCHn!2&c4McpjmEa!cpGo{ZU684;XU8kb9U#M zooDVH-MRC-6RxHri;hBs0tE$yE-xpg4h02G3Q1=oAwa&3Z&d&OfncU6D+TrT_mkII zk_ZJw0VOXbuIZk2p6%wXIe6F8UEgkdGaVnp4ZR~SRvu^u8&4TniZnIq6&Qiu8~EJ} z93Jt2<*thL=~D!S9Ci|=Ryn1zCn}a6j=I0a*z;>za1u+ae!>Rz^^5miqUuGb)8+VC ztMybCmlFavQM63KjLm=lgrH;hcu7Mk2aJjxLu~@~gfS?vKW6-i@2yf1o4&#)ne~S= z!NelpZ-c@@7b0*l4Z>Ph>#Gv|aPu=wo-;EIeH}Gz!!P+mcuEb{qg3!WJi=J@SCPGn zA`KWqQ(g|v^}yDzXon6HAvRjX<+75;a(?B7e+a^YA2dHYzvCqhC3llsYkSe@8z)h1 zzGkkaUv?RXWikFBk%7)i-CwPv^U`c_XEhsZOucSq6+STu+>UF$zmYz^LFVHcF)N-; z+w8ll(Qm}UL%_%mnz=68dzwgNw$j!;N9#olV1R1y4q;dCn`++C*$ zE}!voFK~uq#~=hxsr4K`TZXS0zOo`TK?ne)$ue3gT8l}(RD;#V&MFA-= zs`ct$o73_~TzV^1jSS=h=8*Yg7pnH{84Mcx3XJ83v#R96_P2W8P%0Cu8Q8%n@1(U- zUPWLxL=qO~!m|{cod`yE&akNzhAlX*CBuQ9%w(+0e09;R@zGcqwYlhm=|t?>4K2!M)f{@ zRGP0WQZSgXTljJ`*$irbh3lrU7WZ`KDy%gX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<`Sqje3+M%Bp_^;$B{1AoF{;&nvqBJh|_`L8r*zO&Me~F+pw+L&;04NL5Ri1pXJ8o}SA9 literal 0 HcmV?d00001 diff --git a/DHCP/relay/dhcp-relay/eos.j2 b/DHCP/relay/dhcp-relay/eos.j2 new file mode 100644 index 0000000..d47d74d --- /dev/null +++ b/DHCP/relay/dhcp-relay/eos.j2 @@ -0,0 +1,4 @@ +{% for intf in interfaces if intf.dhcp.server is defined %} +interface {{ intf.ifname }} + ip helper-address {{ hostvars[intf.dhcp.server].loopback.ipv4|ipaddr('address') }} +{% endfor %} \ No newline at end of file diff --git a/DHCP/relay/dhcp-relay/ios.j2 b/DHCP/relay/dhcp-relay/ios.j2 new file mode 100644 index 0000000..d47d74d --- /dev/null +++ b/DHCP/relay/dhcp-relay/ios.j2 @@ -0,0 +1,4 @@ +{% for intf in interfaces if intf.dhcp.server is defined %} +interface {{ intf.ifname }} + ip helper-address {{ hostvars[intf.dhcp.server].loopback.ipv4|ipaddr('address') }} +{% endfor %} \ No newline at end of file diff --git a/DHCP/relay/dhcp-server.j2 b/DHCP/relay/dhcp-server.j2 new file mode 100644 index 0000000..2065e1b --- /dev/null +++ b/DHCP/relay/dhcp-server.j2 @@ -0,0 +1,20 @@ +logging buffered +no service timestamp debug +! +do debug ip dhcp server packet +do debug ip dhcp server event +! +{% for h,v in hostvars.items() %} +{% for intf in v.interfaces if intf.dhcp.server is defined and intf.ipv4 is defined %} +ip dhcp excluded-address {{ intf.ipv4|ipaddr('address') }} +{% endfor %} +{% endfor %} +! +{% for h,v in hostvars.items() %} +{% for intf in v.interfaces if intf.dhcp.server is defined and intf.ipv4 is defined %} +! +ip dhcp pool p_{{ intf.ipv4|ipaddr('network') }} + network {{ intf.ipv4|ipaddr('network') }} {{ intf.ipv4|ipaddr('netmask') }} + default-router {{ intf.ipv4|ipaddr('address') }} +{% endfor %} +{% endfor %} \ No newline at end of file diff --git a/DHCP/relay/graph.dot b/DHCP/relay/graph.dot new file mode 100644 index 0000000..efe96ed --- /dev/null +++ b/DHCP/relay/graph.dot @@ -0,0 +1,21 @@ +graph { + bgcolor="transparent" + node [shape=box, style="rounded,filled" fontname=Verdana] + edge [fontname=Verdana labelfontsize=10 labeldistance=1.5] + "srv" [ + label=10.0.0.1/32> + fillcolor="#ff9f01" + ] + "relay" [ + label=10.0.0.2/32> + fillcolor="#ff9f01" + ] + "user" [ + label=10.0.0.3/32> + fillcolor="#ff9f01" + ] + "relay" -- "srv" [ ] + "relay_2" [style=filled fillcolor="#d1bfab" fontsize=11 label="172.16.0.0/24"] + "user" -- "relay_2" [ ] + "relay" -- "relay_2" [ ] +} diff --git a/DHCP/relay/topology.yml b/DHCP/relay/topology.yml new file mode 100644 index 0000000..40b67b9 --- /dev/null +++ b/DHCP/relay/topology.yml @@ -0,0 +1,37 @@ +message: | + This topology sets up a simple network using DHCP relay + functionality. It includes a DHCP server (running on Cisco + IOSv), DHCP client (also on Cisco IOSv) and an intermediate + node. + +defaults.attributes: + link.dhcp: + client: bool + server: str + +defaults.device: iosv + +groups: + dhcp_server: + members: [ srv ] + module: [ ospf ] + config: [ dhcp-server ] + device: iosv + dhcp_client: + members: [ user ] + config: [ dhcp-client ] + device: iosv + switch: + members: [ relay ] + module: [ ospf ] + config: [ dhcp-relay ] + +nodes: [ srv, relay, user ] + +links: +- relay-srv +- user: + dhcp.client: True + relay: + dhcp.server: srv + type: lan diff --git a/tools b/tools index 36c2858..f1f4f67 160000 --- a/tools +++ b/tools @@ -1 +1 @@ -Subproject commit 36c2858cb5c27f3154a1b6214f9cf478536bbbda +Subproject commit f1f4f67e49304baa9e4801b3847f44db65f38ffe