Scalable resilience for Software-Defined Networking using Loop-Free Alternates with loop detection In this paper we propose a novel resilience scheme for OpenFlow-based Software-Defined Networking(SDN). To forward packets in line speed, OpenFlow switches store their flow tables in expensive, limited TCAM due to which the stored tables cannot be large. Most resilience mechanisms require additional entries thus the implementation in OpenFlow may quickly exceed the available TCAM. Loop-Free Alternates (LFAs) are a standardized mechanism for fast reroute in IP networks which do not require additional entries. However, LFAs cannot protect against all single link and node failures. Moreover, some LFAs even cause loops in case of some node failures or multiple failures, making additional links unusable. Excluding such LFAs reduces the fraction of protected destinations (protection coverage) in nodes even further. We suggest a scheme for detection of loops caused by LFAs. It maximizes the protection coverage because it allows all LFAs to be used without creating loops. We describe how LFAs and the loop detection scheme can be implemented in OpenFlownetworks with only little packet overhead and a single additional entry per switch. We evaluate our proposal on real network topologies of varying size and connectivity. In particular, we quantify the benefit gained from loop detection. Amongst others, we study the percentage of failures that cannot be protected by LFAs at all, and the percentage of failures in which conventional LFAs cause extra loops.