I have a scenario where we will be using a Mac to stream video content to an RTMP server. This RMTP service provides 2 ingest URLs so that you can upload the same video content twice and have redundancy in case your connection has a problem. However, both RTMP ingest URLs are the same, the only difference is their TCP port number, for example:
{
"rtmp1": "rtmp://xxx.xxx.com:1935/id1",
"rtmp2": "rtmp://xxx.xxx.com:1936/id1"
}
What I want to do is the following:
- Have two network interfaces on the Mac (each using different network providers, for redundancy).
- Have the OS X use 1 of those network interfaces to stream content to the first URL, and use the second network interface to stream to the second URL
I don't know how to split traffic to the same host (but different port) through different network interfaces in OS X. I have found these links (here, and here), but they solve different problems.
Does anyone know how to use iptables, nat, hosts, or any combination of services within OS X to achieve this split I am looking for?
UPDATE
After some research, I am convinced this should be achievable with PF. I have created the following rule set and enabled pf with this rule loaded. However, all traffic is blocked and the actual rtmp traffic that should be allowed outbound and properly routed is also blocked. Seems like I have a syntax problem in having PF match the RTMP traffic with the rule I configured:
ext_if1 = "en0"
ext_if1_gwt = "192.168.1.1"
ext_if2 = "en5"
ext_if2_gwt = "192.168.1.1"
rtmp_ip = "104.46.55.96"
rtmp_port1 = "1935"
rtmp_port2 = "1936"
pass in on $ext-if1 route-to ($ext_if1 $ext_if1_gwt) proto tcp from any to $rtmp_ip port $rtmp_port1
pass in on $ext-if1 route-to ($ext_if2 $ext_if2_gwt) proto tcp from any to $rtmp_ip port $rtmp_port2
pass in on $ext-if2 route-to ($ext_if1 $ext_if1_gwt) proto tcp from any to $rtmp_ip port $rtmp_port1
pass in on $ext-if2 route-to ($ext_if2 $ext_if2_gwt) proto tcp from any to $rtmp_ip port $rtmp_port2
block out