ChatGPT and the Network Engineer – Part 2

tiktok, artificial intelligence, ai-6767502.jpg

Last updated on February 10th, 2023 at 08:46 am

This post is the second part of a series. Click here for Part 1 and Part 3.

The goal of this article is not to describe ChatGPT but provide my experience as a Network Engineer using ChatGPT. If you want to know more about it, visit these two links. Wikipedia ChatGPT and OpenAI ChatGPT FAQ. Also, this is a multipart article.

In Part 1, we used ChatGPT to ask what is ARPANET, IP Subnetting, Cisco Interface Best Practices, Wireshark, NMAP, and a Python Script. With Part 3, I review using ChatGPT for creating network documentation.

In this article, we will review ChatGPT with the following:

One thing I noticed is it’s not perfect. It will correct itself, especially when you call it out on a mistake, though I expect this to improve over time. Also, how the initial or follow-up question or request is phrased does affect the response/output.

Also, any configurations/codes should be reviewed and tested. Often, what is provided is a start, baseline, or template, but it is also based on the question(s) or information provided to ChatGPT.

Let’s Get Into ChatGPT

PAN Restart Routing Process

The goal was to ask ChatGPT the command to restart the routing process on a Palo Alto Networks (PAN) firewall. I already knew the answer but wanted to see the response. Because of the first response, I asked a second time. With both responses, this is where you have to take some responses with a grain of salt.

The current and correct command is “debug routing restart.”

Here is the first request, and though partially right, but not exactly.

PAN Routing Process Restart

With the second request, it is close but a miss.

Second PAN Routing Process Restart

Here is a PAN knowledge base regarding restarting the routing process. The correct and current command can be found in my PAN CLI Cheat Sheet.

https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA10g000000Cm1kCAC&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail

PAN System Resources

Again, I knew the answer to the question. This time the response is correct.

PAN System Resources

PAN Knowledge base article about the system resources command.

https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA10g000000ClUb

PAN User Group

Checking user group mappings on a PAN firewall is done best at the CLI. Some of the commands can be confusing and with multiple options. This is one reason I created the CLI cheat sheet, which can be found here. It’s this cheat sheet that I used as a reference for the ChatGPT request and this section.

I asked the same question twice and received different answers. Both wrong.

PAN Group Mapping
PAN Group Mapping Request 2

Both responses are wrong, as here is a summary of the wrong answers provided and the available or correct answers.

Wrong responses:
show group-mapping “group-name”
show user group “group_name”
show user group-mapping

The correct options:
show user group name “domain\group_name
show user group name ?
show user group list
show user group-mapping state all
show user group-mapping state group_name

BGP

Although ChatGPT did not do so well with Palo Alto Networks, it did well with BGP. I asked for a basic BGP peer configuration, and the result is correct but basic.

The response uses a loopback interface and provides a follow-up command to check the BGP session.

Basic Cisco BGP

Though, I did ask if a loopback has to be used.

Cisco BGP Loopback?

The response is correct, and the explanation is helpful.

No Loopback

There are articles and videos about ChatGPT or AI and the Network Engineer, including this one. I agree with those who say ChatGPT can or will be a great resource when learning or studying for a certification.

BGP Default Route

To follow up with the previous BGP configuration, I asked to add to the configuration for accepting a default route. Unfortunately, I had to ask again for the default route configuration. The response provided both the default route config and the config for both peers and an explanation of each command.

BGP using a Default route

Requesting the configuration to only accept a default route.

Default route using Prefix List
BGP Command Explanations

Other than asking a second time for a default route configuration, ChatGPT did a good job of providing a configuration and explanations. If time permits, I will ask for a more complex configuration.

So far, ChatGPT is on a great path and ready to help with basic BGP configurations and can be helpful for those learning BGP. Next, I’ll have to check OSPF when I have time.

Added 01-Feb-2023 IP Resolution

On occasion, I need to resolve multiple IP addresses to a hostname. Many times those addresses are in an Excel document, and most times, the addresses are internal. Having used ChatGPT for Python scripts, I decided to see if I could use both with Excel documents for IP resolution.

Full disclosure. As I’ve said in Part 1, I don’t have Python experience. I started a self-paced Python course but only had time to complete 2 hours.

Here are the requirements for using Python:

  • Create a script that reads the Excel file named ip-name-resolution.xlsx.
  • Use the IP address data in column A, rows 1 – 6.
  • Resolve these IP addresses to hostnames using DNS.
  • Enter the resolved hostnames in column B in the Excel file name ip-name-resolved.xlsx.

Here is the content of the Excel file ip-name-resolution.xlsx. I used public IP addresses in this example.

IP addresses to resolve

The ChatGPT request and output.

ChatGPT request

For this script, Python needs openpyxl, a Python library to read/write Excel xlsx/xlsm files. I did not know what this is and looked it up. And no, I did not use ChatGPT.

I created the Excel file with the IP addresses to resolve and copied the ChatGPT code into a Python file. I installed the openpyxl library then in PowerShell, I ran the Python script.

Once the script was done, I opened the ip-name-resolved.xlsx file, and low and behold, the file had the host names. I checked each one manually to be sure.

Resolved IP addresses results

This GIF says it all!

Conclusion

ChatGPT is a resource that can provide the starting point for Network Engineers and, of course, many others. I believe ChatGPT is here and here to stay and will improve over time. Am I excited about ChatGPT? Most certainly. At least I don’t have to carry a case full of books!

Want to know when I add new or update content? Sign up for email updates.

Copyright © Packet Passers 2024