<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: IP Address match to CIDR range in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/IP-Address-match-to-CIDR-range/m-p/2368301#M131585</link>
    <description>Thanks, looks like an elegant solution instead of expanding out the subnets</description>
    <pubDate>Fri, 07 Aug 2015 14:06:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-08-07T14:06:46Z</dc:date>
    <item>
      <title>IP Address match to CIDR range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/IP-Address-match-to-CIDR-range/m-p/2368299#M131583</link>
      <description>Using Talend 6 Open data integration. Is it possible to compare an IP address from an apache log to a number of CIDR ranges and pick the correct range or do I need to expand out the CIDR range and have a much larger lookup ? 
&lt;BR /&gt;If you imagine my lookup table would be structured something like the simple csv example below. If the IP address was 192.168.100.30 I get the networkname "Blue"&amp;nbsp; 
&lt;BR /&gt; 
&lt;PRE&gt;CIDR,NetworkName&lt;BR /&gt;192.168.0.0/24, Orange&lt;BR /&gt;192.168.100.0/24,Blue&lt;BR /&gt;&lt;/PRE&gt; 
&lt;BR /&gt;Would I need to expand the CIDR value to include all the IP addresses and do a simple string comparison or is there a smarter way with Talend?</description>
      <pubDate>Thu, 06 Aug 2015 15:54:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/IP-Address-match-to-CIDR-range/m-p/2368299#M131583</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-06T15:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: IP Address match to CIDR range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/IP-Address-match-to-CIDR-range/m-p/2368300#M131584</link>
      <description>I think the best way to do this is to use the Apache Commons Net library ( 
&lt;A href="https://commons.apache.org/proper/commons-net/" rel="nofollow noopener noreferrer"&gt;https://commons.apache.org/proper/commons-net/&lt;/A&gt;). Use a tJavaRow to use something similar to the following code.... 
&lt;BR /&gt; 
&lt;PRE&gt;String cidr = input_row.cidr;&lt;BR /&gt;String ip = input_row.ip;&lt;BR /&gt;SubnetUtils su = new SubnetUtils(cidr);&lt;BR /&gt;SubnetUtils.SubnetInfo info = su.getInfo();&lt;BR /&gt;output_row.ip = ip;&lt;BR /&gt;output_row.pass = info.isInRange(ip);&lt;BR /&gt;output_row.cidr = cidr;&lt;BR /&gt;&lt;/PRE&gt; 
&lt;BR /&gt;The "cidr" and "ip" columns are String columns holding the cidr code and ip address to be compared. The "pass" column is a boolean used to return whether the ip is in the cidr range.</description>
      <pubDate>Thu, 06 Aug 2015 16:56:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/IP-Address-match-to-CIDR-range/m-p/2368300#M131584</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-06T16:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: IP Address match to CIDR range</title>
      <link>https://community.qlik.com/t5/Talend-Studio/IP-Address-match-to-CIDR-range/m-p/2368301#M131585</link>
      <description>Thanks, looks like an elegant solution instead of expanding out the subnets</description>
      <pubDate>Fri, 07 Aug 2015 14:06:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/IP-Address-match-to-CIDR-range/m-p/2368301#M131585</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-07T14:06:46Z</dc:date>
    </item>
  </channel>
</rss>

