Objectives: To achieve a reliable IoT environment by mitigating the DoS attack. Methods: The study focuses on building a firewall on an Open Flow-based Software Defined Networking (SDN) controller to secure a network. We chose the POX controller, which is based on the Python programming language, from among various controllers. Furthermore, a detailed analysis of denial of service attacks against IoT devices has been carried out using Wireshark. Findings: SDN design allows networks to actively monitor traffic and diagnose threats, making network management easier. DoS & DDoS attack is simulated for IoT application which resulted in the loss of packets. Novelty: When compared to the traditional firewall where the internal traffic cannot be seen and filtered, SDN based firewall can filter the packet based on the policy defined. Here the experiment is carried out using open-source software.SDN security was built into the architecture to ensure the availability, integrity, and privacy of all connected resources and information. SDN-based Firewall is used as a solution against the denial of service attack. Through simulation, we have found and analyzed an efficient unsupervised method for detecting DDoS. Keywords: Network Attack; Smart Devices; Security; Firewall; Software Defined Network