How to block traffic to specific port from specific IP addresses?

  • I figured out how to block from specific IP addresses to all ports but not how to block traffic to a specific PORT from specific IP addresses? Any clues?


  • LAYER 8 Global Moderator

    You put the dest port in the rule that you have the source IP in.. This has to be some sort of joke?

  • No, its not a joke or I would not have taken the time to ask it. I guess its super clear to you but I don't see anything in the rule creation screen that lets you specify a PORT...I do see the places that let you set an IP. Even the help screen below makes no mention of the word "PORT":

    "When entering addresses into firewall rules, the following choices are given for the source and destination addresses. Some of these options only appear in specific fields or circumstances, or if certain features are enabled.

    any - to, or all IPv6 addresses
    Single host or alias - Select this and enter one IP address (, aa:bb:cc:dd::1) or type the name of an Alias that has already been configured (Firewall > Aliases)
    Network - Select this and enter a network and mask (, aa:bb:cc:dd::0/64)
    LAN net - The subnet configured on the LAN interface under Interfaces > LAN. On pfSense 2.2+, this also includes IP alias networks on that interface.
    LAN address - The IP address configured on the LAN interface under Interfaces > LAN
    zzz Net / zzz address - Works the same as LAN above but for other interfaces (WAN, OPT1, OPT2, etc.)
    WAN net - Please note this is not the internet, this is just the network wan is connected to, just like lan, or opt net aliases above. If your ISP puts you on a x.x.x/21 network, or a /29 or a /24 that is the network this refers too.. Not the whole internet.
    PPTP clients - Automatically locate and use the addresses of PPTP clients
    L2TP clients - Automatically locate and use the addresses of L2TP clients
    This Firewall (self) - Any IP address assigned to any interface on this firewall (pfSense 2.2+)"

  • Never mind, I found it. When you change "protocol" from "Any" to "TCP/UDP", the port field appears.

  • LAYER 8 Global Moderator

    Yeah any is what is means ANY... So no you wouldn't be able to set a Port.. To set a port you would need to specify a protocol that uses a port.

    Glad you got it sorted.

Log in to reply