# So\_bindtodevice

**URL:** <https://www.ruby-forum.com/t/so-bindtodevice/244596>\
**Category:** NGINX\
**Created:** [May 10, 2016, 5:13pm UTC](https://www.ruby-forum.com/t/so-bindtodevice/244596 "2016-05-10T17:13:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [May 10, 2016, 5:13pm UTC](https://www.ruby-forum.com/t/so-bindtodevice/244596/1 "2016-05-10T17:13:47Z")

</div>

My device has multiple interfaces and supports dynamic ips.  
SO\_BINDTODEVICE looks like it would be used to specify a device in the  
listen statement instead of having to update every IP change.

I see someone submitted a patch years ago that wasn’t accepted and  
there was no follow on. Is there any particular reason other than this  
probably isn’t a common use case? Is this something that could be  
added in the future?

> **[Patch to enable SO\_BINDTODEVICE](https://forum.nginx.org/read.php?29,234862)**
>
> In order to play some tricks and send requests to myself over external network interfaces, I need to enable the SO\_BINDTODEVICE socket option. Here's the patch that I'm trying out. If there is a better patch format or place to send this, please let...

---

<div class="post-metadata">

**Author:** ![Danomi\_Czaski](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@Danomi\_Czaski](https://www.ruby-forum.com/u/Danomi_Czaski)\
**Post date:** [May 10, 2016, 5:17pm UTC](https://www.ruby-forum.com/t/so-bindtodevice/244596/2 "2016-05-10T17:17:18Z")

</div>

SO\_BINDTODEVICE was originally put in to allow the DHCP server to tell  
on  
which interface a packet had arrived. I don’t see any reason why it  
couldn’t be used the way you describe, but I am under the impression  
that  
it is somewhat deprecated, and that may be why there was no action on  
that  
patch. Your best bet would be to ask the Linux network folks.
