# Getting the ipaddress of a specific interface

**URL:** <https://discourse.chef.io/t/getting-the-ipaddress-of-a-specific-interface/2024>\
**Category:** Chef Infra (archive)\
**Created:** [August 14, 2011, 8:49pm UTC](https://discourse.chef.io/t/getting-the-ipaddress-of-a-specific-interface/2024 "2011-08-14T20:49:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Haim\_Ashkenazi](https://avatars.discourse-cdn.com/v4/letter/h/ed655f/32.png) [@Haim\_Ashkenazi](https://discourse.chef.io/u/Haim_Ashkenazi)\
**Post date:** [August 14, 2011, 8:49pm UTC](https://discourse.chef.io/t/getting-the-ipaddress-of-a-specific-interface/2024/1 "2011-08-14T20:49:34Z")

</div>

Hi

I was wondering if there’s an easy way to get the ip address of a specific  
interface (and not just the main ip adders)? From what I’ve seen I can run  
regexp against node.network.interfaces.X.addresses.keys, if there more  
elegant way?

## Thanks in advance

Haim

---

<div class="post-metadata">

**Author:** ![Charles\_Sullivan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/charles_sullivan/32/483_2.png) [@Charles\_Sullivan](https://discourse.chef.io/u/Charles_Sullivan)\
**Post date:** [August 14, 2011, 8:55pm UTC](https://discourse.chef.io/t/getting-the-ipaddress-of-a-specific-interface/2024/2 "2011-08-14T20:55:29Z")

</div>

I haven't found one. I do the same thing you mentioned.

Sent from my iPhone

On Aug 14, 2011, at 3:49 PM, Haim Ashkenazi [haim.ashkenazi@gmail.com](mailto:haim.ashkenazi@gmail.com) wrote:

> Hi
> 
> I was wondering if there's an easy way to get the ip address of a specific interface (and not just the main ip adders)? From what I've seen I can run regexp against node.network.interfaces.X.addresses.keys, if there more elegant way?
> 
> ## Thanks in advance
> 
> Haim

---

<div class="post-metadata">

**Author:** ![Haim\_Ashkenazi](https://avatars.discourse-cdn.com/v4/letter/h/ed655f/32.png) [@Haim\_Ashkenazi](https://discourse.chef.io/u/Haim_Ashkenazi)\
**Post date:** [August 14, 2011, 8:58pm UTC](https://discourse.chef.io/t/getting-the-ipaddress-of-a-specific-interface/2024/3 "2011-08-14T20:58:40Z")

</div>

Hi,

On Sun, Aug 14, 2011 at 11:55 PM, Charles Sullivan \<  
[charlie.sullivan@gmail.com](mailto:charlie.sullivan@gmail.com)\> wrote:

> I haven't found one. I do the same thing you mentioned.

I just got this link from irc. It seems a little cleaner the regexp:

> <https://gist.github.com/jtimberman/1040543>

Thanks

> Sent from my iPhone
> 
> On Aug 14, 2011, at 3:49 PM, Haim Ashkenazi [haim.ashkenazi@gmail.com](mailto:haim.ashkenazi@gmail.com)  
> wrote:
> 
> Hi
> 
> I was wondering if there's an easy way to get the ip address of a specific  
> interface (and not just the main ip adders)? From what I've seen I can run  
> regexp against node.network.interfaces.X.addresses.keys, if there more  
> elegant way?
> 
> ## Thanks in advance
> 
> Haim

--  
Haim
