如何配置我的 ubuntu 以允許我透過 eth0 位址發送多播,並透過 eth1 位址接收?我能夠透過相同位址發送和接收,但透過 192.168.122.140 (eth0) 發送並從 192.168.122.40 (eth1) 接收時失敗。
細節:
我編寫了兩個程式1) 多播發送方,透過具有多播位址和連接埠的介面192.168.122.140 廣播訊息2) 多播接收方,透過介面192.168.122.40 接收多播訊息,並指向發送方應用程式中定義的位址和連接埠。
我已經測試了發送器和接收器應用程序,它們都具有相同的介面 192.168.122。140,或者192.168.122。40,接收方能夠從發送方應用程式接收資料包。但是當我設定192.168.122時。140寄件人,並設定 192.168.122。40對於接收者來說,接收者什麼也沒收到。
這就是我的路由表的樣子。如有錯誤,請幫忙指正。
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default hkcore.hk.abc.n 0.0.0.0 UG 100 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth1
localnet * 255.255.255.0 U 0 0 0 eth0
localnet * 255.255.255.0 U 0 0 0 eth1
224.0.0.0 * 240.0.0.0 U 0 0 0 eth0
eth0 Link encap:Ethernet HWaddr 74:d0:2b:2c:06:23
inet addr:192.168.122.140 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::76d0:2bff:fe2c:623/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:109471 errors:0 dropped:0 overruns:0 frame:0
TX packets:1513722 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:29824161 (29.8 MB) TX bytes:1186271256 (1.1 GB)
Interrupt:20 Memory:f7200000-f7220000
eth1 Link encap:Ethernet HWaddr 00:1b:21:25:05:13
inet addr:192.168.122.40 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:19 Memory:f71c0000-f71e0000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:5172 errors:0 dropped:0 overruns:0 frame:0
TX packets:5172 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:406555 (406.5 KB) TX bytes:406555 (406.5 KB)