iptables on Windows10

I'm looking for a way to get iptables functionality in windows 10. I enabled IP routing and I need to forward tcp data to another host (port 4000) and then forward his response while masquerading IP. In linux I was able to do this using the following:

iptables -A INPUT -p tcp --dport 4000 -m string --hex-string '|FF01|' --algo bm -j DROP
iptables -A INPUT -p tcp --dport 4000 -m string --hex-string '|1400|' --algo bm -j REJECT

Thanks guys!

4

2 Answers

The Windows Filtering Platform, upon which the Windows Firewall is built, does not (directly) support inspecting packet contents. As such, implementing this particular condition (-m string --hex-string '|FF01|') is not possible.

To achieve this functionality, a so-called “Windows Filtering Platform Callout Driver” is necessary. As the name implies, these are a kernel-mode drivers. They can perform deep inspection of packet data and set actions like blocking a packet.

On 64-bit Windows, kernel drivers need to be code-signed.

You may also be able to achieve the same using a third-party firewall solution.

The simplest solution is to not use Windows though.

Windows Firewall has a similar style of rules to block certain IPs from entering on a port.

  1. Open Windows Defender Firewall with Advanced Security. It should appear if you search Windows Firewall in the Start menu
  2. From the left pane, select inbound rules
  3. From the right pane, select New Rule
  4. Rule Type: Choose Custom
  5. Program: Choose All Programs
  6. Protocol and Ports: Protocol Type is TCP, Local Port is Specific Port 4000. Remote port is unset.
  7. Scope: Enter the IPs and Ranges you want to block. Note that LAN IPs go in the upper box. WAN IPs go in the lower box
  8. Action: Block the connection
  9. Profile: Select all options
  10. Name: Set per your preferences. This has no effect on the rule.
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like