Introduction
I recently had the need to test Multicast IP network traffic passing through the firewall between the computers that are in different IP subnets. Because administration and configuration of the firewall devices are not under my control and these jobs are delegated to others, I needed a simple tool with which I could test this kind of network traffic, between the above computers.
I made a search on the site codeproject.com and found an interesting article on this topic: "IP Multicasting in C #" by Gary Brewer published on 10th January, 2002. In the aforementioned article (thanks’ to Gary), the basics of Multicast IP traffic theory have been explained and source code functions written in C# to test multicast IP traffic is supplied. I took the aforementioned code and created a new project using Visual Studio 2015 and added new functionality to the mentioned code, which I needed for testing. The project was designed for .NET 4.6 version and tested on computers with operating systems w2k12R2, windows7, w2k16 and windows 10. In this code, I use external libraries Costura.Fody
and CommandLineParser
.
Explanation of Used External Libraries
Costura.Fody
- (Embeds dependencies as resources) Costura.Fody
allows creating executable code (.exe) file with all the necessary files (.dll) imported into executable file. When you deliver executable code, you do not have to deliver referenced external .dll files that were used to compile the program.
CommandLineParser
- Library CommandLineParser
was used to validate and parse the parameters that are submitted to programs from the command line.
How to Use
The program consists of two executable (.exe) programs. One executable program needs to be started on the computer where we will test acceptance of multicast IP packets that are sent from the network (MulticastReceive.exe) and the other executable program needs to be started to generate multicast IP traffic (MulticastSend.exe).
If MulticastReceive.exe starts without any parameters, the program by default listens for incoming multicast traffic on the IP address 238.0.0.1 and port 5050. Possible parameters and values that can be used when starting the program can be got if you start the program with the command line parameter "-h
":
If, for example, you want to start listening for incoming multicast traffic on a multicast IP address 224.0.1 and port 5000, it is necessary to start the program as follows:
MulticastReceive.exe 224.0.01 -a -p 5000
Another program required for testing needs to be started on the computer that will generate and send the network multicast traffic (MulticastSend.exe). If you start the program without any command line parameters, by default, the program will send multicast IP traffic to the IP address 238.0.0.1, port 5050, with default value of 3 for the limitation of the jump (TTL - eng. Time To Live or Hop Limit), 5 data packets with a length of 30 characters per package. Possible parameters and values that can be used when you start the program, you can see if you start the program from the command line with "-h
" parameter:
If, for example, you want to start sending the multicast IP traffic to IP address 224.0.1, port 5000, with TTL 5, 10 packages with packet size of 1KB (1024 characters), it is necessary to start the program as follows:
MulticastReceive.exe 224.0.01 -a -p 5000 -t 10 -s 5 -n 1024
How to Start Multicast IP Test
When testing the functionality of the program due to the presence of firewall devices, you need to test three different scenarios:
- When both programs start on the same machine, to verify that the programs are functioning properly, to generate and accept the generated multicast IP traffic
- When the programs start on different computers that are located in the same IP subnet, i.e., when not in use default gateway for sending IP traffic between computers
- When the programs start on different computers that are located in different IP subnets, i.e., when using the default gateway for sending IP traffic between computers
Source Code Project
You can find the complete source code project on GitHub.
Additional Resources