This is a copy of a post I made in the C# forum. It really is a networking question. Please help me if you can.

I have a program that sends out UDP traffic via csharp. The code works in the local LAN. We even got it working to other VLANs through ip pim sparse-dense-mode on our Cisco 6504 switch. The problem is that we want this to run to a remote location outside of our LAN. We have a T1 connection to another site. We can ping and do file transfers with the remote machines. But the remote machines do not "hear" the multicast messages. What settings need to be set so that the remote site can get this multicast traffic? Many thanks in advance.

John

The Server:

private IPEndPoint iepSend = null;
private IPEndPoint iepSend2 = null;
private Socket sendSocket = null;
...
sendSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
iepSend = new IPEndPoint(IPAddress.Any, 4203);
iepSend2 = new IPEndPoint(IPAddress.Parse("227.40.23.1"), 4203);
sendSocket.Bind(iepSend);
sendSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("227.40.23.1")));
sendSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 50);
...
byte[] bytes = UnicodeEncoding.ASCII.GetBytes("hello world");
sendSocket.SendTo(bytes, iepSend2);

The Client

UdpClient clientListener = new UdpClient(4203);            
clientListener.JoinMulticastGroup(IPAddress.Parse("227.40.23.1"));
IPEndPoint iep = new IPEndPoint(IPAddress.Any, 0);
byte[] bytes = clientListener.Receive(ref iep);
string s = UnicodeEncoding.ASCII.GetString(bytes);

Dani AI

Generated

Multicast does not traverse a routed WAN hop automatically — the network must be made multicast-aware (multicast routing or a tunnel) or the traffic must be converted to unicast. is correct that tunneling multicast across a non‑multicast WAN is a common fix; the checklist and options below fill in practical steps and diagnostics missing from the thread.

Diagnostics checklist (run in order to isolate where packets stop):

  • Confirm multicast packets actually leave the sender NIC (capture on the sender with Wireshark/tcpdump and look for UDP to the group address).
  • Verify the sender is using the intended outbound interface (use the MulticastOption overload or set the multicast interface socket option so the kernel sends on the correct NIC).
  • Check IGMP/state on the edge router and the multicast routing table (Cisco: inspect IGMP groups and multicast routes with show ip igmp groups / show ip mroute to see RPF and forwarding entries).
  • Capture at the edge router and at the remote site router to determine whether packets are dropped on the WAN or never forwarded.
  • Confirm host firewalls and ACLs are not blocking group traffic and that the client has joined the group on the same interface the router sees.

Deployment options and tradeoffs:

  • If the provider carries multicast and routers can be configured: enable multicast routing (PIM) on both ends and ensure correct RP/RPF configuration for sparse mode.
  • If the provider does not carry multicast: use a multicast-aware tunnel (GRE or mGRE) between sites and run PIM over the tunnel; use IPsec for encryption if required. For small numbers of receivers, application-level replication (unicast copies, a reflector/broker) is sometimes simpler but consumes more bandwidth on a T1.
  • T1 bandwidth and firewall/ACLs matter — tunneling preserves multicast semantics and scales better than per-client replication.

C# note: prefer the MulticastOption constructor that includes a local interface IP (or set IP_MULTICAST_IF) so the OS sends on the correct NIC; multicast TTL must be high enough for the WAN.

From what I gathered from your post, you are trying to push multicast over the internet. This will not work as most ISP's block multicast from the end user.

What I would suggest is this:

Depending on what type of hardware you have connecting these two sites, a VPN is what you need. The problem with this is, a regular IPSec VPN will not move multicast, so must start with a GRE tunnel and then encrypt it in an IPSec tunnel. If you are working with Cisco switches, I would assume you have access to Cisco routers. A router in the 1800 or 2800 series would work well, or even as low as the 2600 series (depending on how much data you are planning on moving).

The below link is a good example (in pdf format) from Cisco on setting up the above mentioned config:

http://www.cisco.com/application/pdf/en/us/guest/netsol/ns171/c649/ccmigration_09186a008073a0c5.pdf

hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.