如何在设备类(PYEZ)中配置本地IP地址?
它如何在Linux上运行:
ssh host_name_or_IP -b local_IP
应用程序不考虑BindAddress(在。〜/ .ssh / config文件中)。 如何在Pyez中的SSH上更改源地址? ssh描述说:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind('addr',port)
如何在我的代码中实现它?
dev = Device(host='10.10.0.100', user=username, passwd=password)
or Device(host='10.10.0.100', ssh_config=ssh_config_file )
默认的SSH(位于〜/ .ssh / config)和路由器配置:我已经调整过了。
我的日志文件中没有任何错误消息。 但是我必须中止SSH连接,然后收到以下消息:
> with Device(host='10.10.0.100', user=username, passwd=password ) as dev:
> File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/device.py", line 1343, in __enter__
> self.open()
> File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/device.py", line 1261, in open
> self.__class__.ON_JUNOS})
> File "/usr/local/lib/python2.7/dist-packages/ncclient/manager.py", line 163, in connect
> return connect_ssh(*args, **kwds)
> File "/usr/local/lib/python2.7/dist-packages/ncclient/manager.py", line 128, in connect_ssh
> session.connect(*args, **kwds)
> File "/usr/local/lib/python2.7/dist-packages/ncclient/transport/ssh.py", line 378, in connect
> sock.connect(sa)
> File "/usr/lib/python2.7/socket.py", line 228, in meth
> return getattr(self._sock,name)(*args)
我的错误处理:
except ConnectError as err:
print ("Cannot connect to device: {0}".format(err))
sys.exit(1)
except Exception as err:
print (err)
sys.exit(1)
Python 2.7 Y仪 路由器:Juniper SRX 300
有人可以帮我吗? 预先感谢!