NPS 'Network Policy' Client IPv4 Address value as regex

Phillip From OZ 21 Reputation points
2023-01-05T04:06:29.67+00:00

Hi,
In NPS 'Network Policy' there is a 'Client IPv4 Address' where you can specify one or many addresses.

If you specify more than one address then I you specify a regex.

In the examples I see on this forum or even on the Microsoft site I see examples like:
10.127.4..+

The last 2 characters .+ means 'one or more characters' of anything [alpha numeric commas...]

As it is an IP address (numeric) why should this not be:
10.127.4.[0-9]+
or
10.127.4.\d+

Would these patterns work?

Windows for business | Windows Server | Devices and deployment | Set up, install, or upgrade
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. T. Kujala 8,766 Reputation points
    2023-01-05T05:19:15.927+00:00

    Hi @Phillip From OZ ,

    I would use 10.127.4..+

    This specify a range of IP addresses that begin with 10.127.4.1.

    D Matches a nondigit character (equivalent to [^0-9]).

    You could check the following pattern-matchings.

    https://learn.microsoft.com/en-us/windows-server/networking/technologies/nps/nps-crp-reg-expressions#pattern-matching-reference

    0 comments No comments

  2. Limitless Technology 44,766 Reputation points
    2023-01-05T15:29:07.067+00:00

    Hi,

    Thank you for posting your query.

    Kindly follow the steps provided below to resolve your issue.

    This topic explains the use of regular expressions for pattern matching in NPS in Windows Server. You can use this syntax to specify the conditions of network policy attributes and RADIUS realms.

    Go to this link for your reference and other troubleshooting procedures https://learn.microsoft.com/en-us/windows-server/networking/technologies/nps/nps-crp-reg-expressions

    https://learn.microsoft.com/answers/questions/463966/nps-network-policy-define-access-client-ipv4-addre.html

    Do not hesitate to message us if you need further assistance.

    If the answer is helpful kindly click "Accept as Answer" and up vote it.

    0 comments No comments

  3. Phillip From OZ 21 Reputation points
    2023-01-07T03:21:15.47+00:00

    Thanks to all for your feedback.
    Based on my understanding of regular expressions (regex)
    and confirmed by this "https://learn.microsoft.com/en-us/windows-server/networking/technologies/nps/nps-crp-reg-expressions#pattern-matching-reference"

    \d is a digit 0-9
    So \d+ means one or more digits 0-9

    So I think my pattern is more specific to a IP address.

    You can check this with the online regex checkers

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.