Another thing to keep in mind, udp is unreliable so different outbound interfaces will most likely take different paths and many under stress will drop udp traffic - some always, especially on unknown ports - which is not correct behavior but it happens over the internet. You shouldn’t see this on a local network. Also, when you send out over a different interface than how it arrived the destination may not be able to route due to nat translations - which is why as you’ve found that you best bet is to send using the same interface it arrived on - but strictly speaking this should not be required - this is the underlying principle of internet routing.
> On Aug 26, 2019, at 7:38 PM, Robert Engels <reng...@ix.netcom.com> wrote: > > If the network is set up properly the kernel should chose the correct network > interface based on the destination IP address. > > The only time this doesn’t apply is with multicast packets so as to not flood > the network. In this case you set the interface you want to send on. > >> On Aug 26, 2019, at 3:47 PM, 'Tanner Ryan' via golang-nuts >> <golang-nuts@googlegroups.com> wrote: >> >> Hi, >> >> I was hoping someone could help me with an issue. I have a simple UDP server >> that listens on a specific port, responding with a message back. >> >> conn, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4(0, 0, 0, 0), >> Port: *port}) >> >> When reading messages, I use the source address for sending a response back. >> >> n, sourceAddr, err := conn.ReadFromUDP(buff) >> conn.WriteToUDP(reply, sourceAddr) >> >> When my WAN interface has a single IPv4 address, the server can read and >> respond properly. When there's an additional IPv4 address on the WAN, >> requests to the second IP are successful received, but the response is not >> received by the original sender. >> >> Is there another way to fix this other than explicitly calling ListenUDP on >> the two addresses? >> >> >> Best, >> Tanner >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/accf321d-75ad-4afb-9709-54ced8b37c5e%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/C721BC6E-5E6A-478E-8294-61940FE9E098%40ix.netcom.com.