How I Built a Router Configuration Generator and Dockerized It for Field Engineers

Written by Awal Hakim

December 14, 2024

Image of Docker Logo

Have you ever looked at a tedious, repetitive task and thought, There has to be a better way? That’s exactly how I felt about router configurations. As a network engineer working closely with field engineers, I often saw them struggling to remember different CLI commands for various router brands. Every router seemed to have quirks from Cisco to Fortinet, HPE to Huawei. In addition to that, there was the need to switch between static and dynamic routing or set up sub-interfaces, and the process became a maze of commands.

I knew there had to be a way to simplify things. That’s when I decided to build a Router Configuration Generator—an app that would take the guesswork out of basic configurations. Because I believe in the power of making tools accessible, I took it one step further and Dockerized the app. Now, anyone with Docker can run it anywhere, anytime.

Here’s the story of how it all came together.


The Problem: Field Engineers vs. CLI Chaos

Field engineers are the unsung heroes of networking. They’re the ones out in the trenches, setting up routers, troubleshooting connectivity, and ensuring everything works as expected. But the sheer variety of commands for different router brands makes their job harder than it needs to be.

Take a simple task like configuring a router. Depending on the brand and model, the commands can vary wildly. A Cisco command doesn’t look like a Huawei command and don’t even get me started on Fortinet’s FortiOS. Field engineers often have to juggle reference guides, remember specific syntax, and hope they don’t mistype something critical.

That’s where my app comes in. I wanted to create a tool that:

  • Allowed engineers to input key parameters like IP addresses, routing types (static or dynamic), and sub-interface details.
  • Automatically generated the correct configuration script based on the router’s brand and model.
  • Provided a simple, portable solution for basic connectivity setup, without needing to dive deep into every router’s CLI.

The Solution: A Router Configuration Generator App

The app I built is like a Swiss Army knife for router configs. It uses Python and Jinja2 to generate scripts dynamically. Engineers just need to select the router brand (e.g., Cisco, HPE, Huawei, Fortinet), input the parameters, and hit “Generate.”

Behind the scenes, the app pulls from a library of templates I created for each brand and model. These templates are preloaded with the correct CLI commands for:

  • Cisco (multiple models, IOS-based)
  • HPE (MSR routers)
  • Fortinet (FortiOS)
  • Huawei (various models)

Once the configuration is generated, the engineer can copy it or download it as a file to apply directly to the router. No more flipping through manuals or Googling commands—they can get up and running in minutes.

A screenshot Image Of The Router Configuration Generator That I Created

Taking It Further: Why I Dockerized the Router Configuration Generator Tool

Now, here’s where the story gets interesting. The app was working great on my local machine, but I wanted to share it with my team. That’s when I realized that installing Python, setting up dependencies, and getting everything running on someone else’s system would be a hassle.

Enter Docker. With Docker, I could package the app with all its dependencies into a container. This meant:

  1. Portability: The app could run anywhere, from a laptop to a cloud server, without worrying about compatibility issues.
  2. Ease of Use: Field engineers didn’t need to set up anything—they just had to pull the Docker image and run the container.
  3. Scalability: If we needed to deploy multiple instances for different teams, Docker made it easy.

How I Did It: Dockerizing the App

Here’s how I Dockerized the Router Configuration Generator.

Step 1: Writing the Dockerfile

The Dockerfile is the heart of the containerization process. Here’s what mine looked like:

# Use a lightweight Python image as the base
FROM python:3.8-slim

# Set the working directory
WORKDIR /app

# Copy application files into the container
COPY . .

# Install Python dependencies
RUN pip install -r requirements.txt

# Expose the port used by the app
EXPOSE 8501

# Command to run the app
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]

This file tells Docker to:

  1. Use Python 3.8 as the base image.
  2. Set up a working directory for the app.
  3. Copy the app files and install dependencies (like Streamlit and Jinja2).
  4. Expose the port Streamlit uses (8501).
  5. Run the app when the container starts.

Step 2: Building the Docker Image

I built the Docker image with the following command:

docker build -t router-config-app .

This created an image named router-config-app.

Step 3: Running the Container

To test the app locally, I ran:

docker run -p 8501:8501 router-config-app

The app was live http://192.168.2.20:8501, ready to generate configurations.


Sharing the App: Docker Hub

I wanted to make the app accessible to anyone on the team, so I pushed it to Docker Hub. Here’s how:

  1. Log In to Docker Hub: docker login
  2. Tag the Image: docker tag router-config-app <your-username>/router-config-app:latest
  3. Push the Image: docker push <your-username>/router-config-app:latest

Now, anyone could pull the image with:

docker pull <your-username>/router-config-app:latest

And run it with:

docker run -p 8501:8501 <your-username>/router-config-app:latest

You can check out this app at DockerHub

The Impact

Since Dockerizing the app, it’s been a game-changer for our team. Field engineers no longer have to worry about learning CLI commands for multiple brands—they just input their parameters, generate the script, and get to work. Plus, the portability of Docker means the app can be used anywhere, from laptops in the field to servers in the office.


Closing Thoughts

Building this app and Dockerizing it was one of the most rewarding projects I’ve worked on. It solved a real problem, empowered my team, and taught me valuable skills. More importantly, it showed me how accessible app development and containerization can be.

If you’ve been thinking about creating your own app or exploring Docker, my advice is simple: Just start. Begin with a small idea, keep it simple, and enjoy the process.

What would you build if you had a tool like Docker at your fingertips? Let me know—I’d love to hear your ideas!

Interested In AI Instead? Read about Harnessing The Power of Fabric AI in 2024

Related Articles

It’s 2024: Do We Still Need to Run Virtual Machines (VMs) Today?

It’s 2024: Do We Still Need to Run Virtual Machines (VMs) Today?

Virtual Machines (VMs) remain crucial in 2024 due to their role in supporting legacy applications, ensuring robust security, and providing consistent development environments. Despite the rise of containerization, advancements in VM technology have improved their performance, security, and manageability. VMs and containers will coexist, each serving distinct purposes based on application needs.

IPSec VPN between Cisco and FortiGate

IPSec VPN between Cisco and FortiGate

Introduction Virtual Private Networks (VPNs) are an essential part of modern network infrastructure. This guide focuses on how to set up an IPSec VPN between Cisco and Fortigate devices, specifically the Cisco C1000 Router Series and a Fortigate Firewall. This...

Stay Up to Date With The Latest News & Updates