Tuesday, November 20, 2012

Nexus Port Profiles


Real short one today. This post is about Nexus port profiles. Port profiles are great for ensuring consistency across port configurations. They allow us to configure a template which is inherited by a group of ports. There are three types of port-profiles: Ethernet, Interface-VLAN (SVI) and Port-Channel. In my example, we’ll be configuring several ports as “VM Server” ports. Some may be asking why one would choose these over the simple “interface range” command. In my opinion, port profiles are more strict. The range command configures any range of ports where a port profile configures ALL ports which inherit it. Any new configuration added to the profile is pushed to the inheriting ports as well.
Here’s an example:
n5k-1(config)# port-profile type ethernet VM
n5k-1(config-port-prof)# switchport access vlan 225
n5k-1(config-port-prof)# spanning-tree port type edge
n5k-1(config-port-prof)# spanning-tree bpduguard enable
n5k-1(config-port-prof)# state enabled
Pretty basic. We create an “ethernet” port profile named VM and assign some config to it. The command “state enabled” makes this profile usable, without this command we wouldn’t be able to inherit the profile on a port.

Here is how we assign the config to a group of ports:
n5k-1(config)# int e1/22 - 25
n5k-1(config-if-range)# inherit port-profile VM
We select a range of ports and tell them to inherit the VM profile. That’s all.

Now we will do some verification:
n5k-1(config-port-prof)# sh port-profile
port-profile VM
 type: Ethernet
 description:
 status: enabled
 max-ports: 512
 inherit:
 config attributes:
  switchport access vlan 225
  spanning-tree port type edge
  spanning-tree bpduguard enable
 evaluated config attributes:
  switchport access vlan 225
  spanning-tree port type edge
  spanning-tree bpduguard enable
 assigned interfaces:
  Ethernet1/22
  Ethernet1/23
  Ethernet1/24
  Ethernet1/25
This command tells us everything. We see our that the profile is enabled, the config it’s using and what ports are inheriting it.
Here’s another way to find profile information:
n5k-1(config-port-prof)# sh run port-profile
port-profile type ethernet VM
  switchport access vlan 225
  spanning-tree port type edge
  spanning-tree bpduguard enable
  state enabled
 
interface Ethernet1/22
  inherit port-profile VM
 
interface Ethernet1/23
  inherit port-profile VM
 
interface Ethernet1/24
  inherit port-profile VM
 
interface Ethernet1/25
  inherit port-profile VM

That’s it. Pretty simple to understand and configure, but also very useful.