Building Windows Media Service Cluster using LVS
Introduction
Microsoft Windows Media Service uses uses two streaming media protocols to deliver content as a unicast stream to clients:
- Real Time Streaming Protocol (RTSP)
- Microsoft Media Server (MMS) protocol
Architecture
Configuration Example
In order for us to get this to work, we need to allow the following ports in:
- 80 tcp (ONLY NEEDED IF YOU ARE SERVING STREAMS THROUGH HTTP)
- 554 tcp/udp
- 1755 tcp/udp
- 1024-5000 udp
This can be done like so, replacing $EXT_IF and $EXT_IP with your appropriate interface and IP:
- iptables -A INPUT -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 1755 -j ACCEPT
- iptables -A INPUT -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 554 -j ACCEPT
- iptables -A INPUT -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 554 -j ACCEPT
- iptables -A INPUT -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 1024:5000 -j ACCEPT
(example: iptables -A INPUT -i eth0 -p tcp -s 0/0 -d 1.2.3.4 --dport 1755 -j ACCEPT)
Next, we need to take a group the packets by using the MANGLE table in iptables. To do that you would do the following, replacing $EXT_IF, $EXT_IP and $WMS_MARK with your appropriate interface, IP and mark that you would like to tag the packets with:
- iptables -t mangle -A PREROUTING -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 554 -j MARK --set-mark $WMS_MARK
- iptables -t mangle -A PREROUTING -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 554 -j MARK --set-mark $WMS_MARK
- iptables -t mangle -A PREROUTING -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 1755 -j MARK --set-mark $WMS_MARK
- iptables -t mangle -A PREROUTING -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 1755 -j MARK --set-mark $WMS_MARK
- iptables -t mangle -A PREROUTING -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 1024:5000 -j MARK --set-mark $WMS_MARK
(example: iptables -t mangle -A PREROUTING -i eth0 -p tcp -s 0/0 -d 1.2.3.4 --dport 554 -j MARK --set-mark 1)
Next, we need to tell LVS to do the load balancing. This can be done by doing the following, replacing $WMS_MARK and $RSx_IP with the appropriate mark that you chose above and your real server IPs:
- ipvsadm -D -f $WMS_MARK
- ipvsadm -A -f $WMS_MARK -s rr -p 600
- ipvsadm -a -f $WMS_MARK -r $RS1_IP:0 -m
- ipvsadm -a -f $WMS_MARK -r $RS1_IP:0 -m
(example: ipvsadm -A -f WMSLVS1 -s rr -p 600)
(example: ipvsadm -a -f WMSLVS1 -r 10.10.10.1:0 -m)
Once you have completed these steps, you should have a working Windows Media Streaming Server LVS! Enjoy!
Conclusion
In the above configuration example you see that I am using Round-Robin (rr). This is not necessary, you can use any type you want. I have switched my personal LVS setup to use Weighted Least Connections (wlc).
References
- http://archive.linuxvirtualserver.org/html/lvs-users/2004-03/msg00176.html
- Firewall Information for Windows Media Services 9 Series
- http://archive.linuxvirtualserver.org/html/lvs-users/2004-03/msg00176.html
"Building Windows Media Service Cluster using LVS" is an LVS Example related stub. You can help LVSKB by expanding it |