<?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: Finding interfaces with empty networks in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Finding-interfaces-with-empty-networks/m-p/48912#M3214</link>
    <description>Nice to see you over here Zimmie &lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;</description>
    <pubDate>Wed, 27 Mar 2019 23:53:15 GMT</pubDate>
    <dc:creator>PhoneBoy</dc:creator>
    <dc:date>2019-03-27T23:53:15Z</dc:date>
    <item>
      <title>Finding interfaces with empty networks</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Finding-interfaces-with-empty-networks/m-p/48655#M3202</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I recently had the need&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;to find all of the interfaces on one of my VSX clusters which aren't&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;used, so I can delete them and reclaim some networks and VLANs. I banged together&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;this little script to get that information for me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If there are VSs, it goes through them one by one. In each VS (or in the default routing table if&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;there are not VSs), it then goes through the interfaces one by one,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;finds their IP address, skips them if they don't have one, or does a&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;ping/ARP sweep if they do.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The Linux network kernel has an infuriating limitation—there's no way&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;to actually delete an ARP entry short of disabling ARP on the whole&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;interface. The scan works by trying to resolve a bunch of IPs via ARP&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;and checking if they respond. This can fill up the ARP cache if you go&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;too quickly, which can prevent new real entries from being added. To&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;work around this, I have to sleep for five minutes between interface&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;scans. This lets the garbage collector catch up with all the junk&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;entries I add, but it makes the scan&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;v&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;r&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;y&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;s&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;l&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;o&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;w.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If Check Point eventually moves to a real OS, the '&lt;FONT face="terminal,monaco"&gt;sleep 300s&lt;/FONT&gt;' can be removed and &lt;FONT face="terminal,monaco"&gt;scanNetwork&lt;/FONT&gt; &amp;gt;&amp;nbsp;&lt;FONT face="terminal,monaco"&gt;for scanAddress&lt;/FONT&gt; &amp;gt;&amp;nbsp;&lt;FONT face="terminal,monaco"&gt;if [ $(arp -n $scanAddress&lt;/FONT&gt; can be modified to add '&lt;FONT face="terminal,monaco"&gt;else; arp -d $scanAddress&lt;/FONT&gt;' to immediately purge incomplete entries.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It outputs one line per interface. The line will either be in the form&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;FONT face="terminal,monaco"&gt;eth0 has no IP address. Skipping.&lt;/FONT&gt;", or in the form "&lt;FONT face="terminal,monaco"&gt;29 items in eth0 10.20.30.40/24&lt;/FONT&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;. If it's on VSX, the line will include the VSID.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The recommended way to run it is like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="terminal,monaco"&gt;&lt;SPAN&gt;nohup ./scanInts.sh &amp;amp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That will write the output to nohup.out in the current directory, or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;~/nohup.out if the user can't create files in the current directory.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have tested this on VSX R67 and on an R77.30 system. It hasn't&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;caused any observed issues on any of my systems. Still, be careful if&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;you use it. It could definitely still overflow the ARP cache.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It will require minor modification to work on 3.10 kernel systems, as they use network namespaces rather than VRFs. The test for whether it's VSX or not would have to be something like '&lt;FONT face="terminal,monaco"&gt;if [ $(ip netns list | wc -l) -gt 1 ]&lt;/FONT&gt;', and the VSID would be '&lt;FONT face="terminal,monaco"&gt;cat /proc/self/nsid&lt;/FONT&gt;' rather than '&lt;FONT face="terminal,monaco"&gt;cat /proc/self/vrf&lt;/FONT&gt;'.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 13:02:22 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Finding-interfaces-with-empty-networks/m-p/48655#M3202</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2019-03-26T13:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Finding interfaces with empty networks</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Finding-interfaces-with-empty-networks/m-p/48912#M3214</link>
      <description>Nice to see you over here Zimmie &lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;</description>
      <pubDate>Wed, 27 Mar 2019 23:53:15 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Finding-interfaces-with-empty-networks/m-p/48912#M3214</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-03-27T23:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Finding interfaces with empty networks</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Finding-interfaces-with-empty-networks/m-p/48917#M3216</link>
      <description>&lt;P&gt;A friend recommended I share the code here, and I thought it was about time for me to make a personal account. Probably won’t post a huge amount of stuff, but any time I write more than a few lines of code to solve a problem, I’ll probably post it.&lt;/P&gt;&lt;P&gt;Should be fun!&lt;/P&gt;&lt;P&gt;Kind of tempted to set this stuff up as a public repo on Github or something just for change tracking purposes.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 00:27:19 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Finding-interfaces-with-empty-networks/m-p/48917#M3216</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2019-03-28T00:27:19Z</dc:date>
    </item>
  </channel>
</rss>

