1

Please if you can help me about my problem. On one side I have server with IP 172.27.13.2 connected to the WAN interface of router 172.27.13.1 ...Then on wireless LAN of my router 192.168.1.1 I have connected a few clients. Now I will write code in C where client are requesting some UDP streams from server, then server broadcasts streams to clients, and if some packets get lost clients must send NACK to server. My questions is: Because server and clients are on different subnets how can I broadcast from server? And how the client can send request and NACKs to server because they are in different subnets? Are these problems can be solved by router configurations or in C code?

Thank you for helping

Mutawe
  • 6,464
  • 3
  • 47
  • 90
user3119422
  • 87
  • 3
  • 11

2 Answers2

1

You cannot broadcast to different subnets. Routers do not usually forward broadcast packets to different subnets, unless you have a very special router that can be configured properly (e.g. Cisco ...). You could however use multicast for such a task. Here's a C example

Also check this: UDP broadcast packets across subnets

NOTE: some includes in the c example are missing, but they are easy to find

Community
  • 1
  • 1
H_squared
  • 1,251
  • 2
  • 15
  • 32
  • But on the client side I will have only one LAN subnet 192.168.1.1/24 so why I can not send the broadcast packets from server on 192.168.1.255....the problem is how the client can respond to server on 172.27.13.2 ? This respond is unicast. Or I do not understand well the concept. Thank you – user3119422 Jan 06 '14 at 10:23
  • @user3119422 Broadcast is for one subnet only, so you cannot send broadcast from 192.168.1.0/24 and have them end up on 172.27.13.2 (nor can you do it the other way around) Unicast is no problem, as long as you have a router set up properly. – nos Jan 06 '14 at 10:27
  • 2
    Broadcasting using another interface broadcast address is almost anywhere disabled for security reasons. Imagine this was allowed and result is efficient DoS against remote structure without knowing its details. Generally, some agent should retransmit your packets to local subnets. If you need it on enterprise level, study multicasting and multicast routing. – Netch Jan 06 '14 at 10:28
  • I want to send broadcast from 172.27.13.2 and have them end up on 192.168.1.0/24, and then client from 192.168.1.0/24 must reply to 172.27.13.2...if I can not use broadcast for my case, how I must configure router for multicast in my case ? And do I must use some specific router (For now I have linksys wrt54gl) – user3119422 Jan 06 '14 at 10:29
  • 1
    @user3119422 "I want to send broadcast from 172.27.13.2 and have them end up on 192.168.1.0/24". As I said in my answer, this is simply not possible unless you have special routers! Broadcasting to other subnets is disabled by default, otherwise there would be DoS all over the place. – H_squared Jan 06 '14 at 10:34
  • Ok I understood. Thank you for explaining me, I'm new with networking...If you have time, please can you tell me can I use my linksys wrt54gl for multicast and is there any special configuration for that for my example of network? Thx very much you helped me a lot – user3119422 Jan 06 '14 at 10:37
  • @user3119422 multicast is usually enabled by default. But you could check just to be safe. Also the c example I posted can give you an idea on where to start. P.S.: If my answer was helpful, please consider accepting it. – H_squared Jan 06 '14 at 10:38
  • @user3119422 For Linksys routers, there is an option called multicast filter to enable/disable multicast as explained here: http://smallbusiness.chron.com/linksys-filter-multicast-71951.html – H_squared Jan 06 '14 at 10:41
1

As both server & users are in different subnets .As router donot forward broadcast .But we have solution by modifying the router configuration . If you have cisco router & users are connected on cisco switch ,you can use ip helper address command on switch on vlan .You can allow udp packet on router ACL

Pawandeep
  • 11
  • 1
  • Hi, I don't have Cisco router, I read that they can do this...so I decided to use multicast sockets in C for my problem. Thx – user3119422 Jan 22 '14 at 12:02