<?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: Adding VS name to wrp links in routing table (netstat) in Firewall and Security Management</title>
    <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-VS-name-to-wrp-links-in-routing-table-netstat/m-p/82335#M9274</link>
    <description>Nice one &lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;</description>
    <pubDate>Sat, 18 Apr 2020 21:21:46 GMT</pubDate>
    <dc:creator>PhoneBoy</dc:creator>
    <dc:date>2020-04-18T21:21:46Z</dc:date>
    <item>
      <title>Adding VS name to wrp links in routing table (netstat)</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-VS-name-to-wrp-links-in-routing-table-netstat/m-p/82084#M9273</link>
      <description>&lt;P&gt;Not too sure if there were better means to see your next hop actual name rather than just &lt;STRONG&gt;wrpXXX&lt;/STRONG&gt; or &lt;STRONG&gt;wrpjXXX,&amp;nbsp;&lt;/STRONG&gt;especially if you have large routing tables in VSX&lt;/P&gt;
&lt;P&gt;So I wrote a small script that adds VS name to &lt;STRONG&gt;netstat -nr&lt;/STRONG&gt; output&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/5637i64BF8870A1D84BA3/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Probably the easiest is to place it in one of predefined paths i.e. &lt;STRONG&gt;/usr/bin&lt;/STRONG&gt;. I called it &lt;STRONG&gt;vnetstat&lt;/STRONG&gt; for simplicity and so I can remember&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;#!/bin/bash
hn=`hostname`
oldIFS=$IFS
IFS=''
netstat -nr | while read line; do
  vsname=""
  name=`echo "$line" |awk '{print $8}'`
  if [ `echo "$name" | grep -c wrp` -gt 0 ]; then
        if [ `echo "$name" | grep -c wrpj` -gt 0 ]; then
           name=`echo "$name" | sed 's/wrpj/wrp/g'`
        else
           name=`echo "$name" | sed 's/wrp/wrpj/g'`
        fi
        instance=`grep $name /config/active | grep ^interface |awk '/instance/{print "instance:"$2":name"}'`
        vsname=`grep "$instance" /config/active  | sed "s/${hn}_//" | awk '{print $2}'`
  fi

  echo -e -n $line
  echo -e " \t$vsname"
done
IFS=$oldIFS
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;tested it with R80.30 both 2.6 and 3.10 kernels as well as R76SP50 - seems to work&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 09:20:49 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-VS-name-to-wrp-links-in-routing-table-netstat/m-p/82084#M9273</guid>
      <dc:creator>Kaspars_Zibarts</dc:creator>
      <dc:date>2021-02-19T09:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Adding VS name to wrp links in routing table (netstat)</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-VS-name-to-wrp-links-in-routing-table-netstat/m-p/82335#M9274</link>
      <description>Nice one &lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;</description>
      <pubDate>Sat, 18 Apr 2020 21:21:46 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-VS-name-to-wrp-links-in-routing-table-netstat/m-p/82335#M9274</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-04-18T21:21:46Z</dc:date>
    </item>
  </channel>
</rss>

