Ethernet protocol is the most wide-spread protocol in the Local Area Network (LAN) environment. It is cost effective, simple, and provides high speeds, exactly what is needed in the provider network. However, deployment in the provider network imposes carrier-grade requirements. Standardization bodies realized this, and they are extending its capabilities: QoS support and traffic management by 802.1Q Virtual LANs (VLANs), traffic engineering by 802.1s Multiple Spanning Tree Protocol (MSTP), administration and management issues by 802.1ag Connectivity Fault Management (CFM). However, with carrier-grade extensions Ethernet started to lose an important property: simplicity. Often the topology of the Ethernet aggregation is simple, tree-like, so complex protocols like MSTP are not required even when resilience is supported by adding several links. In most cases the plain Rapid Spanning Tree Protocol (RSTP) can provide the necessary restoration and loop protection capability. However, the default settings of the RSTP protocol may not provide optimal network utilization, and it is difficult to predict its behavior after a failure. In this paper we present a tool for RSTP optimization, which engineers the network for best utilization while also ensures that optimal paths will be selected after a link failure. The result of the optimization is a port cost set for all bridge interfaces. The optimization is performed off-line using an Integer Linear Program (ILP). We show that compared to the default settings higher throughput can be achieved, while the required bandwidth is guaranteed in case of any link failure.