solaris + match the network device name according to IP address

Posted by yael on Server Fault See other posts from Server Fault or by yael
Published on 2012-10-18T09:40:13Z Indexed on 2012/10/18 11:03 UTC
Read the original article Hit count: 198

Filed under:
|

how to find the device name as ( e1000g2 , e1000g3 , etc ) according to his IP address on Solaris machine

for example

   ifconfig -a | grep 10.106.134.133

       inet 10.106.134.133 netmask ffffff00 broadcast 10.106.134.255

ifconfig with grep command view only the line with the IP address , and the device name appears before the IP address

so my target is to match the device name according to the IP address on Solaris machine , and then insert the device name in to parameter ( ksh )

please advice?

full example: from ifconfig -a ( I get the IP and device name , what I need is to find the device name according to IP address , and insert the device name in to parameter )

 e1000g2: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500            inet 10.106.134.133 netmask ffffff00 broadcast 10.106.134.255

© Server Fault or respective owner

Related posts about solaris

Related posts about shell-scripting