Search code examples
network-programmingprotocolsnetwork-protocolsethernet

How to establish ethernet connection between laptop and embedded device


I'm designing a device which will be connected to a computer using ethernet. It already has a mac controller built in. When I attach the device, all that happens is the computer broadcasts a bunch of DHCP discover packets and some other packets I guess in an attempt to find the device and establish the connection. I assume I need to make my device respond at this point with some sort of acknowledgement packets but I'm not sure what? Has anyone done something like this before? Thanks

I'm using wireshark to see the packets. The output looks something like this:

     time       source                 destination       protocol              info
 1 0.000000    0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xc82a69f
 2 4.000064    0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xc82a69f
 3 10.688469   0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xb452266b
 4 14.690625   0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xb452266b
 5 22.690576   0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xb452266b
 6 38.690605   0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xb452266b
 7 62.652821   my_ip                 XXX.XXX.255.255       BROWSER  Local Master Announcement MYLAPTOP, Workstation, Server, Print Queue Server, NT Workstation, Potential Browser, Master Browser
 8 65.555281   my_ip                 XXX.XXX.255.255       BROWSER  Domain/Workgroup Announcement MY, NT Workstation, Domain Enum
 9 352.692192  0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xa23d42a4
10 356.692376  0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xa23d42a4
11 364.692421  0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xa23d42a4
12 381.692442  0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xa23d42a4
13 665.557507  my_ip                 XXX.XXX.255.255       BROWSER  Domain/Workgroup Announcement MY, NT Workstation, Domain Enum
14 686.724951  0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xbe3a7bdb
15 691.724307  0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xbe3a7bdb
16 698.724276  0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xbe3a7bdb
17 715.724291  0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0xbe3a7bdb
18 783.295682  my_ip                 XXX.XXX.255.255       BROWSER  Local Master Announcement MYLAPTOP, Workstation, Server, Print Queue Server, NT Workstation, Potential Browser, Master Browser
19 908.920831  my_ip                 XXX.XXX.255.255       BROWSER  Get Backup List Request
20 908.920940  my_ip                 XXX.XXX.255.255       NBNS     Name query NB MY<1b>

Solution

  • If your computer is broadcasting DHCP packets it's because it needs a DHCP server to get an address. It is not looking for your device. Did you take the computer off the main network and hook it up on a private network with your device?

    Your computer knows nothing about your embedded device and will not try and make a connection with it. The first thing you need to do is decide what the connection will do and then write or obtain software to create the connection. Typically the embedded device will create a server socket and wait for a client (you computer) to connect to it. Telnet is an example of a client/server tcp connection.

    It is apparent from your post that you are unsure about what your embedded device is doing. You need to elaborate more about your embedded device and how it should function.