top of page

Using NDNA and GRASP to find half-duplex ports in a Data Center

NDNA and the GRASP tool-set can be used (taking just a few minutes ) to identify any network ports that are running at half duplex in an "NDNA discovered" Cisco Data Center.

This will allow you to pull information on thousands of router and switch-ports in minutes and parse that information in seconds.

Note: We first run it using a "filtered" interface command, so you don't run into the 64k limitation with high output, as you probably would if you just ran automation using "show interface" without filtering the output (especially for core devices.)

Once you know what devices are running at half duplex, you can run automation on just those specific devices and use the "show interface" command unfiltered at that point, and incrementally run "show interface | begin <at the end of previous file>" for any devices you find where the returned file's size exceeds 64k.

Procedure: //////////////////

For IOS devices:

----------------------------

Run automation on all IOS devices against an NDNA discovered Data-Center, using the following command in your commands file, e.g. this is the command you will send to all IOS devices (L2 and L3 devices):

sh interface | include Half Duplex|Half-duplex

Once the automation run completes, go into your configs directory of your Data-Center:

cd /usr/DataCenters/<your DC name>/DCDP/configs

Run the following command to parse just the devices that have ports that are running at half duplex:

ls | egrep 'duplex,|Duplex,' *ios*.txt

Note: We include a comma (,) when we parse the output files, as this will exclude the actual command we ran, which includes the word "duplex" (which grep would have matched on) - This will ensure we will only match on devices that have ports running at half duplex

For NXOS devices:

----------------------------

Run automation on all NXOS devices against an NDNA discovered Data-Center, using the following command in your commands file, e.g. this is the command you will send to all NXOS devices (L2 and L3 devices):

sh interface | in half-duplex

Once the automation run completes, go into your configs directory of your Data-Center:

cd /usr/DataCenters/<your DC name>/DCDP/configs

Run the following command to parse just the devices that have ports that are running at half duplex:

ls | grep 'duplex,' *nxos*.txt

Note: We include a comma (,) when we parse the output files, as this will exclude the actual command we ran, which includes the word "duplex" (which grep would have matched on) - This will ensure we will only match on devices that have ports running at half duplex

As stated in previous posts, and on the website, NDNA allows you to be creative in how you parse the data.

This way, in a couple of minutes, you can identify (and document), going through thousands of ports and instantly know which devices have interfaces running at half duplex, allowing you to prepare a plan to investigate and correct the configurations (if needed)

See below for sample output on an automation run against an NDNA discovered Data-Center with ports running at Half Duplex:

root@debian-python:/usr/DataCenters/ACM:NEW-YORK-DC/DCDP/configs# ls | egrep 'duplex,|Duplex,' *ios*.txt 10.31.0.85_2017-08-23 11:18_ios_custom.txt: Half-duplex, 10Mb/s, media type is 10/100BaseTX 10.31.0.130_2017-08-23 11:18_ios_custom.txt: Half-duplex, 100Mb/s, media type is 10/100/1000BaseTX 10.31.0.202_2017-08-23 11:18_ios_custom.txt: Half-duplex, 100Mb/s, media type is 10/100/1000BaseTX 10.31.0.203_2017-08-23 11:18_ios_custom.txt: Half-duplex, 10Mb/s, media type is 10/100/1000BaseTX 10.31.0.203_2017-08-23 11:18_ios_custom.txt: Half-duplex, 100Mb/s, media type is 10/100/1000BaseTX 10.31.0.203_2017-08-23 11:18_ios_custom.txt: Half-duplex, 100Mb/s, media type is 10/100/1000BaseTX 10.31.0.204_2017-08-23 11:18_ios_custom.txt: Half-duplex, 10Mb/s, media type is 10/100/1000BaseTX 10.31.0.205_2017-08-23 11:18_ios_custom.txt: Half-duplex, 10Mb/s, media type is 10/100/1000BaseTX 10.31.0.206_2017-08-23 11:18_ios_custom.txt: Half-duplex, 10Mb/s, media type is 10/100/1000BaseTX 10.31.0.207_2017-08-23 11:18_ios_custom.txt: Half-duplex, 100Mb/s, media type is 10/100/1000BaseTX 10.31.0.208_2017-08-23 11:18_ios_custom.txt: Half-duplex, 100Mb/s, media type is 10/100/1000BaseTX 10.31.0.208_2017-08-23 11:18_ios_custom.txt: Half-duplex, 100Mb/s, media type is 10/100/1000BaseTX 10.31.0.209_2017-08-23 11:18_ios_custom.txt: Half-duplex, 10Mb/s, media type is 10/100/1000BaseTX 10.31.0.26_2017-08-23 11:18_ios_custom.txt: Half-duplex, 10Mb/s, link type is auto, media type is 10/100/1000-TX 10.31.0.26_2017-08-23 11:18_ios_custom.txt: Half-duplex, 100Mb/s, link type is auto, media type is 10/100/1000-TX 10.31.0.26_2017-08-23 11:18_ios_custom.txt: Half-duplex, 10Mb/s, link type is auto, media type is 10/100/1000-TX 10.31.0.26_2017-08-23 11:18_ios_custom.txt: Half-duplex, 100Mb/s, link type is auto, media type is 10/100/1000-TX 10.31.0.26_2017-08-23 11:18_ios_custom.txt: Half-duplex, 10Mb/s, link type is auto, media type is 10/100/1000-TX 10.31.0.26_2017-08-23 11:18_ios_custom.txt: Half-duplex, 10Mb/s, link type is auto, media type is 10/100/1000-TX 10.31.0.65_2017-08-23 11:18_ios_custom.txt: Half-duplex, 100Mb/s, media type is 10/100/1000BaseTX 10.31.65.253_2017-08-23 11:18_ios_custom.txt: Half-duplex, 100Mb/s, media type is 10/100/1000BaseT 10.31.0.1_2017-08-23 11:18_ios_custom.txt: Half-duplex, 100Mb/s, link type is auto, media type is 10/100BaseTX 10.31.0.1_2017-08-23 11:18_ios_custom.txt: Half-duplex, 10Mb/s, link type is auto, media type is 10/100/1000-TX

Notice the duplicate IPs. This is due to multiple ports running at half duplex on the same device.

You could now use the GRASP tool-set to build a list of IPs in a couple of commands. You can then use this IP list in the vendor neutral automation program, e.g. BYOI type of automation. (Bring Your Own IP list) and other ways too - See the user guide for various ways to use your own IP lists with automation.

Build a new IP list with the IPs of devices with ports running at half duplex:

1. Build a single file with output from the list command above:

ls | egrep 'duplex,|Duplex,' *.txt > half-duplex-ports.txt

2. Read this file, parse it and extract the IPs into a new file: (Note the duplicate IPs - This is due to multiple ports in the same device are running at half duplex - we'll remove duplicate IPs and end up with a non-duplicate IP file in the final command)

cat half-duplex-ports.txt | awk {'print $1'} | sed -e 's/_.*//' 10.31.0.85 10.31.0.130 10.31.0.202 10.31.0.203 10.31.0.203 10.31.0.203 10.31.0.204 10.31.0.205 10.31.0.206 10.31.0.207 10.31.0.208 10.31.0.208 10.31.0.209 10.31.0.26 10.31.0.26 10.31.0.26 10.31.0.26 10.31.0.26 10.31.0.26 10.31.0.65 10.31.65.253 10.31.0.1 10.31.0.1

Same command but we remove duplicates:

cat half-duplex-ports.txt | awk {'print $1'} | sed -e 's/_.*//' | awk '{ if (a[$1]++ ==0) print $0; }'

10.31.0.85 10.31.0.130 10.31.0.202 10.31.0.203 10.31.0.204 10.31.0.205 10.31.0.206 10.31.0.207 10.31.0.208 10.31.0.209 10.31.0.26 10.31.0.65 10.31.65.253 10.31.0.1

Same command but redirect to a file: and remove duplicates

cat half-duplex-ports.txt | awk {'print $1'} | sed -e 's/_.*//' | awk '{ if (a[$1]++ ==0) print $0; }' > half-duplex-ports-IP-List.txt

That's it!

As always, Stay tuned for more creative ways to use the NDNA program....

Best Regards,

Brett M. Spunt, CCIE No. 12745

Featured Posts
Recent Posts