Difference between revisions of "Building Windows Media Service Cluster using LVS"
(→Configuration Example) |
|||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Introduction == | == 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 | ||
Line 6: | Line 10: | ||
== Configuration Example == | == Configuration Example == | ||
+ | In order for us to get this to work, we need to allow the following ports in:<br/> | ||
+ | <ul><li>80 tcp (<em>ONLY NEEDED IF YOU ARE SERVING STREAMS THROUGH HTTP</em>)</li> | ||
+ | <li>554 tcp/udp</li> | ||
+ | <li>1755 tcp/udp</li> | ||
+ | <li>1024-5000 udp</li></ul> | ||
+ | |||
+ | <br/>This can be done like so, replacing <b>$EXT_IF</b> and <b>$EXT_IP</b> with your appropriate interface and IP:<br/><br/> | ||
+ | |||
+ | <ul><li>iptables -A INPUT -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 1755 -j ACCEPT</li> | ||
+ | <li>iptables -A INPUT -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 554 -j ACCEPT</li> | ||
+ | <li>iptables -A INPUT -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 554 -j ACCEPT</li> | ||
+ | <li>iptables -A INPUT -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 1024:5000 -j ACCEPT</li></ul> | ||
+ | |||
+ | <br/>(<b><em>example:</em></b> iptables -A INPUT -i eth0 -p tcp -s 0/0 -d 1.2.3.4 --dport 1755 -j ACCEPT)<br/><br/> | ||
+ | |||
+ | <br/>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 <b>$EXT_IF</b>, <b>$EXT_IP</b> and <b>$WMS_MARK</b> with your appropriate interface, IP and mark that you would like to tag the packets with:<br/><br/> | ||
+ | |||
+ | <ul><li>iptables -t mangle -A PREROUTING -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 554 -j MARK --set-mark $WMS_MARK</li> | ||
+ | <li>iptables -t mangle -A PREROUTING -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 554 -j MARK --set-mark $WMS_MARK</li> | ||
+ | <li>iptables -t mangle -A PREROUTING -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 1755 -j MARK --set-mark $WMS_MARK</li> | ||
+ | <li>iptables -t mangle -A PREROUTING -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 1755 -j MARK --set-mark $WMS_MARK</li> | ||
+ | <li>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</li></ul> | ||
+ | |||
+ | <br/>(<b><em>example:</em></b> iptables -t mangle -A PREROUTING -i eth0 -p tcp -s 0/0 -d 1.2.3.4 --dport 554 -j MARK --set-mark 1)<br/><br/> | ||
+ | |||
+ | <br/>Next, we need to tell LVS to do the load balancing. This can be done by doing the following, replacing <b>$WMS_MARK</b> and <b>$RSx_IP</b> with the appropriate mark that you chose above and your real server IPs:<br/><br/> | ||
+ | |||
+ | <ul><li>ipvsadm -D -f $WMS_MARK</li> | ||
+ | <li>ipvsadm -A -f $WMS_MARK -s rr -p 600</li> | ||
+ | <li>ipvsadm -a -f $WMS_MARK -r $RS1_IP:0 -m</li> | ||
+ | <li>ipvsadm -a -f $WMS_MARK -r $RS1_IP:0 -m</li></ul> | ||
+ | |||
+ | <br/>(<b><em>example:</em></b> ipvsadm -A -f WMSLVS1 -s rr -p 600) | ||
+ | <br/>(<b><em>example:</em></b> ipvsadm -a -f WMSLVS1 -r 10.10.10.1:0 -m) | ||
+ | |||
+ | <br/><br/>Once you have completed these steps, you should have a working Windows Media Streaming Server LVS! Enjoy! | ||
== Conclusion == | == 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 | ||
+ | * [http://www.microsoft.com/windows/windowsmedia/forpros/serve/firewall.aspx Firewall Information for Windows Media Services 9 Series] | ||
+ | * http://archive.linuxvirtualserver.org/html/lvs-users/2004-03/msg00176.html | ||
+ | |||
+ | |||
+ | {{lvs-example-stub}} | ||
[[Category:LVS Examples|Media]] | [[Category:LVS Examples|Media]] |
Latest revision as of 22:52, 6 December 2006
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 |