如何配置我的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)
刚刚在帖子上添加了更多细节。是的,我试图接收(通过eth1)我发送的数据包(通过eth0)。
—
Bryan Fok
eth1
?看来你的eth0
和eth1
在同一个本地网段。你想接受(通过eth1
)你发送的数据包(通过eth0
)?如果没有,该网段上是否有来自其他地方的组播数据包?你收到了吗?