Bookmark this page

Lab: Automating Simple Network Operations

This Lab provisions a new layer 3 subnet under the Adjustment scenario.

The Break Up scenario described the separation of example.com network into three independent networks. Routing among the networks was established by way of explicitly advertised routes under eBGP, in accordance with peering agreements between the businesses.

Under the Break Up scenario, traffic between server01 in AS10101 and server02 in AS19216 is routed through AS17216 by way of lab environment links simulating connections across the internet.

The new subnet represents an alternate path across the internet between AS10101 and AS19216. It runs between the eth3 interface of spine01 and the eth3 interface of spine02.

The management team asks you to:

  1. Ensure that OSPF is not advertising routes across the new link.

  2. Apply appropriate descriptions to the interfaces.

  3. Configure layer 3 on the interfaces.

This Lab focuses on interface descriptions and layer 3 addresses. A different Lab configures routing.

You will be accessing the network devices by way of management interfaces. Those interfaces is already configured with respect to layer 3 and up, and should not be changed.

Figure 7.2:

The Adjustment Phase Production Services Network of example.com

Table 7.1. Adjustment Phase Interface Descriptions

DevicesInterfacesDescriptions
spine01eth3spine02-as19216
spine02eth3spine01-as10101

Table 7.2. Adjustment Phase Layer 3 Addressing (management interfaces not shown)

DevicesInterfacesIPv4 Addresses
spine01eth3172.16.50.1/30
spine02eth3172.16.50.2/30

In this lab, you will assign IP addresses and implement interface description changes to activate a new link between autonomous systems. The changes in this lab correspond to the Adjustment phase in the growth and development of example.com and successor companies.

Outcomes

You should be able to:

  • Create a variables file defining the variables that will be used.

  • Perform a play that implements layer three address and interface description changes.

  • Verify that the outcome is as desired.

Open a terminal window on the workstation VM and change to your ~/ansible-generic-project/ directory.

Instructions

Perform the following steps:

  • Create a variables file defining the variables that will be used.

    • Create a vars file named vars/adjustment-data.yml that defines two variables: new_layer3_data and new_interface_data. The new_layer3_data variable should be used in your playbook to configure interface layer 3 addresses. The new_interface_data variable should be used in your playbook to configure interface descriptions. See the Adjustment Phase Interface Descriptions and Adjustment Phase Layer 3 Addressing tables for interface descriptions and layer 3 addresses.

  • Perform a play that implements layer three address and interface description changes.

    • Compose a playbook named adjustment.yml. It should consist of a play that targets only spine01 and spine02. The play should (1) make the new link interfaces passive with respect to OSPF, (2) apply interface descriptions to the new link interfaces, and (3) assign layer 3 addresses to the new link interfaces. The command that would be typed a the command line of a VyOS device to make an interface passive is "set protocols ospf passive-interface interface-name".

    • Perform the play in adjustment.yml that implements the desired changes.

  • Verify that the outcome is as desired.

    • Execute an ad hoc command to verify that interface descriptions and layer 3 addresses are correct for the new link interfaces on spine01 and spine02.

  1. Create a variables file defining the variables that will be used.

    1. Create a vars file named vars/adjustment-data.yml that defines two variables: new_layer3_data and new_interface_data. The new_layer3_data variable should be used in your playbook to configure interface layer 3 addresses. The new_interface_data variable should be used in your playbook to configure interface descriptions. See the Adjustment Phase Interface Descriptions and Adjustment Phase Layer 3 Addressing tables for interface descriptions and layer 3 addresses.

      Create the vars/ directory if it does not already exist.

      [student@workstation ansible-generic-project]$ mkdir -p vars

      Create the vars/adjustment-data.yml file.

      [student@workstation ansible-generic-project]$ cat \
      > vars/adjustment-data.yml
      new_layer3_data:
        spine01:
        - { name: eth3, ipv4: 172.16.50.1/30 }
        spine02:
        - { name: eth3, ipv4: 172.16.50.2/30 }
      new_interface_data:
        spine01:
          eth3:
            description: spine02-as19216
        spine02:
          eth3:
            description: spine01-as10101
  2. Perform a play that implements layer three address and interface description changes.

    1. Compose a playbook named adjustment.yml. It should consist of a play that targets only spine01 and spine02. The play should (1) make the new link interfaces passive with respect to OSPF, (2) apply interface descriptions to the new link interfaces, and (3) assign layer 3 addresses to the new link interfaces. The command that would be typed a the command line of a VyOS device to make an interface passive is "set protocols ospf passive-interface interface-name".

      [student@workstation ansible-generic-project]$ cat adjustment.yml
      ---
      - name: adjust the network layer 3 model
        hosts: spine01, spine02
        vars_files:
          - vars/adjustment-data.yml
      
        tasks:
      
          - name: make the new interfaces passive with respect to OSPF
            vyos_config:
            lines:
              - "set protocols ospf passive-interface 'eth3'"
            when: ansible_network_os == 'vyos'
      
          - name: configure interface descriptions
            vyos_interface:
              name: "{{ item.key }}"
              description: "{{ item.value.description }}"
            with_dict: "{{ new_interface_data[inventory_hostname] }}"
            when: ansible_network_os == 'vyos'
      
          - name: configure layer 3
            vyos_l3_interface:
              aggregate: "{{ new_layer3_data[inventory_hostname] }}"
            when: ansible_network_os == 'vyos'
    2. Perform the play in adjustment.yml that implements the desired changes.

      [student@workstation ansible-generic-project]$ ansible-playbook adjustment.yml
  3. Verify that the outcome is as desired. Execute an ad hoc command to verify that interface descriptions and layer 3 addresses are correct for the new link interfaces on spine01 and spine02.

    [student@workstation ansible-generic-project]$ ansible -m vyos_command \
    > -a "commands='sh int|grep eth3'" spines
    spine01 | SUCCESS => {
        "changed": false,
        "stdout": [
            "eth3             172.16.50.1/30                    u/u  spine02-as19216"
        ],
        "stdout_lines": [
            [
                "eth3             172.16.50.1/30                    u/u  spine02-as19216"
            ]
        ]
    }
    spine02 | SUCCESS => {
        "changed": false,
        "stdout": [
            "eth3             172.16.50.2/30                    u/u  spine01-as10101"
        ],
        "stdout_lines": [
            [
                "eth3             172.16.50.2/30                    u/u  spine01-as10101"
            ]
        ]
    }
Revision: do457-2.5-4693601