1

私は 2 つのボックスを持っています: - " Omap "と呼ぶ組み込みデバイス (ARM Omap with Linux) 。- PC (Windows または Linux のいずれか)。

シナリオ 1

両方のボックスが同じネットワークにあります (例: 私のオフィス)。
Omap は DHCP サーバーからアドレスを取得します (例: 192.168.10.110)。PC のアドレスは常に同じです (例: 192.168.10.104)。
どのポートでも UDP ブロードキャスト パケットを正常に交換できます。
成功。


シナリオ 2

2 つのボックスは、DHCP サーバーのないネットワークにあります。
PC には静的 IP アドレスがあります (例: 10.10.10.20)。
Omap が起動し、DHCP サーバーを探しますが、それが見つからず、私が「不正な IP アドレス」と呼んでいる状態になります。 これで... Omapから
の UDP パケットのブロードキャストが機能します。PC はそれらを認識できます。 逆は機能しません。PC によってブロードキャストされた UDP パケットは、Omap によって認識されません。別の PC で Wireshark を使用して、パケットが送信されていることを確認しています。 失敗。


Omap の IP アドレスを (ifconfig を使用して) 変更しようとしましたが、うまくいきませんでした。

私は何が欠けていますか?

全体像を完成させるために、Omap がシナリオ 2 にある場合、udhcpc を実行すると ... DHCP サーバーと通信して IP アドレスを取得できます。Wireshark のパケットも表示されます。これは、DHCP クライアントが UDP パケットをブロードキャストできることを意味します。(はい、DHCP ポート 67/68 を使用しようとしましたが、機能しません)。

Boost C++ Asio UDP ソケットを使用しています。具体的には、マルチキャストの例を取り上げて、ブロードキャストを行うように変更しました。

どんな助けでも大歓迎です。

ありがとう、ベネデット

PS: いくつかの説明。

Omap デバイスは組み込みデバイスであり、私の目的は、顧客がフィールドで IP アドレスを設定する必要がないようにすることです。そのため、PC で実行されている他のソフトウェアから「適切な」IP アドレスを取得するために、PC とブロードキャスト パケットを交換しています (これは、静的 IP アドレスがあり、DHCP サーバーがないネットワークでも、現在のサブネットが何であるかを認識しています)。

基本的に、私は非常に単純な DHCP プロトコルを実装しました。PC は Omap によってブロードキャストされたパケットをリッスンできましたが、その逆はできませんでした。

4

2 に答える 2

0

いくつかの考え...

1)ifconfig eth0-インターフェイスはアップしていますか、IPアドレス、適切なネットマスクなどがありますか?

2)ルーティング-正しく構成されていますか?(Netstat -rまたはroute)(これは、IPアドレスが、ネットマスクに応じて、ルーティングされていない異なるサブネット上にある場合に問題になる可能性があります。)

3)ファイアウォール-ファイアウォールの問題に何回遭遇したかはわかりません。そこで停止していないことを確認します。

4)それぞれのシステムでtcpdumpを直接試してください-何が表示されますか?何が起こっているのですか?

5)あるシステムから別のシステムにpingを実行できますか?(ICMPにはUDPとは異なるルールがある場合があります。)

(ダウンインターフェイス、ネットマスクによってブロックされた別のサブネット、または最初にホストの問題へのルートがないことに賭けます。)

于 2010-06-11T03:48:24.843 に答える
0

If you set an IP address with ifconfig, that's likely not going to be enough. Usually, you must also configure the routing table, which usually consists of adding two routes: One saying that "this network is attached at eth0" and one saying "this is the default gateway". (The latter is not strictly required.)

"Network is unreachable" - I'm assuming you tried to ping the PC from the OMap? If your PC was 192.something.something.something, and your "OMap" has the routing table your comment:

Destination  Gateway  Genmask    Flags  MSS  Window  irtt  Iface
10.0.0.0     *        255.0.0.0  U      0    0       0     eth0

...then it won't be able to send. That routing table will only work if you try to send things to 10.something: that's the only route it knows. If you're not running a 10.0.0.0/8 network, then that route is wrong.

Look up some material on routing tables, IP addresses, etc. if you want to do this. Although, if you want to just have the average person "plug it in" - they're going to be running DHCP - what's so wrong with that? You can't just pick an IP address on a network without some form of mediation: Either a human mediates, and sets it manually, or you use something like a DHCP server. Otherwise, you could be picking somebody else's address. Also, you need to know whether you're on a 10.0.0.0/8 network, a 192.168.0-255.0/8 network, some other LAN, or the Internet... something DHCP does for you...

于 2010-06-11T23:33:17.320 に答える