CESNET / netopeer2

NETCONF toolset
BSD 3-Clause "New" or "Revised" License
291 stars 186 forks source link

Query: the netopeer2-server bind server failed with "Cannot assign requested address", how to get this event and recover #1493

Closed starx1000 closed 8 months ago

starx1000 commented 8 months ago

Hi, When I try to bring up netopeer2-server it reports

 "[ERR]: LN: Could not bind "192.168.0.1" port 830 (Cannot assign requested address)

I did have a look, and looks like at that time the IP address is not allocated, ( 1 second later the IP is allocated and available ).

But the netopeer2 will not retry to bind the IP address and I do not know the event and can not do anything for this use case.

So:

  1. Can I monitor this event (bind IP Address or port failed)?
  2. How to recover? import the "/ietf-netconf-server:netconf-server/listen/endpoint/ssh/tcp-server-parameters" again? but the same paraemters will not trigger the callback, right? So the only way to recover is to restart the netopeer2 server?
michalvasko commented 8 months ago

What you should do is use a service planner (systemd) and leverage its dependencies to make sure netopeer2 is not started before basic network setup resulting in problems such as yours.

starx1000 commented 8 months ago

Yes, but in cloud environment the IP address is to be allocated by others that I can not use dependencies. So currently we use retry to get this issue solved in other processes..

do we have some "ietf-netconf-server" event for this? as the data will not "done" as applied failed? ...

 Triggering "ietf-netconf-server" "done" event on enabled data

then we can have 2nd daemon to monitoring this event and do something.

otherwise we need to use netlink to check the Ipaddress existence before bring up netopeer2-server...

michalvasko commented 8 months ago

Yes, but in cloud environment the IP address is to be allocated by others that I can not use dependencies. So currently we use retry to get this issue solved in other processes..

I do not think that is a good design.

Is it possible netopeer2 retry after some seconds ( e.g 4 seconds )

No such functionality is supported.

otherwise we need to use netlink to check the Ipaddress existence before bring up netopeer2-server...

That seems like the most reasonable solution.

starx1000 commented 8 months ago

OK, thank you for your kindly reply and support. I have no more questions for this item.