Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dell Port Security Configuration Tool

Overview

This Python script automates the configuration of port security on Dell network switches (specifically targeting models like the Dell N1548P). It connects to switches via SSH, takes configuration backups, detects port usage, and dynamically applies port security rules to enhance network security.

Features

  • Automated Configuration Backup: Automatically saves a backup of the running configuration locally before making any changes.
  • Intelligent PoE Detection: Identifies ports actively using or capable of Power over Ethernet (PoE).
  • Trunk Port Exclusion: Automatically detects and excludes trunk ports from port security configurations to prevent network topology disruptions.
  • Port Security with Sticky MACs:
    • Allows 2 MAC addresses on PoE ports.
    • Allows 1 MAC address on active non-PoE ports.
    • Uses mac-address sticky to remember connected devices and block unauthorized traffic without shutting down the port.
  • Unused Port Management: Identifies and automatically shuts down unused ports (administratively down or link down with no MAC entries).
  • Batch Processing: Can process multiple switch IP addresses sequentially.

Prerequisites

  • Python 3.6 or higher.
  • Network access to the switch(es) via SSH (port 22).
  • Switch credentials with enable mode access.

Installation

  1. Clone this repository:

    git clone https://github.com/mosly/DellSwi.git
    cd DellSwi
  2. Install the required dependencies:

    pip install -r requirements.txt

Usage

Run the script from your terminal:

python dell_port_security.py

The script will interactively prompt you for:

  1. Switch IP address(es): (e.g., 192.168.1.10 or 192.168.1.10, 192.168.1.11)
  2. SSH Username
  3. SSH Password

How it Works

Once authenticated, the tool will:

  1. Switch to enable mode (if required) and disable pagination.
  2. Backup the current running-config into a local switch_backups/ folder.
  3. Discover trunk ports, PoE ports, and unused ports.
  4. Apply dynamic port security rules based on the port's role.
  5. Shut down inactive/unused ports for security hygiene.
  6. Save the running configuration to the startup configuration.

Backups

Configuration backups are automatically saved in the switch_backups directory located in the same folder as the script. Files are named using the format: <ip_address>_<timestamp>_backup.txt.

Disclaimer

Always test automated network configuration scripts in a lab or staging environment before running them against production infrastructure.

License

MIT License

About

Shutdown unused ports for Dell Switches OS6

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages