cisco.nxos.nxos_l3_interfaces module – L3 interfaces resource module
Note
This module is part of the cisco.nxos collection (version 11.0.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install cisco.nxos
.
To use it in a playbook, specify: cisco.nxos.nxos_l3_interfaces
.
New in cisco.nxos 1.0.0
Synopsis
This module manages Layer-3 interfaces attributes of NX-OS Interfaces.
Parameters
Parameter |
Comments |
---|---|
A dictionary of Layer-3 interface options |
|
Manually set the bandwidth |
|
Specify that bandwidth is inherited Choices:
|
|
Bandwidth in kilobits |
|
Configure DHCP snooping or relay |
|
DHCP snooping for ipv4 |
|
DHCP option82. |
|
DHCP option82. |
|
DHCP option82 suboption circuit-id string configuration. |
|
Configure relay agent. |
|
List of ipv4 relay addresses |
|
IP address |
|
Helper address VRF membership |
|
Relay agent information option. |
|
Enable relay trust on this interface. Choices:
|
|
Configure gateway address for DHCP relay |
|
Interface ID |
|
Type of interface |
|
Configure gateway address for DHCP relay |
|
IP address |
|
Configure DHCP smart relay on interface. Choices:
|
|
DHCP snooping for ipv6 |
|
Configure relay agent. |
|
Configure DHCPv6 server relay address |
|
Interface ID |
|
Type of interface |
|
IP address |
|
Helper address VRF membership |
|
Configure source interface for DHCPv6 relay. |
|
Interface ID |
|
Type of interface |
|
Configure DHCP smart relay on interface. Choices:
|
|
Configures IEEE 802.1Q VLAN encapsulation on a subinterface. |
|
VxLAN evpn multisite Interface tracking. Supported only on selected model. Choices:
|
|
IPv4 address and attributes of the L3 interface. |
|
IPV4 address of the L3 interface. |
|
IP prefix and network mask length in format x.x.x.x/m or IP network mask in format m.m.m.m |
|
URIB route preference for local/direct routes |
|
A boolean attribute to manage addition of secondary IP address. Choices:
|
|
URIB route tag value for local/direct routes. |
|
IPv6 address and attributes of the L3 interface. |
|
IPV6 address of the L3 interface. |
|
Prefix-Length for AM Route Aggregation |
|
Configure IPv6 anycast address on interface Choices:
|
|
Configure Extended Unique Identifier for the low-order 64 bits Choices:
|
|
URIB route preference for local/direct routes |
|
URIB route tag value for local/direct routes. |
|
Use BIA Choices:
|
|
Enables/disables ipv6 redirects. Choices:
|
|
Enables/disables ip redirects. Choices:
|
|
Unicast Reverse Path Forwarding. |
|
Unicast Reverse Path Forwarding. |
|
Validation of source address. |
|
Specify reachability check to apply to the source address. |
|
Loose Default Route Unicast Reverse Path Forwarding. Choices:
|
|
Source is reachable via any/rx interface. |
|
Manually set interface MAC address or extract the MAC address (3) from the IPv6 address configured on the interface. |
|
Full name of L3 interface, i.e. Ethernet1/1. |
|
Enable sending ICMP port-unreachable. Choices:
|
|
Configure proxy ARP. Choices:
|
|
Enables/disables ipv4 redirects. Choices:
|
|
Enables/disables ip redirects. Choices:
|
|
Configure Unicast Reverse Path Forwarding or IP Source Guard. |
|
Unicast Reverse Path Forwarding. |
|
Validation of source address. |
|
Specify reachability check to apply to the source address. |
|
Loose Default Route Unicast Reverse Path Forwarding. Choices:
|
|
Source is reachable via any/rx interface. |
|
This option is used only with state parsed. The value of this option should be the output received from the IOS device by executing the command show running-config | section ^interface. The state parsed reads the configuration from |
|
The state the configuration should be left in The states rendered, gathered and parsed does not perform any change on the device. The state rendered will transform the configuration in The state gathered will fetch the running configuration from device and transform it into structured data in the format as per the resource module argspec and the value is returned in the gathered key within the result. The state parsed reads the configuration from Choices:
|
Notes
Note
Tested against NXOS 7.3.(0)D1(1) on VIRL
Unsupported for Cisco MDS
Examples
# Using merged
# Before state:
# -------------
#
# router# show running-config | section interface
# interface Ethernet1/1
# interface Ethernet1/2
- name: Merge provided configuration with device configuration.
cisco.nxos.nxos_l3_interfaces:
config:
- name: Ethernet1/1
mac_address: 0011.2233.4455
ipv4:
verify:
unicast:
source:
reachable_via:
mode: any
allow_default: true
dhcp:
relay:
address:
- relay_ip: 11.0.0.1
vrf_name: abc
- name: Ethernet1/2
ipv6:
addresses:
- ipv6_address: 2001:db8::1/32
route_preference: 70
tag: 97
dhcp:
relay:
address:
- relay_ip: 2001:db8::1:abcd
state: merged
# Task Output
# -----------
#
# before:
# - name: Ethernet1/1
# - name: Ethernet1/2
# commands:
# - interface Ethernet1/1
# - mac-address 0011.2233.4455
# - ip verify unicast source reachable-via any allow-default
# - ip dhcp relay address 11.0.0.1 use-vrf abc
# - interface Ethernet1/2
# - ipv6 address 2001:db8::1/32 route-preference 70 tag 97
# - ipv6 dhcp relay address 2001:db8::1:abcd
# after:
# - name: Ethernet1/1
# mac_address: 0011.2233.4455
# ipv4:
# verify:
# unicast:
# source:
# reachable_via:
# mode: any
# allow_default: true
# dhcp:
# relay:
# address:
# - relay_ip: 11.0.0.1
# vrf_name: abc
# - name: Ethernet1/2
# ipv6:
# addresses:
# - ipv6_address: 2001:db8::1/32
# route_preference: 70
# tag: 97
# dhcp:
# relay:
# address:
# - relay_ip: 2001:db8::1:abcd
# After state:
# ------------
#
# router# show running-config | section interface
# interface Ethernet1/1
# mac-address 0011.2233.4455
# ip verify unicast source reachable-via any allow-default
# ip dhcp relay address 11.0.0.1 use-vrf abc
# interface Ethernet1/2
# ipv6 address 2001:db8::1/32 route-preference 70 tag 97
# ipv6 dhcp relay address 2001:db8::1:abcd
# Using replaced
# Before state:
# -------------
#
# router# show running-config | section interface
# interface Ethernet 1/1
# mac-address 00:11:22:33:44:55
# ip verify unicast source reachable-via any allow-default
# ip dhcp relay address 11.0.0.1 use-vrf abc
# interface Ethernet 1/2
# ipv6 dhcp relay address 2001:0db8::1:abcd
# ipv6 address 2001:db8::1/32 route-preference 70 tag 97
- name: Replace device configuration of specified L3 interfaces with provided configuration.
cisco.nxos.nxos_l3_interfaces:
config:
- name: Ethernet1/2
mac_address: 0011.2233.4456
ipv6:
addresses:
- ipv6_address: 2001:db8::1/32
route_preference: 200
tag: 22
dhcp:
relay:
address:
- relay_ip: 2001:db8::1:abcd
state: replaced
# Task Output
# -----------
#
# before:
# - name: Ethernet1/1
# mac_address: 0011.2233.4455
# ipv4:
# verify:
# unicast:
# source:
# reachable_via:
# mode: any
# allow_default: true
# dhcp:
# relay:
# address:
# - relay_ip: 11.0.0.1
# vrf_name: abc
# - name: Ethernet1/2
# ipv6:
# addresses:
# - ipv6_address: 2001:db8::1/32
# route_preference: 70
# tag: 97
# dhcp:
# relay:
# address:
# - relay_ip: 2001:db8::1:abcd
# commands:
# - interface Ethernet1/2
# - no ipv6 address 2001:db8::1/32 route-preference 70 tag 97
# - ipv6 address 2001:db8::1/32 route-preference 200 tag 22
# - mac-address 0011.2233.4456
# after:
# - name: Ethernet1/1
# mac_address: 0011.2233.4455
# ipv4:
# verify:
# unicast:
# source:
# reachable_via:
# mode: any
# allow_default: true
# dhcp:
# relay:
# address:
# - relay_ip: 11.0.0.1
# vrf_name: abc
# - name: Ethernet1/2
# mac_address: 0011.2233.4456
# ipv6:
# addresses:
# - ipv6_address: 2001:db8::1/32
# route_preference: 200
# tag: 22
# dhcp:
# relay:
# address:
# - relay_ip: 2001:db8::1:abcd
# After state:
# ------------
#
# router# show running-config | section interface
# interface Ethernet1/1
# mac-address 0011.2233.4455
# ip verify unicast source reachable-via any allow-default
# ip dhcp relay address 11.0.0.1 use-vrf abc
# interface Ethernet1/2
# mac-address 0011.2233.4456
# ipv6 address 2001:db8::1/32 route-preference 200 tag 22
# ipv6 dhcp relay address 2001:db8::1:abcd
# Using overridden
# Before state:
# -------------
#
# router# show running-config | section interface
# interface Ethernet 1/1
# mac-address 00:11:22:33:44:55
# ip verify unicast source reachable-via any allow-default
# ip dhcp relay address 11.0.0.1 use-vrf abc
# interface Ethernet 1/2
# ipv6 dhcp relay address 2001:0db8::1:abcd
# ipv6 address 2001:db8::1/32 route-preference 70 tag 97
- name: Override device configuration with provided configuration.
cisco.nxos.nxos_l3_interfaces:
config:
- name: Ethernet1/1
mac_address: 0011.2233.4455
ipv4:
verify:
unicast:
source:
reachable_via:
mode: any
allow_default: true
state: overridden
# Task Output
# -----------
#
# before:
# before:
# - name: Ethernet1/1
# mac_address: 0011.2233.4455
# ipv4:
# verify:
# unicast:
# source:
# reachable_via:
# mode: any
# allow_default: true
# dhcp:
# relay:
# address:
# - relay_ip: 11.0.0.1
# vrf_name: abc
# - name: Ethernet1/2
# ipv6:
# addresses:
# - ipv6_address: 2001:db8::1/32
# route_preference: 70
# tag: 97
# dhcp:
# relay:
# address:
# - relay_ip: 2001:db8::1:abcd
# commands:
# - interface Ethernet1/1
# - no ip dhcp relay address 11.0.0.1 use-vrf abc
# - interface Ethernet1/2
# - no ipv6 address 2001:db8::1/32 route-preference 70 tag 97
# - no ipv6 dhcp relay address 2001:db8::1:abcd
# after:
# - name: Ethernet1/1
# mac_address: 0011.2233.4455
# ipv4:
# verify:
# unicast:
# source:
# reachable_via:
# mode: any
# allow_default: true
# - name: Ethernet1/2
# After state:
# ------------
#
# router# show running-config | section interface
# interface Ethernet1/1
# mac-address 0011.2233.4455
# ip verify unicast source reachable-via any allow-default
# Using deleted
# Before state:
# -------------
#
# router# show running-config | section interface
# interface Ethernet 1/1
# mac-address 00:11:22:33:44:55
# ip verify unicast source reachable-via any allow-default
# ip dhcp relay address 11.0.0.1 use-vrf abc
# interface Ethernet 1/2
# ipv6 dhcp relay address 2001:0db8::1:abcd
# ipv6 address 2001:db8::1/32 route-preference 70 tag 97
- name: Delete L3 attributes of given interfaces (This won't delete the interface
itself).
cisco.nxos.nxos_l3_interfaces:
config:
- name: Ethernet1/1
- name: Ethernet1/2
state: deleted
# Task Output
# -----------
#
# before:
# - name: Ethernet1/1
# mac_address: 0011.2233.4455
# ipv4:
# verify:
# unicast:
# source:
# reachable_via:
# mode: any
# allow_default: true
# dhcp:
# relay:
# address:
# - relay_ip: 11.0.0.1
# vrf_name: abc
# - name: Ethernet1/2
# ipv6:
# addresses:
# - ipv6_address: 2001:db8::1/32
# route_preference: 70
# tag: 97
# dhcp:
# relay:
# address:
# - relay_ip: 2001:db8::1:abcd
# commands:
# - interface Ethernet1/1
# - no mac-address 0011.2233.4455
# - no ip verify unicast source reachable-via any allow-default
# - no ip dhcp relay address 11.0.0.1 use-vrf abc
# - interface Ethernet1/2
# - no ipv6 address 2001:db8::1/32 route-preference 70 tag 97
# - no ipv6 dhcp relay address 2001:db8::1:abcd
# after:
# - name: Ethernet1/1
# - name: Ethernet1/2
# After state:
# ------------
#
# router# show running-config | section interface
# interface Ethernet1/1
# interface Ethernet1/2
# Using rendered
- name: Use rendered state to convert task input to device specific commands
cisco.nxos.nxos_l3_interfaces:
config:
- name: Ethernet1/1
mac_address: 0011.2233.4455
ipv4:
verify:
unicast:
source:
reachable_via:
mode: any
allow_default: true
dhcp:
relay:
address:
- relay_ip: 11.0.0.1
vrf_name: abc
- name: Ethernet1/2
ipv6:
addresses:
- ipv6_address: 2001:db8::1/32
route_preference: 70
tag: 97
dhcp:
relay:
address:
- relay_ip: 2001:db8::1:abcd
state: rendered
# Task Output
# -----------
#
# rendered:
# - interface Ethernet1/1
# - mac-address 0011.2233.4455
# - ip verify unicast source reachable-via any allow-default
# - ip dhcp relay address 11.0.0.1 use-vrf abc
# - interface Ethernet1/2
# - ipv6 address 2001:db8::1/32 route-preference 70 tag 97
# - ipv6 dhcp relay address 2001:db8::1:abcd
# Using parsed
# parsed.cfg
# ----------
#
# interface Ethernet1/1
# mac-address 0011.2233.4455
# ip verify unicast source reachable-via any allow-default
# ip dhcp relay address 11.0.0.1 use-vrf abc
# interface Ethernet1/2
# ipv6 address 2001:db8::1/32 route-preference 70 tag 97
# ipv6 dhcp relay address 2001:db8::1:abcd
- name: Use parsed state to convert externally supplied config to structured format
cisco.nxos.nxos_l3_interfaces:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Task output
# -----------
#
# parsed:
# - name: Ethernet1/1
# mac_address: 0011.2233.4455
# ipv4:
# verify:
# unicast:
# source:
# reachable_via:
# mode: any
# allow_default: true
# dhcp:
# relay:
# address:
# - relay_ip: 11.0.0.1
# vrf_name: abc
# - name: Ethernet1/2
# ipv6:
# addresses:
# - ipv6_address: 2001:db8::1/32
# route_preference: 70
# tag: 97
# dhcp:
# relay:
# address:
# - relay_ip: 2001:db8::1:abcd
# Using gathered
# Before state:
# -------------
#
# interface Ethernet 1/1
# mac-address 00:11:22:33:44:55
# ip verify unicast source reachable-via any allow-default
# ip dhcp relay address 11.0.0.1 use-vrf abc
# interface Ethernet 1/2
# ipv6 dhcp relay address 2001:0db8::1:abcd
# ipv6 address 2001:db8::1/32 route-preference 70 tag 97
- name: Gather l3_interfaces facts from the device using nxos_l3_interfaces
cisco.nxos.nxos_l3_interfaces:
state: gathered
# Task output
# -----------
#
# gathered:
# - name: Ethernet1/1
# mac_address: 0011.2233.4455
# ipv4:
# verify:
# unicast:
# source:
# reachable_via:
# mode: any
# allow_default: true
# dhcp:
# relay:
# address:
# - relay_ip: 11.0.0.1
# vrf_name: abc
# - name: Ethernet1/2
# ipv6:
# addresses:
# - ipv6_address: 2001:db8::1/32
# route_preference: 70
# tag: 97
# dhcp:
# relay:
# address:
# - relay_ip: 2001:db8::1:abcd
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The resulting configuration after module execution. Returned: when changed Sample: |
|
The configuration prior to the module execution. Returned: when state is Sample: |
|
The set of commands pushed to the remote device. Returned: when state is Sample: |
|
Facts about the network resource gathered from the remote device as structured data. Returned: when state is Sample: |
|
The device native config provided in running_config option parsed into structured data as per module argspec. Returned: when state is Sample: |
|
The provided configuration in the task rendered in device-native format (offline). Returned: when state is Sample: |