<p>There is previous little on the google on this subject other than people asking this very same question.</p>

<p>How would I get started writing my own firewall?</p>

<p>I'm looking to write one for the windows platform but I would also be interested in this information for other operating systems too.
­­­­­­­­­­­­­­­­­­</p>

[{'answer_id': 18396, 'author': 'Michał Piaskowski', 'author_id': 1534, 'author_profile': 'https://Stackoverflow.com/users/1534', 'pm_score': 4, 'selected': True, 'text': '<p>For Windows 2000/XP there is an article with examples on CodeProject <a href="http://www.codeproject.com/KB/IP/drvfltip.aspx" rel="noreferrer">Developing Firewalls for Windows 2000/XP</a><br><br>For Vista I think you will need to use <a href="http://www.microsoft.com/whdc/device/network/wfp.mspx" rel="noreferrer">Windows Filtering Platform</a></p>\n'}, {'answer_id': 18398, 'author': 'wvdschel', 'author_id': 2018, 'author_profile': 'https://Stackoverflow.com/users/2018', 'pm_score': 2, 'selected': False, 'text': "<p>The usual approach is to use API hooking. Google can teach you that. Just hook all important networking stuff, like <code>connect</code>'s and <code>listens</code>'s, and refuse what you want.</p>\n"}, {'answer_id': 312142, 'author': 'Adam Liss', 'author_id': 29157, 'author_profile': 'https://Stackoverflow.com/users/29157', 'pm_score': 3, 'selected': False, 'text': "<p>This question is alarmingly similar to those asking how to write an encryption algorithm.  The answers to both should end in gentle reminders about industry standard solutions that already:</p>\n\n<ul>\n<li>embody years of experience and constant improvement,</li>\n<li>are probably far more secure than any home-grown solution, and</li>\n<li>account for ancillary requirements, such as efficiency.</li>\n</ul>\n\n<p>A firewall must inspect <em>every</em> packet efficiently and accurately, and it therefore runs within the OS kernel or network stacks.  Errors or inefficiencies jeopardize the security and performance of the entire machine and those downstream.</p>\n\n<p>Building your own low-level firewall is an excellent exercise that will provide an education across many technologies.  But for any real application, it's much safer and smarter to build a shell around the existing firewall API.  Under Windows, the <code>netsh</code> command will do this; Linux uses <code>netfilter</code> and <code>iptables</code>.  Googling any of these will point you to lots of theory, examples, and other helpful information.</p>\n\n<p><strong>So, to get started,</strong> I'd brush up on TCP/IP (specifically, the header information: ports and protocols), then learn about the various types of attacks and how to detect them.  Learn about each operating system of interest and how it interacts with the network stacks.  Finally, think about administration and logging: how will you configure your firewall and trace packets through it to ensure it's doing what you want it to do?</p>\n\n<p>Good luck!</p>\n"}]
['https://Stackoverflow.com/questions/18391', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/840/']