Configuring Loopback Interface Using SSH
Configuring Loopback Interface Using SSH
In this lab, we will be using the library Netmiko, developed by Kirk Byers which is an open-source multivendor library
that is used for SSH connections to network devices. Multi-vendor library means Netmiko supports network devices
from different vendors such as Cisco, Juniper, HP, etc.
- Go to your eve-ng and add a vIOS Router, connect the router with Cloud 1 to establish the connectivity between
the router and the Windows machine.
- Boot the router and provide IP to the management interface using DHCP.
enable
configure terminal
interface gig 0/0
ip address dhcp
no shutdown
exit
ip domain-name abc.com
cryptokey generate rsa general-keys modulus 1024
ip ssh ver 2
username admin privilege 15 password cisco
line vty 0 4
login local
transport input all
exit
- Verify the reachability by pinging the IP address of router from local device.
- Go to the terminal of your device using VS code or using cmd and run the following command to begin the
installation of the library Netmiko:
Step 3: Time to begin the script for creating the loopback interface on Router.
- Create a dictionary for your device defining required parameters, here the device is Cisco virtual IOS.
- Call the ConnectHandler module to connect with the router. (** before the dictionary name is used to tell the
python to consider the content of the dictionary as key-value pairs instead of single elements.)
- Create a list that includes all the commands that we need to execute in the Global Configuration mode and call
them using send_config_set() to execute them on router.
- Send “show ip interface brief” to the router for verification. For sending commands into the Privileged mode we
use send_command().