I have a lookup table with 2 fields IP and Name
IP Name
['1.2.3.4', '2.3.5.0/24'] -> name1
['1.2.3.4',.6.7.8.9/31, 4.5.6.7,1.1.1.1] -> name2
[3.3.3.3/31, 4.4.4.4] -> name3
I have a list of IPs like "1.2.3.4, 2.3.5.1"
This should give me result of lookup table names where the IPs are present.
So in the above example result would be as the "1.2.3.4, 2.3.5.1" are present in first 2 rows.
name1
name2
Unless the lookup is defined with the CIDR, WILDCARD, or case-insensitive option, it will do exact string matching. Even with those options, there is no way to get "1.2.3.4" to match "['1.2.3.4', '2.3.5.0/24']". The multiple IP addresses in each line should be put on separate lines.
IP | Name |
1.2.3.4 | name1 |
2.3.5.0/24 | name1 |
1.2.3.4 | name2 |
6.7.8.9/31 | name2 |
4.5.6.7 | name2 |
1.1.1.1 | name2 |
3.3.3.3/31 | name3 |
4.4.4.4 | name3 |
Note that the IP field is ambiguous because both name1 and name2 share an IP address. The lookup command will return only the first matching IP.
How should I format the lookup definition so that it takes both CIDR match and indivisual IP match
What I mean to say is if I go to advance settings and change the match criteria to CIDR(IP) its not matching the elements where the IP is single IP and not a CIDR
I think you have to make all IP values CIDR (1.2.3.4/32, for example).