How to recover password Cisco Nexus N9K – Recovery password

To recover the password on Cisco Nexus 9000, you need to restart the switch.

During the boot process, you need to escape with Ctrl+C

Detected CISCO MIFPGA
Version 2.16.1240. Copyright (C) 2013 American Megatrends, Inc. 
Board type 2
IOFPGA @ 0xc8000000
SLOT_ID @ 0xf
Aborting config file read and autoboot 
No autoboot or failed autoboot. falling to loader 


 Loader Version 7.34

loader > help 
? Print the command list
boot Boot image
bootmode Display/Change current boot mode
dir List file contents on a device
eobc Booting image from active sup via EOBC channel
help Print the command list or the specific command usage
ip Setting IP address or gateway address
reboot Reboot the system
serial Serial console setting
set Set network configuration
show Show loader configuration

Enter in recovery mode with the following command cmdline recoverymode=1 and boot the image.

loader > cmdline recoverymode=1 

loader > dir 

bootflash:: 

 lost+found
 .patch
 .rpmstore
[...]
 nxos.7.0.3.I5.2.bin
 .swtam

loader > boot nxos.7.0.3.I5.2.bin 
Booting nxos.7.0.3.I5.2.bin 
Trying diskboot 
 Filesystem type is ext2fs, partition type 0x83
Image valid


Image Signature verification was Successful.

Boot Time: 4/10/2017 8:33:0
Installing klm_card_index
done
INIT: version 2.88 booting
Installing ata_piix module ... done.
Unsquashing rootfs ...
Installing isan procfs ... done.
Installing SSE module with card index 21025 ... done.
Creating SSE device node 248 ... done.
Loading I2C driver ... done.
Installing CCTRL driver for card_type 19 without NEED_GEM ... done.
Loading IGB driver ... done.
[...]

In configuration mode, change the admin password and load the image.

A copy of each such license is available at
http://www.opensource.org/licenses/gpl-2.0.php and
http://opensource.org/licenses/gpl-3.0.html and
http://www.opensource.org/licenses/lgpl-2.1.php and
http://www.gnu.org/licenses/old-licenses/library.txt.
switch(boot)# config ter
Enter configuration commands, one per line. End with CNTL/Z.
switch(boot)(config)# admin-password ?
 <WORD> Password for user admin (Max Size - 64)
switch(boot)(config)# admin-password C1sco1234
WARNING! Enabling local authentication for login through console due to password recovery
switch(boot)(config)# exit

switch(boot)# load-nxos 
Unsquashing rootfs ...
Creating /dev/mcelog
Starting mcelog daemon
Overwriting dme stub lib
INIT: Switching to runlevel: 3
INIT: Sending processes the TERM signal
File /etc/shared/localtime exists.
INIT: (boot)# 
Running S93thirdparty-script...

Populating conf files for hybrid sysmgr ...
Starting hybrid sysmgr ...
[...]

Your device is UP with the new password.

Cisco DHCP with client-identifier 27 bytes

How configure the good value for a DHCP reservation with a client-identifier 27 bytes?

R1 will be the dhcp server with a DHCP POOL SERVER3. The client MAC Address will be : aacf.a2e3.aaff

Configuration ont the client :

 interface Ethernet0/0
 mac-address aacf.a2e3.aaff
 ip address dhcp

The problem here is to find the good value for the client identifier with 27 bytes (vendor-xxxx.xxxx.xxxx-Interface)

The first possibility is to find on the Internet a convertor Hex to ASCII.

The other one is to use the debug information on the client to find the good value with debug dhcp detail command.

Now we will shutting down the interface and no shut to generate a DHCP negotiation.

Now we see the good value here :

Retry count: 1 Client-ID: cisco-aacf.a2e3.aaff-Et0/0
 Client-ID hex dump: 636973636F2D616163662E613265332E
 616166662D4574302F30

The request is the following in ASCII : Client-ID: cisco-aacf.a2e3.aaff-Et0/0

In Hexadecimal : 636973636F2D616163662E613265332E616166662D4574302F30

Now you just need to configure the DHCP pool on the server and add “00” to the Hexadecimal value like this :

ip dhcp pool SERVER3
 host 192.168.30.103 255.255.255.0
 client-identifier 00636973636F2D616163662E613265332E616166662D4574302F30

Now the client can receive the IP address :

*Jul 23 17:44:36.638: DHCP: SRequest attempt # 1 for entry:
*Jul 23 17:44:36.638: Temp IP addr: 192.168.30.103 for peer on Interface: Ethernet0/0
*Jul 23 17:44:36.638: Temp sub net mask: 255.255.255.0
*Jul 23 17:44:36.638: DHCP Lease server: 192.168.30.13, state: 4 Requesting
*Jul 23 17:44:36.638: DHCP transaction id: B43
*Jul 23 17:44:36.638: Lease: 86400 secs, Renewal: 0 secs, Rebind: 0 secs
*Jul 23 17:44:36.638: Next timer fires after: 00:00:03
*Jul 23 17:44:36.638: Retry count: 1 Client-ID: cisco-aacf.a2e3.aaff-Et0/0
*Jul 23 17:44:36.638: Client-ID hex dump: 636973636F2D616163662E613265332E
*Jul 23 17:44:36.639: 616166662D4574302F30
<...>
*Jul 23 17:44:39.657: DHCP: Releasing ipl options:
*Jul 23 17:44:39.657: DHCP: Applying DHCP options:
*Jul 23 17:44:39.657: DHCP: Sending notification of ASSIGNMENT:
*Jul 23 17:44:39.657: Address 192.168.30.103 mask 255.255.255.0
*Jul 23 17:44:39.657: DHCP Client Pooling: ***Allocated IP address: 192.168.30.103
*Jul 23 17:44:39.730: Allocated IP address = 192.168.30.103 255.255.255.0
Client(config-if)#do sh ip int brief
 Interface IP-Address OK? Method Status Protocol
 Ethernet0/0 192.168.30.103 YES DHCP up up

How simplify the configuration on your Cisco Nexus 5K

Port profiles can reduce errors and apply the same configurations.

You create a port-profile and inherit it on your interface. Don’t forget the max-port  on your port-profile if you apply on a lot interface.

port-profile type ethernet FREE
max-port 1024
shutdown
state enable
port-profile type ethernet ACCESS_PORT
max-port 1024
switchport mode access
spanning-tree port type edge
no cdp enable
no shutdown
state enable

After you can use your port-profile and add you Vlan ID for example. You reduce the number of line and use each time your interface with the same commands.

interface eth101/1/1
inherit port-profile ACCESS_PORT
switchport access vlan 100

You can use this command to display the complete configuration :

sh run int eth101/1/1 expand-port-profile

PVLAN

Network architecture

In this test, we used an ASA5505 as gateway, a Cisco 3750 for the switching and ESXi.

PVLAN_ARCHI

We used 4 Vlans. Vlan110 as primary and 111 to 113 as secondary.

We created a distributed switch on the vCenter and created the private vlans.

PVLAN_ESX

DVSwitch PVLAN Settings

PVLAN_esx2

PortGroup List

PVLAN_esx3

PortGroup Settings

On this plateform, SRV1, SRV2 and SRV4 can communicate together and with her gateway and the SVI, but can’t with SRV3, SRV5, SRV6 and SRV7.

SRV6 and SRV7 can communicate together and with her gateway and the SVI, but can’t with this other SRV.

Finally SRV3 and SRV5 are totally isolated and can only communicate with the gateway and the SVI.

Limitation: With a 3750, you can’t trunk the promiscuous port to a router or firewall tag with 802.1q

With a Nexus some commands have been added.

# switchport private-vlan ?
 association Private vlan trunk association
 host-association Set the private VLAN host association
 mapping Set the private VLAN access/trunk promiscuous mapping
 trunk Set the private vlan trunking configuration

Now you can trunk your promiscuous port :

# switchport private-vlan mapping trunk ?
 <1-3967,4048-4093> Primary private VLAN

Now we will try to use PVLAN in promicuous and add a Nexus 3548 with the following version : 6.0(2)A7(1). Before this version, I can’t enable the feature private-vlan.

PVLAN_ARCHI2

The main difference is the capacity to trunk on the promiscuous port.

interface Ethernet1/1
 speed 1000
 switchport mode private-vlan trunk promiscuous
 spanning-tree port type edge trunk
 duplex full
 switchport private-vlan mapping trunk 300 301
 switchport private-vlan mapping trunk 200 201-202
 switchport private-vlan mapping trunk 110 111-113
 no shutdown

Here we have three primary vlans (110, 200 and 300) trunked to the firewall.

ASA5510# sh run interface
!
interface Ethernet0/0
 nameif OUTSIDE
 security-level 0
 ip address 213.218.130.78 255.255.255.0
!
interface Ethernet0/1
 no nameif
 security-level 100
 no ip address
!
interface Ethernet0/1.110
 vlan 110
 nameif INSIDE
 security-level 100
 ip address 192.168.1.1 255.255.255.0
!
interface Ethernet0/1.200
 vlan 200
 nameif INSIDE200
 security-level 100
 ip address 192.168.200.1 255.255.255.0
!
interface Ethernet0/1.300
 vlan 300
 nameif INSIDE300
 security-level 100
 ip address 192.168.30.1 255.255.255.0

Now in the following design, we transport the Private-vlan through a 3750 and we transform the private-vlan isolated 113 to a normal vlan 10. But you can also just terminated with private-vlan.

PVLAN_ARCHI3

The SRV7 can ping every other servers and the gateway (SRV1 to SRV6), but SRV1 to 6 can’t ping themself except the SRV7.

 

Nexus – SNMP find Ifindex oid

sh interface snmp-ifindex
--------------------------------------------------------------------------------
 Port IFMIB Ifindex (hex)
 --------------------------------------------------------------------------------
 Eth1/1 436207616 (0x1a000000)
 Eth1/2 436211712 (0x1a001000)
 Eth1/3 436215808 (0x1a002000)
 Eth1/4 436219904 (0x1a003000)
 Eth1/5 436224000 (0x1a004000)
 ..
 Po10            369098761  (0x16000009)
 ..
 Eth100/1/1      526581760  (0x1f630000)