Internet access is so easy that every level of society can access information from the website. If internet access is used positively, it will produce positive things for its users as well. Such as the facilities provided by the management of SMK Al-Mahrusiyah Lirboyo. Students, especially in the Computer and Network Engineering (TKJ) department, get facilities such as PCs in the lab or laptops along with internet access during productive learning hours. In its application in schools, students who are given laptop facilities and internet access do not always use it for learning. Questionnaire data showed that there were other things that were opened, including 37.7% of respondents finding and trying hacking tutorials, 35.8% playing social media, and 34% streaming movies. For this reason, a firewall is needed that restricts students' access to it. The firewall will be formulated with a script on the MikroTik router through the WinBox. The results of firewall tests using a combination of filters and Raw successfully blocked access to social media websites, streaming movies, and anime. The client cannot access and the display in the client browser displays continuous loading. Testing firewalls to ward off DoS attacks was also successful. When tested, LOIC did not send a single request packet and when the CPU resource was checked, the resource was only 1%. The use of firewalls with MikroTik routers is effective in limiting students' access to other things outside of learning. With this, it is hoped that students can better utilize facilities for learning.