I'm using perl to send broadcast packets back to DHCP Clients. I'm listening on a address bound to eth1. When I broadcast my packets, they go out on eth0.

I've played with route (based on old dhcp instructions), to try and get the kernel to route 255.255.255.255 to eth1, but nothing seems to have worked so far.

One thing that does work is ISC DHCPD. It does not change the host's routes, but does manage to broadcast packets on the correct interface. I intially suspected that this was done using ioctl, but after grepping through the code, can't put my finger on exactly where they tell the socket (and by extension, the kernel) which interface to use when broadcasting.

Anyone ever done this before? What's the solution?

Rob

In reply to Changing Broadcast Interface by robertlandrum

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.