Here is a suggested README.md
for your GitHub repository that explains how to use the Python-based network management project:
This project provides a Python-based automation tool for managing network devices such as switches and routers using SSH. It allows you to automate common network configuration tasks like configuring HSRP, DHCP, VLANs, RIP, and STP, as well as basic device security and connectivity testing.
- HSRP Configuration on routers
- VLAN and STP Setup on switches
- DHCP Pool Configuration on routers
- RIP Routing Protocol setup
- Port Security configuration on switches
- Ping Connectivity Testing to verify network reachability
- Singleton-based configuration management to ensure a consistent configuration load from
NetworkDetails.json
NetworkDetails.json
: This file contains a list of network devices (routers, switches) and their respective login credentials and IP addresses.GetDetails.py
: Provides theConfig_Manager
class for loading network device details fromNetworkDetails.json
.Connection.py
: Contains theNetworkSession
class to manage SSH connections to network devices.Device.py
: Provides theDevice
class for abstracting common device operations such as HSRP and connectivity testing.Router.py
: ExtendsDevice
class to support router-specific operations like DHCP and RIP configuration.Switch.py
: ExtendsDevice
class to support switch-specific operations like VLAN, STP, and port security configuration.Main.py
: Entry point to run the network management tool.Menu.py
: Contains the menu-driven interface for interacting with the tool.
-
Install Python 3.x
-
Install the required Python libraries:
pip install paramiko
-
Make sure you have access to the devices you want to configure via SSH.
This file contains the details of network devices including switches and routers. Here is an example of how it's structured:
[
{
"type": "router",
"name": "R1",
"ip": "192.168.1.1",
"username": "admin",
"password": "cisco",
"privileged_password": "class"
},
{
"type": "normal_sw",
"name": "Switch1",
"ip": "192.168.1.251",
"username": "admin",
"password": "cisco",
"privileged_password": "class"
}
]
Each device entry includes:
type
: Indicates whether the device is arouter
,normal_sw
(normal switch), ormultilayer_sw
.name
: The name identifier of the device.ip
: The IP address of the device.username
: The login username for SSH access.password
: The login password for SSH access.privileged_password
: The password to enter privileged (enable) mode.
-
Clone the repository to your local machine:
git clone https://github.com/yourusername/network-management-tool.git
-
Modify the
NetworkDetails.json
file with your actual network device details. -
Run the main script:
python Main.py
This will launch a menu-driven interface to interact with network devices.
To configure HSRP on a router:
- Select the router from the menu.
- Provide the necessary interface, standby ID, virtual router IP, and priority.
- HSRP will be configured with the provided values.
To configure VLAN on a switch:
- Select the switch from the menu.
- Provide the VLAN ID and name.
- VLAN will be created with the specified details.
To configure a DHCP pool on a router:
- Select the router from the menu.
- Provide the LAN ID, network, and subnet mask.
- DHCP will be configured and specific IP ranges will be excluded.
To configure RIP on a router:
- Select the router from the menu.
- Enter multiple networks to add to RIP.
- Optionally enable static route redistribution.
To test network connectivity:
- Select a device and provide the IP to ping.
- The script will attempt to ping the target IP and provide results.
To add new devices to the tool, simply update the NetworkDetails.json
file with the new device's information.