forked from ipspace/netlab-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# VRF-aware DHCP relaying | ||
|
||
This directory contains *netlab* topology file for a simple VRF-aware 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 %} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% for intf in interfaces if intf.dhcp.server is defined and intf.vrf is defined %} | ||
{% if loop.first %} | ||
ip dhcp relay information option | ||
{% endif %} | ||
{% endfor %} | ||
! | ||
{% for intf in interfaces if intf.dhcp.server is defined %} | ||
{% set helper = hostvars[intf.dhcp.server].loopback.ipv4|ipaddr('address') %} | ||
interface {{ intf.ifname }} | ||
ip helper-address {{ helper }}{% if intf.vrf is defined %} vrf default{% endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% for intf in interfaces if intf.dhcp.server is defined and intf.vrf is defined %} | ||
{% if loop.first %} | ||
ip dhcp relay information option vpn | ||
{% endif %} | ||
{% endfor %} | ||
! | ||
{% for intf in interfaces if intf.dhcp.server is defined %} | ||
{% set helper = hostvars[intf.dhcp.server].loopback.ipv4|ipaddr('address') %} | ||
interface {{ intf.ifname }} | ||
{% if intf.vrf is defined %} | ||
ip helper-address global {{ helper }} | ||
{% else %} | ||
ip helper-address {{ helper }} | ||
{% endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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 {% if intf.vrf is defined %}vrf {{ intf.vrf }} {% endif %}{{ 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') }} | ||
{% if intf.vrf is defined %} | ||
vrf {{ intf.vrf }} | ||
{% endif %} | ||
network {{ intf.ipv4|ipaddr('network') }} {{ intf.ipv4|ipaddr('netmask') }} | ||
default-router {{ intf.ipv4|ipaddr('address') }} | ||
{% endfor %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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=<srv [iosv]<br /><sub>10.0.0.1/32</sub>> | ||
fillcolor="#ff9f01" | ||
] | ||
"relay" [ | ||
label=<relay [iosv]<br /><sub>10.0.0.2/32</sub>> | ||
fillcolor="#ff9f01" | ||
] | ||
"user" [ | ||
label=<user [iosv]<br /><sub>10.0.0.3/32</sub>> | ||
fillcolor="#ff9f01" | ||
] | ||
"relay" -- "srv" [ width=5 ] | ||
"relay_2" [style=filled fillcolor="#ff8080" fontsize=11 label=<172.16.0.0/24<br />VRF client>] | ||
"user" -- "relay_2" [ color="#800000" width=5 ] | ||
"relay" -- "relay_2" [ color="#800000" width=5 ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
message: | | ||
This topology sets up a simple network using VRF-aware 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: csr | ||
dhcp_client: | ||
members: [ user ] | ||
config: [ dhcp-client ] | ||
device: iosv | ||
switch: | ||
members: [ relay ] | ||
module: [ ospf,vrf ] | ||
config: [ dhcp-relay ] | ||
|
||
vrfs: | ||
client: | ||
|
||
nodes: [ srv, relay, user ] | ||
|
||
links: | ||
- relay-srv | ||
- user: | ||
dhcp.client: True | ||
relay: | ||
dhcp.server: srv | ||
type: lan | ||
vrf: client |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.