The Question :
|
|
The Accepted answer by Martin Xie - MSFT
Hi mjwsoft,
I agree with spotty. C++ may be more suitable for programming Firewall.
If you wish to do it in VB.NET, you need to P/Invoke Packet Filtering API.
The Firewall service usually is based on packet filtering technology.
Here are some references.
1. Simple Packet - Filter Firewall
Working of firewall is based on the following steps:
- Extract the packet header
- Check the protocol associated
- Compare with the rules
- Check the source and destination add. If protocol is same
- Check out the port if protocol is TCP
- Drop or pass the packet
2. Packet Filtering API on MSDN
http://msdn2.microsoft.com/en-us/library/Aa376636.aspx
Packet Filtering API allow us to associate filters to IP adapter interfaces. We can implement a functionality similar that included in TCP/IP filter options in TCP/IP properties of a network adapter.
Class library to implement packet filtering funcionality in your .NET applications
4. In addition, here is a Firewall SDK which helps deveopers create and manage a firewall control easily.
The Gtfctrl.dll wraps all the firewall operations in one "Firewall Panel", it can be used in VB.Net , C#.Net.
http://www.xanv.com/firewall-sdk.html
5. You also can find some ideas in this thread.
How to build a firewall like AVG Firewall in c#
Best regards,
Martin