I am trying to connect into a cisco device using netmiko, but I am facing the error bellow: I tried to change my code but didnt work at all.
from netmiko import ConnectHandler
cisco ={
'device_type': 'cisco_ios',
'ip': ' 192.168.1.1',
'username': 'cisco',
'password': 'cisco',
}
net_connect = ConnectHandler(**cisco)
output = net_connect.send_command('show ip inter brief')
print(output)
Traceback (most recent call last): File "/home/rdc/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 782, in establish_connection self.remote_conn_pre.connect(**ssh_connect_params) File "/home/rdc/.local/lib/python3.6/site-packages/paramiko/client.py", line 334, in connect to_try = list(self._families_and_addresses(hostname, port)) File "/home/rdc/.local/lib/python3.6/site-packages/paramiko/client.py", line 204, in _families_and_addresses hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/rdc/Documents/connection.py", line 10, in net_connect = ConnectHandler(**cisco) File "/home/rdc/.local/lib/python3.6/site-packages/netmiko/ssh_dispatcher.py", line 218, in ConnectHandler return ConnectionClass(*args, **kwargs) File "/home/rdc/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 270, in init self.establish_connection() File "/home/rdc/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 787, in establish_connection raise NetMikoTimeoutException(msg) netmiko.ssh_exception.NetMikoTimeoutException: Connection to device timed-out: cisco_ios 192.168.1.1:22
>