Generally, cellular networks are divided into discrete geographic zones where a secure routing protocol is important. In this study, Sailfish-based Distributed IP Mobility Management (SbDMM) architecture for security protocol in a smart home using 5G is suggested. Smart homes first gathered data via IoT devices which are then communicated with the use of a Home Gateway (HGW). Mobile Nodes (MN) and Corresponding Nodes (CN) process data communication (CN). In addition, the acquired data are encrypted and secured using the session key. Additionally, use an authenticated key and a cipher key to secure the routing optimization. As a result, the fitness of sailfish is updated in a protocol path that is optimized for securing data from attackers. The designed framework is then implemented in Python and the obtained results are compared to those of other methodologies in terms of execution time, confidentiality rate, efficiency, delay, and task completion.