Creating Device configuration snippets [CREATED] dut: initial,dhcp [CREATED] c1: initial,dhcp [CREATED] c2: initial,dhcp [CREATED] c3: initial,dhcp [CREATED] c4: initial,dhcp [CREATED] s1: initial,dhcp,routing [CREATED] s2: initial,dhcp,routing Config Deploying device configurations [INFO] Executing initial configuration for node s1 (namespace clab- ml-17-s1) [INFO] Executing initial configuration for node s2 (namespace clab- ml-17-s2) [INFO] Executing routing configuration for node s1 (namespace clab- ml-17-s1) [INFO] Executing routing configuration for node s2 (namespace clab- ml-17-s2) [INFO] Starting Ansible playbook to deploy the rest of the configurations [WARNING]: Found variable using reserved name: hosts PLAY [Deploy initial device configuration] ************************************* TASK [Set variables that cannot be set with VARS] ****************************** ok: [c1] ok: [c2] ok: [c4] ok: [c3] ok: [dut] TASK [Deploy initial configuration] ******************************************** included: /home/pipi/netlab_gh/netsim/ansible/tasks/deploy-module.yml for dut, c1, c2, c3, c4 TASK [Figure out whether to deploy the module initial on current device] ******* ok: [c1] ok: [c2] ok: [c3] ok: [c4] ok: [dut] TASK [Find configuration template for initial] ********************************* ok: [c1] ok: [c2] ok: [c4] ok: [c3] ok: [dut] TASK [fail] ******************************************************************** skipping: [dut] skipping: [c1] skipping: [c2] skipping: [c3] skipping: [c4] TASK [Find configuration deployment deploy_script for initial] ***************** ok: [c1] ok: [c2] ok: [c4] ok: [c3] ok: [dut] TASK [Print deployed configuration when running in verbose mode] *************** ok: [c1] => { "msg": "initial configuration for c1\n=========================================\n#!/bin/bash\n#\nset -e\n#\n# Create bash profile script\n#\ncat <<'SCRIPT' >/root/.bash_profile\n#!/bin/bash\n#\nexport PS1=\"\\h(bash)$ \"\nSCRIPT\nhostname c1\n#\n# Build hosts file\n#\n#\ncat <<'SCRIPT' >/tmp/hosts\n#\n# Created by netlab initial\n#\n10.0.0.1 dut\n172.16.0.1 GigabitEthernet0-1.dut\n172.16.1.1 GigabitEthernet0-2.dut\n172.16.2.1 GigabitEthernet0-3.dut\n172.16.3.1 GigabitEthernet0-4.dut\n172.16.2.6 s1 eth1.s1\n172.16.3.7 s2 eth1.s2\nSCRIPT\ngrep \"Created by netlab\" /etc/hosts || uniq /tmp/hosts >>/etc/hosts\n# It seems on the Vagrant box for ubuntu 20.04, DNS Servers are hardcoded as 4.2.2.1 & Co.\n# This is annoying on a network with filtered DNS.\n# DNSMasq server used for giving out DHCP addresses on the management network is able to act as a DNS Server.\n# Let's use that.\n#\n# (Overwrite netplan config to remove DNS stuff)\necho -n 'Starting initial config ' && date\ncat <<'SCRIPT' >/etc/netplan/01-netcfg.yaml\nnetwork:\n version: 2\n renderer: networkd\n ethernets:\n eth0:\n dhcp4: true\n dhcp6: false\n optional: true\nSCRIPT\nnetplan apply\n\n# (Overwrite resolved config to remove DNS stuff)\ncat <<'SCRIPT' > /etc/systemd/resolved.conf \n[Resolve]\nDNS=\nFallbackDNS=\nDomains=\nDNSOverTLS=no\nCache=yes\nDNSStubListener=yes\nSCRIPT\n\nsystemctl restart systemd-resolved\n\n# Set persistent hostname\nhostnamectl set-hostname c1\n\nNEED_APT_UPDATE=YES\n\n# Loopback addressing\n\n# Interface addressing and bonds, including any static routes\ncat <<'SCRIPT' > /etc/netplan/03-eth-eth1.yaml\nnetwork:\n version: 2\n renderer: networkd\n ethernets:\n eth1:\n dhcp4: true\nSCRIPT\n\n# Disable auto-negotiation on Ethernet interfaces, needed to make LACP work correctly\ncat <<'SCRIPT' > /etc/systemd/network/98-eth.link\n\n[Match]\nOriginalName=eth*\n\n[Link]\nBitsPerSecond=1G\nAutoNegotiation=no\nDuplex=full\nSCRIPT\n\nchmod 400 /etc/netplan/*\n\necho -n 'Starting netplan generate ' && date\nnetplan generate\necho -n 'Starting netplan apply ' && date\nnetplan apply\n\n#\n# Sysctl settings: IPv4/IPv6 forwarding, IPv6 LLA\n# Do this after 'netplan apply', e.g. bond devices won't exist before that\n#\ncat <<'SCRIPT' > /etc/sysctl.d/10-netsim.conf\nnet.ipv4.conf.all.arp_announce=2\nnet.ipv4.ip_forward=0\nnet.ipv6.conf.all.forwarding=0\n\nnet.ipv6.conf.eth1.disable_ipv6=1\n\nSCRIPT\nsysctl -p /etc/sysctl.d/10-netsim.conf\n" } ok: [c2] => { "msg": "initial configuration for c2\n=========================================\n#!/bin/bash\n#\nset -e\n#\n# Create bash profile script\n#\ncat <<'SCRIPT' >/root/.bash_profile\n#!/bin/bash\n#\nexport PS1=\"\\h(bash)$ \"\nSCRIPT\nhostname c2\n#\n# Build hosts file\n#\n#\ncat <<'SCRIPT' >/tmp/hosts\n#\n# Created by netlab initial\n#\n10.0.0.1 dut\n172.16.0.1 GigabitEthernet0-1.dut\n172.16.1.1 GigabitEthernet0-2.dut\n172.16.2.1 GigabitEthernet0-3.dut\n172.16.3.1 GigabitEthernet0-4.dut\n172.16.2.6 s1 eth1.s1\n172.16.3.7 s2 eth1.s2\nSCRIPT\ngrep \"Created by netlab\" /etc/hosts || uniq /tmp/hosts >>/etc/hosts\n# It seems on the Vagrant box for ubuntu 20.04, DNS Servers are hardcoded as 4.2.2.1 & Co.\n# This is annoying on a network with filtered DNS.\n# DNSMasq server used for giving out DHCP addresses on the management network is able to act as a DNS Server.\n# Let's use that.\n#\n# (Overwrite netplan config to remove DNS stuff)\necho -n 'Starting initial config ' && date\ncat <<'SCRIPT' >/etc/netplan/01-netcfg.yaml\nnetwork:\n version: 2\n renderer: networkd\n ethernets:\n eth0:\n dhcp4: true\n dhcp6: false\n optional: true\nSCRIPT\nnetplan apply\n\n# (Overwrite resolved config to remove DNS stuff)\ncat <<'SCRIPT' > /etc/systemd/resolved.conf \n[Resolve]\nDNS=\nFallbackDNS=\nDomains=\nDNSOverTLS=no\nCache=yes\nDNSStubListener=yes\nSCRIPT\n\nsystemctl restart systemd-resolved\n\n# Set persistent hostname\nhostnamectl set-hostname c2\n\nNEED_APT_UPDATE=YES\n\n# Loopback addressing\n\n# Interface addressing and bonds, including any static routes\ncat <<'SCRIPT' > /etc/netplan/03-eth-eth1.yaml\nnetwork:\n version: 2\n renderer: networkd\n ethernets:\n eth1:\n dhcp4: true\nSCRIPT\n\n# Disable auto-negotiation on Ethernet interfaces, needed to make LACP work correctly\ncat <<'SCRIPT' > /etc/systemd/network/98-eth.link\n\n[Match]\nOriginalName=eth*\n\n[Link]\nBitsPerSecond=1G\nAutoNegotiation=no\nDuplex=full\nSCRIPT\n\nchmod 400 /etc/netplan/*\n\necho -n 'Starting netplan generate ' && date\nnetplan generate\necho -n 'Starting netplan apply ' && date\nnetplan apply\n\n#\n# Sysctl settings: IPv4/IPv6 forwarding, IPv6 LLA\n# Do this after 'netplan apply', e.g. bond devices won't exist before that\n#\ncat <<'SCRIPT' > /etc/sysctl.d/10-netsim.conf\nnet.ipv4.conf.all.arp_announce=2\nnet.ipv4.ip_forward=0\nnet.ipv6.conf.all.forwarding=0\n\nnet.ipv6.conf.eth1.disable_ipv6=1\n\nSCRIPT\nsysctl -p /etc/sysctl.d/10-netsim.conf\n" } ok: [c3] => { "msg": "initial configuration for c3\n=========================================\n#!/bin/bash\n#\nset -e\n#\n# Create bash profile script\n#\ncat <<'SCRIPT' >/root/.bash_profile\n#!/bin/bash\n#\nexport PS1=\"\\h(bash)$ \"\nSCRIPT\nhostname c3\n#\n# Build hosts file\n#\n#\ncat <<'SCRIPT' >/tmp/hosts\n#\n# Created by netlab initial\n#\n10.0.0.1 dut\n172.16.0.1 GigabitEthernet0-1.dut\n172.16.1.1 GigabitEthernet0-2.dut\n172.16.2.1 GigabitEthernet0-3.dut\n172.16.3.1 GigabitEthernet0-4.dut\n172.16.2.6 s1 eth1.s1\n172.16.3.7 s2 eth1.s2\nSCRIPT\ngrep \"Created by netlab\" /etc/hosts || uniq /tmp/hosts >>/etc/hosts\n# It seems on the Vagrant box for ubuntu 20.04, DNS Servers are hardcoded as 4.2.2.1 & Co.\n# This is annoying on a network with filtered DNS.\n# DNSMasq server used for giving out DHCP addresses on the management network is able to act as a DNS Server.\n# Let's use that.\n#\n# (Overwrite netplan config to remove DNS stuff)\necho -n 'Starting initial config ' && date\ncat <<'SCRIPT' >/etc/netplan/01-netcfg.yaml\nnetwork:\n version: 2\n renderer: networkd\n ethernets:\n eth0:\n dhcp4: true\n dhcp6: false\n optional: true\nSCRIPT\nnetplan apply\n\n# (Overwrite resolved config to remove DNS stuff)\ncat <<'SCRIPT' > /etc/systemd/resolved.conf \n[Resolve]\nDNS=\nFallbackDNS=\nDomains=\nDNSOverTLS=no\nCache=yes\nDNSStubListener=yes\nSCRIPT\n\nsystemctl restart systemd-resolved\n\n# Set persistent hostname\nhostnamectl set-hostname c3\n\nNEED_APT_UPDATE=YES\n\n# Loopback addressing\n\n# Interface addressing and bonds, including any static routes\ncat <<'SCRIPT' > /etc/netplan/03-eth-eth1.yaml\nnetwork:\n version: 2\n renderer: networkd\n ethernets:\n eth1:\n dhcp4: true\nSCRIPT\n\n# Disable auto-negotiation on Ethernet interfaces, needed to make LACP work correctly\ncat <<'SCRIPT' > /etc/systemd/network/98-eth.link\n\n[Match]\nOriginalName=eth*\n\n[Link]\nBitsPerSecond=1G\nAutoNegotiation=no\nDuplex=full\nSCRIPT\n\nchmod 400 /etc/netplan/*\n\necho -n 'Starting netplan generate ' && date\nnetplan generate\necho -n 'Starting netplan apply ' && date\nnetplan apply\n\n#\n# Sysctl settings: IPv4/IPv6 forwarding, IPv6 LLA\n# Do this after 'netplan apply', e.g. bond devices won't exist before that\n#\ncat <<'SCRIPT' > /etc/sysctl.d/10-netsim.conf\nnet.ipv4.conf.all.arp_announce=2\nnet.ipv4.ip_forward=0\nnet.ipv6.conf.all.forwarding=0\n\nnet.ipv6.conf.eth1.disable_ipv6=1\n\nSCRIPT\nsysctl -p /etc/sysctl.d/10-netsim.conf\n" } ok: [c4] => { "msg": "initial configuration for c4\n=========================================\n#!/bin/bash\n#\nset -e\n#\n# Create bash profile script\n#\ncat <<'SCRIPT' >/root/.bash_profile\n#!/bin/bash\n#\nexport PS1=\"\\h(bash)$ \"\nSCRIPT\nhostname c4\n#\n# Build hosts file\n#\n#\ncat <<'SCRIPT' >/tmp/hosts\n#\n# Created by netlab initial\n#\n10.0.0.1 dut\n172.16.0.1 GigabitEthernet0-1.dut\n172.16.1.1 GigabitEthernet0-2.dut\n172.16.2.1 GigabitEthernet0-3.dut\n172.16.3.1 GigabitEthernet0-4.dut\n172.16.2.6 s1 eth1.s1\n172.16.3.7 s2 eth1.s2\nSCRIPT\ngrep \"Created by netlab\" /etc/hosts || uniq /tmp/hosts >>/etc/hosts\n# It seems on the Vagrant box for ubuntu 20.04, DNS Servers are hardcoded as 4.2.2.1 & Co.\n# This is annoying on a network with filtered DNS.\n# DNSMasq server used for giving out DHCP addresses on the management network is able to act as a DNS Server.\n# Let's use that.\n#\n# (Overwrite netplan config to remove DNS stuff)\necho -n 'Starting initial config ' && date\ncat <<'SCRIPT' >/etc/netplan/01-netcfg.yaml\nnetwork:\n version: 2\n renderer: networkd\n ethernets:\n eth0:\n dhcp4: true\n dhcp6: false\n optional: true\nSCRIPT\nnetplan apply\n\n# (Overwrite resolved config to remove DNS stuff)\ncat <<'SCRIPT' > /etc/systemd/resolved.conf \n[Resolve]\nDNS=\nFallbackDNS=\nDomains=\nDNSOverTLS=no\nCache=yes\nDNSStubListener=yes\nSCRIPT\n\nsystemctl restart systemd-resolved\n\n# Set persistent hostname\nhostnamectl set-hostname c4\n\nNEED_APT_UPDATE=YES\n\n# Loopback addressing\n\n# Interface addressing and bonds, including any static routes\ncat <<'SCRIPT' > /etc/netplan/03-eth-eth1.yaml\nnetwork:\n version: 2\n renderer: networkd\n ethernets:\n eth1:\n dhcp4: true\nSCRIPT\n\n# Disable auto-negotiation on Ethernet interfaces, needed to make LACP work correctly\ncat <<'SCRIPT' > /etc/systemd/network/98-eth.link\n\n[Match]\nOriginalName=eth*\n\n[Link]\nBitsPerSecond=1G\nAutoNegotiation=no\nDuplex=full\nSCRIPT\n\nchmod 400 /etc/netplan/*\n\necho -n 'Starting netplan generate ' && date\nnetplan generate\necho -n 'Starting netplan apply ' && date\nnetplan apply\n\n#\n# Sysctl settings: IPv4/IPv6 forwarding, IPv6 LLA\n# Do this after 'netplan apply', e.g. bond devices won't exist before that\n#\ncat <<'SCRIPT' > /etc/sysctl.d/10-netsim.conf\nnet.ipv4.conf.all.arp_announce=2\nnet.ipv4.ip_forward=0\nnet.ipv6.conf.all.forwarding=0\n\nnet.ipv6.conf.eth1.disable_ipv6=1\n\nSCRIPT\nsysctl -p /etc/sysctl.d/10-netsim.conf\n" } ok: [dut] => { "msg": "initial configuration for dut\n=========================================\nhostname dut\n!\nno ip domain lookup\nlogging buffered 256000\n\n!\nlldp run\n!\nip host s1 172.16.2.6\nip host s2 172.16.3.7\n!\nip routing\n!\nno ipv6 unicast-routing\n!\n!\ninterface Loopback0\n ip address 10.0.0.1 255.255.255.255\n!\ninterface GigabitEthernet0/0\n no lldp transmit\n no lldp receive\n!\ninterface GigabitEthernet0/1\n description dut -> [c1,c2] [stub]\n ip address 172.16.0.1 255.255.255.0\n no shutdown\n!\ninterface GigabitEthernet0/2\n description dut -> [c3,c4] [stub]\n ip address 172.16.1.1 255.255.255.0\n no shutdown\n!\ninterface GigabitEthernet0/3\n description dut -> s1\n ip address 172.16.2.1 255.255.255.0\n no shutdown\n!\ninterface GigabitEthernet0/4\n description dut -> s2\n ip address 172.16.3.1 255.255.255.0\n no shutdown\n!\n!\n! Configure DHCP client - has to be done before routing protocol config, but after generic interface config\n!\n\n!\nline vty 0 4\n exec-timeout 0 0 \n!\nno banner exec\nno banner login\nno banner incoming\n" } TASK [Deploy initial configuration] ******************************************** included: /home/pipi/netlab_gh/netsim/ansible/tasks/deploy-config/ios.yml for dut included: /home/pipi/netlab_gh/netsim/ansible/tasks/deploy-config/linux.yml for c1, c2, c3, c4 TASK [ios_config: deploying initial from /work/netlab_cicd/node_files/dut/initial] *** [WARNING]: To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device including the indentation changed: [dut] TASK [template] **************************************************************** changed: [c1] changed: [c2] changed: [c4] changed: [c3] TASK [Execute /tmp/config.sh to deploy initial config from /work/netlab_cicd/node_files/c1/initial] *** changed: [c1] changed: [c4] changed: [c3] changed: [c2] PLAY [Deploy module-specific configurations] *********************************** TASK [Set variables that cannot be set with VARS] ****************************** ok: [c1] ok: [c2] ok: [c3] ok: [c4] ok: [dut] TASK [Deploy individual configuration modules] ********************************* included: /home/pipi/netlab_gh/netsim/ansible/tasks/deploy-module.yml for dut, c1, c2, c3, c4 => (item=dhcp) included: /home/pipi/netlab_gh/netsim/ansible/tasks/deploy-module.yml for dut, c1, c2, c3, c4 => (item=routing) TASK [Figure out whether to deploy the module dhcp on current device] ********** ok: [c1] ok: [c2] ok: [c3] ok: [c4] ok: [dut] TASK [Find configuration template for dhcp] ************************************ ok: [c1] ok: [c2] ok: [c3] ok: [c4] ok: [dut] TASK [fail] ******************************************************************** skipping: [dut] skipping: [c1] skipping: [c2] skipping: [c3] skipping: [c4] TASK [Find configuration deployment deploy_script for dhcp] ******************** ok: [c1] ok: [c2] ok: [c4] ok: [c3] ok: [dut] TASK [Print deployed configuration when running in verbose mode] *************** ok: [c1] => { "msg": "dhcp configuration for c1\n=========================================\n# This is a placeholder file. DHCP is configured during initial configuration\n#\nif [ `grep 'ID=ubuntu' /etc/os-release` ]; then\n echo \"DHCP is supported, it should work after another plea to netplan\"\n netplan apply\nelse\n echo \"netlab supports DHCP only on Ubuntu\" >&2\n exit 1\nfi\n" } ok: [c2] => { "msg": "dhcp configuration for c2\n=========================================\n# This is a placeholder file. DHCP is configured during initial configuration\n#\nif [ `grep 'ID=ubuntu' /etc/os-release` ]; then\n echo \"DHCP is supported, it should work after another plea to netplan\"\n netplan apply\nelse\n echo \"netlab supports DHCP only on Ubuntu\" >&2\n exit 1\nfi\n" } ok: [c3] => { "msg": "dhcp configuration for c3\n=========================================\n# This is a placeholder file. DHCP is configured during initial configuration\n#\nif [ `grep 'ID=ubuntu' /etc/os-release` ]; then\n echo \"DHCP is supported, it should work after another plea to netplan\"\n netplan apply\nelse\n echo \"netlab supports DHCP only on Ubuntu\" >&2\n exit 1\nfi\n" } ok: [c4] => { "msg": "dhcp configuration for c4\n=========================================\n# This is a placeholder file. DHCP is configured during initial configuration\n#\nif [ `grep 'ID=ubuntu' /etc/os-release` ]; then\n echo \"DHCP is supported, it should work after another plea to netplan\"\n netplan apply\nelse\n echo \"netlab supports DHCP only on Ubuntu\" >&2\n exit 1\nfi\n" } ok: [dut] => { "msg": "dhcp configuration for dut\n=========================================\ninterface GigabitEthernet0/1\n ip helper-address 172.16.2.6\ninterface GigabitEthernet0/2\n ip helper-address 172.16.3.7\n" } TASK [Deploy dhcp configuration] *********************************************** included: /home/pipi/netlab_gh/netsim/ansible/tasks/deploy-config/ios.yml for dut included: /home/pipi/netlab_gh/netsim/ansible/tasks/linux/dhcp.yml for c1, c2, c3, c4 TASK [ios_config: deploying dhcp from /work/netlab_cicd/node_files/dut/dhcp] *** changed: [dut] TASK [Install dnsmasq] ********************************************************* skipping: [c1] skipping: [c2] skipping: [c3] skipping: [c4] TASK [Install isc-dhcp-relay] ************************************************** skipping: [c1] skipping: [c2] skipping: [c3] skipping: [c4] TASK [Create DHCP deployment script] ******************************************* changed: [c2] changed: [c4] changed: [c3] changed: [c1] TASK [Execute /tmp/config.sh to deploy dhcp config from /work/netlab_cicd/node_files/c1/dhcp] *** changed: [c1] changed: [c4] changed: [c3] changed: [c2] TASK [Figure out whether to deploy the module routing on current device] ******* ok: [c1] ok: [c2] ok: [c3] ok: [c4] ok: [dut] TASK [Find configuration template for routing] ********************************* skipping: [dut] skipping: [c1] skipping: [c2] skipping: [c3] skipping: [c4] TASK [fail] ******************************************************************** skipping: [dut] skipping: [c1] skipping: [c2] skipping: [c3] skipping: [c4] TASK [Find configuration deployment deploy_script for routing] ***************** skipping: [dut] skipping: [c1] skipping: [c2] skipping: [c3] skipping: [c4] TASK [Print deployed configuration when running in verbose mode] *************** skipping: [dut] skipping: [c1] skipping: [c2] skipping: [c3] skipping: [c4] TASK [Deploy routing configuration] ******************************************** skipping: [dut] skipping: [c1] skipping: [c2] skipping: [c3] skipping: [c4] PLAY [Deploy custom deployment templates] ************************************** skipping: no hosts matched PLAY RECAP ********************************************************************* c1 : ok=20 changed=4 unreachable=0 failed=0 skipped=9 rescued=0 ignored=0 c2 : ok=20 changed=4 unreachable=0 failed=0 skipped=9 rescued=0 ignored=0 c3 : ok=20 changed=4 unreachable=0 failed=0 skipped=9 rescued=0 ignored=0 c4 : ok=20 changed=4 unreachable=0 failed=0 skipped=9 rescued=0 ignored=0 dut : ok=18 changed=2 unreachable=0 failed=0 skipped=7 rescued=0 ignored=0 Results of configuration script deployments ================================================================================ s1 Script: initial,routing s2 Script: initial,routing Use this topology to test the DHCPv4 relay functionality of your device. Use 'netlab validate' to check whether your device propagated DHCPv4 requests from DHCP clients (Linux VMs) to DHCP servers.