Multicast routes are a similar concept to IP Routes, but as the name implies they are for Multicast addresses (which are class D), rather than standard IP Addresses (which are class A, B and C). For Unicast I would surmise you still use IP Routes.
There are two main ways to add a Multicast Route.
1. Create a routing file in (CentOS) /etc/sysconfig/network-scripts/ 2. Add the route from the command line.
1. Create a routing file
In this example, we will define that all multicast traffic in the range 239.X.Y.Z will be listened on the eth2 interface.
To do this, navigate to the location where all the interface configuration files are held. On CentOS this is /etc/sysconfig/network-scripts
Create a route config file for your interface (eth2 in this example).
Note, the filename is the word “route” + “-” + “interface name”. So if your interface name was eno33559296, then your route file would be called route-eno33559296.
Now add your routing parameters.
GATEWAY0=220.127.116.11 NETMASK0=255.0.0.0 ADDRESS0=18.104.22.168
The above routing information routes all traffic that has a multicast address of 239.x.x.x and a subnet of 255.0.0.0 to interface eth2 (as dictated by the name of the file “route-eth2”.
This will route all multicast traffic requests on 239.X.Y.Z scope to interface Eth2, which has the IP address 22.214.171.124. The 'Gateway' in this instance is an interface address.
Save and close the file. Restart networking or restart the server.
2. Add the route from the command line
We can add the route from the command line, this does not create a file for us in the /etc/sysconfig/network-scripts folder, I don't actually know where it gets stored (or if it is persistent). so you need to test this method.
In this example we are going to add a multicast route 126.96.36.199/4 (/4 = 240.0.0.0) to an interface called eno33559296. 188.8.131.52/4 basically means everything from 184.108.40.206 to 220.127.116.11, so all multicast addresses.
From the command line, enter the following:
ip route add 18.104.22.168/4 dev eno33559296
You can check to see if the route has taken by using the following:
you will see a table of routes, with the new route added.
Destination Gateway Genmask Flags Metric Ref Use IfaceD default 10.43.0.3 0.0.0.0 UG 100 0 0 eno16780032 10.0.0.0 10.0.3.70 255.0.0.0 UG 0 0 0 eno33559296 10.0.3.0 0.0.0.0 255.255.255.0 U 100 0 0 eno33559296 10.43.0.0 0.0.0.0 255.255.224.0 U 100 0 0 eno16780032 22.214.171.124 0.0.0.0 240.0.0.0 U 0 0 0 eno33559296
The last line 126.96.36.199 - 0.0.0.0 - 240.0.0.0 - U - 0 - 0 - 0 - eno33559296 is our new route.