<?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 shell script to find ips in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647112#M102363</link>
    <description>Dear Sirs,&lt;BR /&gt;&lt;BR /&gt;I have server names list and want to find out ip address of the servers.&lt;BR /&gt;&lt;BR /&gt;can someone suggest a shell script ?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shiv&lt;BR /&gt;</description>
    <pubDate>Tue, 11 Oct 2005 17:15:28 GMT</pubDate>
    <dc:creator>Shivkumar</dc:creator>
    <dc:date>2005-10-11T17:15:28Z</dc:date>
    <item>
      <title>shell script to find ips</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647112#M102363</link>
      <description>Dear Sirs,&lt;BR /&gt;&lt;BR /&gt;I have server names list and want to find out ip address of the servers.&lt;BR /&gt;&lt;BR /&gt;can someone suggest a shell script ?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shiv&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Oct 2005 17:15:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647112#M102363</guid>
      <dc:creator>Shivkumar</dc:creator>
      <dc:date>2005-10-11T17:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to find ips</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647113#M102364</link>
      <description>Pipe the list into "xargs" which will run the nslookup command. &lt;BR /&gt;&lt;BR /&gt;cat serverlistfile | xargs -n1 nslookup&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;Rod Hills</description>
      <pubDate>Tue, 11 Oct 2005 17:19:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647113#M102364</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2005-10-11T17:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to find ips</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647114#M102365</link>
      <description>I have the following script(get.ip.sh) located on each server;&lt;BR /&gt;&lt;BR /&gt;HOST=`hostname |cut -f1 -d"."`&lt;BR /&gt;DOM=`domainname`&lt;BR /&gt;[ -z "$DOM" ] &amp;amp;&amp;amp; DOM="none"&lt;BR /&gt;/etc/lanscan |grep lan |awk '{print $5}'|while read LAN;do&lt;BR /&gt;   IP=`/etc/ifconfig $LAN 2&amp;gt;&amp;amp;1 |grep inet |awk '{print $2}'`&lt;BR /&gt;   MASK=`/etc/ifconfig $LAN 2&amp;gt;&amp;amp;1 |grep inet |awk '{print $4}'`&lt;BR /&gt;      typeset -L4 M12&lt;BR /&gt;      typeset -R4 M34&lt;BR /&gt;      M12=$MASK&lt;BR /&gt;      M34=$MASK&lt;BR /&gt;      typeset -L2 M1&lt;BR /&gt;      typeset -R2 M2&lt;BR /&gt;      typeset -L2 M3&lt;BR /&gt;      typeset -R2 M4&lt;BR /&gt;      M1=`echo $M12|tr '[a-z]' '[A-Z]'`; m1=`echo ibase=16\;$M1|bc`&lt;BR /&gt;      M2=`echo $M12|tr '[a-z]' '[A-Z]'`; m2=`echo ibase=16\;$M2|bc`&lt;BR /&gt;      M3=`echo $M34|tr '[a-z]' '[A-Z]'`; m3=`echo ibase=16\;$M3|bc`&lt;BR /&gt;      M4=`echo $M34|tr '[a-z]' '[A-Z]'`; m4=`echo ibase=16\;$M4|bc`&lt;BR /&gt;   MASK="$m1.$m2.$m3.$m4"&lt;BR /&gt;   [ "$IP" != "" ] &amp;amp;&amp;amp; echo "$HOST $DOM $LAN $IP $MASK"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;then, from a central server, I remsh to each server in the list and execute the script;&lt;BR /&gt;&lt;BR /&gt;for server in node1 node 2 node3 ;do&lt;BR /&gt;  remsh $server -n /usr/local/bin/get.ip.sh&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;This will generate results like the following format nodename nisdomain lan# IP netmask;&lt;BR /&gt;&lt;BR /&gt;node1 nisdom lan2 170.208.6.203 255.255.255.192&lt;BR /&gt;node1 nisdom lan0 170.208.5.6 255.255.255.240&lt;BR /&gt;node2 nisdom lan0 170.208.5.4 255.255.255.240&lt;BR /&gt;node2 nisdom lan1 170.208.6.209 255.255.255.192&lt;BR /&gt;node3 nisdom lan0 10.12.2.150 255.255.255.128&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Oct 2005 17:48:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647114#M102365</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-10-11T17:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to find ips</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647115#M102366</link>
      <description>incidently, if someone has a better way to convert the netmask from ffffffc0 to 255.255.255.192 in a shell script, I'd love to hear about it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;zpp</description>
      <pubDate>Tue, 11 Oct 2005 17:52:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647115#M102366</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-10-11T17:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to find ips</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647116#M102367</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Alan, you can use perl (embedded in your shell) to convert your address:&lt;BR /&gt;&lt;BR /&gt;a=ffffffc0 #...in your shell...&lt;BR /&gt;&lt;BR /&gt;i=`perl -le 'print join(".",unpack("C4",pack("H8",$ARGV[0])))' $a`&lt;BR /&gt;&lt;BR /&gt;echo ${i} #...returns the dotted notation&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Oct 2005 19:41:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647116#M102367</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-10-11T19:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to find ips</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647117#M102368</link>
      <description>Thanks James....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Zero Points Please</description>
      <pubDate>Wed, 12 Oct 2005 09:51:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647117#M102368</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-10-12T09:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to find ips</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647118#M102369</link>
      <description>Hay Alan,&lt;BR /&gt;&lt;BR /&gt;I don't know if this is really better but it takes fewer lines and fewer calls to outside commands.  Some people would consider that a plus I guess&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;LAN=lan0&lt;BR /&gt;&lt;BR /&gt;/etc/ifconfig ${LAN} |\&lt;BR /&gt;awk '/inet/ { printf "%s %s %s %s",\&lt;BR /&gt;              substr($4,1,2),substr($4,3,2),substr($4,5,2),substr($4,7,2) }'|\&lt;BR /&gt;              read a b c d&lt;BR /&gt;&lt;BR /&gt;((A=16#$a));((B=16#$b));((C=16#$c));((D=16#$d))&lt;BR /&gt;&lt;BR /&gt;echo $A.$B.$C.$D&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Oct 2005 10:00:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647118#M102369</guid>
      <dc:creator>Howard Marshall</dc:creator>
      <dc:date>2005-10-12T10:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to find ips</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647119#M102370</link>
      <description>Thanks Howard.&lt;BR /&gt;&lt;BR /&gt;ZPP</description>
      <pubDate>Wed, 12 Oct 2005 10:22:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-find-ips/m-p/3647119#M102370</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-10-12T10:22:26Z</dc:date>
    </item>
  </channel>
</rss>

