diff --git a/gns3server/modules/dynamips/nodes/router.py b/gns3server/modules/dynamips/nodes/router.py index d728d137..43c14a9e 100644 --- a/gns3server/modules/dynamips/nodes/router.py +++ b/gns3server/modules/dynamips/nodes/router.py @@ -1247,10 +1247,20 @@ class Router(BaseVM): raise DynamipsError("Port {port_number} does not exist in adapter {adapter}".format(adapter=adapter, port_number=port_number)) - yield from self._hypervisor.send('vm slot_add_nio_binding "{name}" {slot_number} {port_number} {nio}'.format(name=self._name, - slot_number=slot_number, - port_number=port_number, - nio=nio)) + try: + yield from self._hypervisor.send('vm slot_add_nio_binding "{name}" {slot_number} {port_number} {nio}'.format(name=self._name, + slot_number=slot_number, + port_number=port_number, + nio=nio)) + except DynamipsError: + # in case of error try to remove and add the nio binding + yield from self._hypervisor.send('vm slot_remove_nio_binding "{name}" {slot_number} {port_number}'.format(name=self._name, + slot_number=slot_number, + port_number=port_number)) + yield from self._hypervisor.send('vm slot_add_nio_binding "{name}" {slot_number} {port_number} {nio}'.format(name=self._name, + slot_number=slot_number, + port_number=port_number, + nio=nio)) log.info('Router "{name}" [{id}]: NIO {nio_name} bound to port {slot_number}/{port_number}'.format(name=self._name, id=self._id, diff --git a/gns3server/modules/port_manager.py b/gns3server/modules/port_manager.py index 79f2c7b6..0b5fab97 100644 --- a/gns3server/modules/port_manager.py +++ b/gns3server/modules/port_manager.py @@ -33,8 +33,9 @@ class PortManager: def __init__(self, host="127.0.0.1"): self._console_host = host - self._udp_host = host + # UDP host must be 0.0.0.0, reason: https://github.com/GNS3/gns3-server/issues/265 + self._udp_host = "0.0.0.0" self._used_tcp_ports = set() self._used_udp_ports = set()