In the IoT, gateways are used as relay points so that resources deployed in an environment can communicate with each other. As the number communication paths connected to one gateway increases, the number of paths interrupted by a gateway failure increases. In an environment where real-time communication is required, the loss of data due to a gateway failure is unacceptable. Therefore, a method to determine the routing topology with fewer paths that are interrupted by a gateway failure is needed. In this paper, we propose a method to generate a fault-tolerant routing topology by a genetic algorithm. Our experimental results show that the proposed method can generate a topology where communication routes are not concentrated on one gateway in a realistic time.