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
105 additions
and
1 deletion.
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 @@ | ||
# 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. |
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,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 %} |
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,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 %} |
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,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 %} |
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" [ ] | ||
"relay_2" [style=filled fillcolor="#d1bfab" fontsize=11 label="172.16.0.0/24"] | ||
"user" -- "relay_2" [ ] | ||
"relay" -- "relay_2" [ ] | ||
} |
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,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 |
Submodule tools
updated
from 36c285 to f1f4f6