如何配置DDS以使用多个网络接口?How do I configure DDS to work with multiple network interfaces?
最近在使用OpenDDS的時(shí)候遇到一個(gè)問(wèn)題:存在多個(gè)虛擬網(wǎng)卡時(shí),發(fā)布(訂閱)端重新連接時(shí)會(huì)阻塞幾分鐘,在外網(wǎng)找到一篇與此相關(guān)的文章。
You cannot specify which NICs DDS will use to send data. You can restrict the NICs that DDS can use to receive data by configuring Participant properties in the QoS on the DataReader, but you cannot tell DDS to use one NIC or another to send the DataWriter data. Rather, the DataWriter will try to send data to all of the addresses that a DataReader announces when subscribing to data using the interfaces that the Operating System selects.
您無(wú)法指定DDS將用于發(fā)送數(shù)據(jù)的NIC。 您可以通過(guò)在DataReader上的QoS中配置Participant屬性來(lái)限制DDS可用于接收數(shù)據(jù)的NIC,但您無(wú)法告訴DDS使用一個(gè)NIC或另一個(gè)NIC來(lái)發(fā)送DataWriter數(shù)據(jù)。 相反,DataWriter將嘗試將數(shù)據(jù)發(fā)送到DataReader在使用操作系統(tǒng)選擇的接口訂閱數(shù)據(jù)時(shí)宣布的所有地址。
In other words, it is up to the routing table on the Operating System (OS) to decide which NICs are used to send the UDP/IP packets.
換句話說(shuō),由操作系統(tǒng)(OS)上的路由表決定使用哪些NIC來(lái)發(fā)送UDP / IP數(shù)據(jù)包。
For example:
- DataReader1 is on a node with single NIC, IP address 10.30.1.100
- DataReader2 is on a node with single NIC, IP address 10.10.100.120
- DataReader3 is on a node with two NICs, IP addresses 10.30.1.101 and 10.10.100.121
- The DataWriter1 is on a node with two NICs, IP addresses 10.30.1.191 and 10.10.100.188
- The netmask for all networks is 255.255.255.0.
- The DataWriter and DataReaders are for the same topic and have compatible QoS. Assume that the DataReaders are NOT subscribing to data using multicast.
例如:
- DataReader1位于具有單個(gè)NIC的節(jié)點(diǎn)上,IP地址為10.30.1.100
- DataReader2位于具有單個(gè)NIC的節(jié)點(diǎn)上,IP地址為10.10.100.120
- DataReader3位于具有兩個(gè)NIC的節(jié)點(diǎn)上,IP地址為10.30.1.101和10.10.100.121
- DataWriter1位于具有兩個(gè)NIC的節(jié)點(diǎn)上,IP地址為10.30.1.191和10.10.100.188
- 所有網(wǎng)絡(luò)的網(wǎng)絡(luò)掩碼是255.255.255.0。
- DataWriter和DataReader用于相同主題并具有兼容的QoS。 假設(shè)DataReader不使用多播訂閱數(shù)據(jù)。
In this scenario when DataWriter1 sends data to DataReader1, it will send a packet using the address 10.30.1.100. When sending data to DataReader2, it will send a packet using the address 10.10.100.120. When sending data to DataReader3, it will send 2 packets using the addresses 10.30.1.101 and 10.10.100.121.
在這種情況下,當(dāng)DataWriter1向DataReader1發(fā)送數(shù)據(jù)時(shí),它將使用地址10.30.1.100發(fā)送數(shù)據(jù)包。 向DataReader2發(fā)送數(shù)據(jù)時(shí),它將使用地址10.10.100.120發(fā)送數(shù)據(jù)包。 向DataReader3發(fā)送數(shù)據(jù)時(shí),它將使用地址10.30.1.101和10.10.100.121發(fā)送2個(gè)數(shù)據(jù)包。
The NIC used by the OS to send the data from DataWriter1 to a particular destination depends on the network routing table for the machine where DataWriter1 is running. Absent strange OS configurations, packets destined to the 10.30.1.x network should be sent through the NIC with address 10.30.1.191, and packets destined to the 10.10.100.x network should be sent through the NIC with address 10.10.100.188.
操作系統(tǒng)用于將數(shù)據(jù)從DataWriter1發(fā)送到特定目標(biāo)的NIC取決于運(yùn)行DataWriter1的計(jì)算機(jī)的網(wǎng)絡(luò)路由表。 如果沒(méi)有奇怪的操作系統(tǒng)配置,發(fā)往10.30.1.x網(wǎng)絡(luò)的數(shù)據(jù)包應(yīng)通過(guò)地址為10.30.1.191的NIC發(fā)送,發(fā)往10.10.100.x網(wǎng)絡(luò)的數(shù)據(jù)包應(yīng)通過(guò)地址為10.10.100.188的NIC發(fā)送。
For example, the routing table (use netstat -r to see the routing table, example below is output on Windows) may be:
例如,路由表(使用netstat -r查看路由表,以下示例在Windows上輸出)可能是:
Which supports the scenario as described above.
這支持如上所述的場(chǎng)景。
Restricting interfaces on the DomainParticipant
With the Property DomainParticipantQos, you can modify the default
NICs that the DomainParticipant is allowed to use (or denied), for
example:
限制DomainParticipant上的接口
使用Property DomainParticipantQos,您可以修改允許DomainParticipant使用(或拒絕)的默認(rèn)NIC,例如:
How restricting interfaces on the DomainParticipant affect the DataReader Absent further configuration, a DataReader will only advertise the interfaces that its DomainParticipant has been allowed to use as addresses where it can receive data. So for example, if DataReader3’s participant is restricted to use only the NIC with IP address 10.10.100.121, then this will be the only NIC advertised by DataReader3 and therefore a DataWriter will only send data to the DataReader3 at address 10.10.100.121. However, the DataWriter may still use its 10.10.100.188 NIC when sending data to DataReader2, which is on the same subnet as DataReader3.
DomainParticipant上的限制接口如何影響DataReader如果沒(méi)有進(jìn)一步的配置,DataReader只會(huì)通告其DomainParticipant被允許用作可以接收數(shù)據(jù)的地址的接口。 因此,例如,如果DataReader3的參與者被限制為僅使用IP地址為10.10.100.121的NIC,那么這將是DataReader3通告的唯一NIC,因此DataWriter將僅將數(shù)據(jù)發(fā)送到地址10.10.100.121的DataReader3。 但是,在將數(shù)據(jù)發(fā)送到與DataReader3位于同一子網(wǎng)的DataReader2時(shí),DataWriter仍可能使用其10.10.100.188 NIC。
How restricting interfaces on the DomainParticipant affect the DataWriter Restricting interfaces has no effect on DataWriters as far as unicast data is concerned. As mentioned earlier for unicast data, an application cannot control which NIC card is used by a DataWriter to send data. Generally speaking and independently of DDS, there is no way to control which interface IP data is sent at the application level. This is entirely controlled by the OS routing table.
就單播數(shù)據(jù)而言,限制DomainParticipant上的接口如何影響DataWriter限制接口對(duì)DataWriters沒(méi)有影響。 如前面提到的單播數(shù)據(jù),應(yīng)用程序無(wú)法控制DataWriter使用哪個(gè)NIC卡發(fā)送數(shù)據(jù)。 一般而言,與DDS無(wú)關(guān),無(wú)法控制在應(yīng)用程序級(jí)別發(fā)送哪個(gè)接口IP數(shù)據(jù)。 這完全由OS路由表控制。
For multicast data, the DomainParticipant will only send out multicast packets using the interfaces that it’s been allowed to use.
對(duì)于組播數(shù)據(jù),DomainParticipant將僅使用允許使用的接口發(fā)送組播數(shù)據(jù)包。
NOTE: by default, a DomainParticipant is only able to announce the first 4 interfaces that it finds as the default set of addresses to which other DomainParticipants should send it data.
注意:默認(rèn)情況下,DomainParticipant只能宣告它找到的前4個(gè)接口作為其他DomainParticipants應(yīng)向其發(fā)送數(shù)據(jù)的默認(rèn)地址集。
Hope this helps clarify how DDS works with multiple NICs and the controls that users have.
希望這有助于闡明DDS如何與多個(gè)NIC以及用戶擁有的控件配合使用。
原網(wǎng)站地址:https://community.rti.com/forum-topic/how-do-i-configure-dds-work-multiple-network-interfaces
****** 有對(duì)DDS技術(shù)了解,學(xué)習(xí),開發(fā)和培訓(xùn)需求的,請(qǐng)加入QQ群:707895641(DDS專業(yè)技術(shù)輔導(dǎo)) ******
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的如何配置DDS以使用多个网络接口?How do I configure DDS to work with multiple network interfaces?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: C++之多继承
- 下一篇: c iostream.源码_通达信《牛气