# Need help to find the ip address of other host

**URL:** <https://www.ruby-forum.com/t/need-help-to-find-the-ip-address-of-other-host/259597>\
**Category:** Uncategorized\
**Created:** [May 18, 2020, 3:49am UTC](https://www.ruby-forum.com/t/need-help-to-find-the-ip-address-of-other-host/259597 "2020-05-18T03:49:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![keshavkishor4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7ba0ec/32.png) [@keshavkishor4](https://www.ruby-forum.com/u/keshavkishor4)\
**Post date:** [May 18, 2020, 3:49am UTC](https://www.ruby-forum.com/t/need-help-to-find-the-ip-address-of-other-host/259597/1 "2020-05-18T03:49:49Z")

</div>

Hello Team,

I am new to ruby. I want to find the ip address of other system. For example:- i am executing my code from server wevrs1234 and i want ip address of server apvrs1234 and store it in variable. Please help me to get this. Thanks in advance

---

<div class="post-metadata">

**Author:** ![gats](https://www.ruby-forum.com/user_avatar/www.ruby-forum.com/gats/32/1974_2.png) [@gats](https://www.ruby-forum.com/u/gats)\
**Post date:** [May 18, 2020, 7:22pm UTC](https://www.ruby-forum.com/t/need-help-to-find-the-ip-address-of-other-host/259597/2 "2020-05-18T19:22:48Z")

</div>

I’m curious. How are you executing code on a remote server without knowing its IP address to begin with?

In any case, I’d probably run a system command based on what OS is running on the target system. So, for example, for Linux, if I’m looking for the internal ip address:

```auto
ip = `hostname -I`
puts ip

```
