这是我的简单代码:
import netmiko
connection = netmiko.ConnectHandler(
ip = "192.168.122.100",
device_type = "cisco_ios",
username="dule",
password = "cisco"
)
output = connection.send_command("sh ip inter br")
connection.send_command("conf t")
conf_command = ['int loop 0', 'ip address 1.1.1.1 255.255.255.255']
output = connection.send_config_set(conf_command)
print(output)
connection.disconnect()