In this article, we propose an algorithm for the management of the structure of the tunnel connections in large, distributed nature, corporate network. Management is here understood as monitoring the availability and health of key elements and dynamic reconfiguring the system in situations of failure symptoms. It was assumed that the algorithm can be used in cases where the correct functioning of the network (providing the appropriate level of quality of service) means an access to distributed resources, usually redundant, which may be subject to reallocation. It was shown that developed algorithm may be used for maintenance of VPN network with dynamic tunnels (DMVPN).