UDP recieveing and transmitting - Page 1
Forum section: electronics / general

author: csheldon
author_rank: Contributor
timestamp: July 03, 2018, 01:29:06 pm
content: Hello all,I have ethernet PHY and MAC onboard on some 32-bit mcu board. I have UDP trasnmit example code.How can i sniff and see what the board is transmitting. what cables do i need. do i need to connect it to router or can it be directly connected with PC?

author: Kjelt
author_rank: Super Contributor
timestamp: July 03, 2018, 01:34:54 pm
content: easiest is to use a cheap network switch with port forwarding / port mirroring that sends all ip traffic from all ports to one dedicated mirror port.You connect the pc to that mirror port and run wireshark and you can see everything that is happening on the network.Those switches can be had from around EUR 35 .- (Netgear Prosafe Gigabit Plus GS105E be sure to have E version this is managed)That way you can monitor traffic between two devices to check if everything is going ok.If you don't want to go there, you can use a UDP broadcast that will be forwarded also to all ports IIRC and should also be seen on the PC.Or give as target the PC that should also work.

author: csheldon
author_rank: Contributor
timestamp: July 03, 2018, 02:27:07 pm
content: what if i want to use PC without router?

author: agehall
author_rank: Frequent Contributor
timestamp: July 03, 2018, 02:43:27 pm
content: Hook up your contraption to a NIC on the PC and let the PC do the switching/routing. Depending on what OS you use, this ranges from trivial to I-would-recommend-doing-something-else difficulty.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: July 03, 2018, 03:06:24 pm
content: Ethernet Crossover cable, PC and WireShark.Or 2 Ethernet Cables, cheap switch, PC and WireShark

author: ajb
author_rank: Super Contributor
timestamp: July 03, 2018, 04:35:44 pm
content: A cheap switch won't do the job if the traffic of interest is unicast. In that case you want a switch that can be configured to mirror all traffic to a specified port, which generally means you want a slightly more expensive managed switch. I have a GS108E on my bench for this purpose, which is the 8-port version of the switch Kjelt recommended. Alternatively, you could use a hub--if you can find one, that is.Crossover cables are not usually required these days--even 100Mb phys usually support auto MDIX. So you can usually just plug the device straight into your PC if you've got an ethernet port available. If not, USB-ethernet adapters are fairly inexpensive, as are PCIe NICs.

author: nctnico
author_rank: Super Contributor
timestamp: July 03, 2018, 04:57:06 pm
content: A simpler solution is to get a 100Mbit/s hub from Ebay. Unlike a switch a hub replicates all traffic on all ports.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: July 03, 2018, 05:08:37 pm
content: Quote from: ajb on July 03, 2018, 04:35:44 pma cheap switch probably isn't a switch.Not in a Layer 3 sense.PSGS108E looks nice for the $

author: Kjelt
author_rank: Super Contributor
timestamp: July 03, 2018, 05:18:01 pm
content: Quote from: nctnico on July 03, 2018, 04:57:06 pmBut you are limited to 100MbpsWith the named €35 managed switch you can also use it for your other network monitoring which can be quite handy from time to time.

author: rstofer
author_rank: Super Contributor
timestamp: July 03, 2018, 08:17:05 pm
content: Quote from: nctnico on July 03, 2018, 04:57:06 pmYup! Connect the two data streams to two ports and connect a PC with Wireshark to the third port. Wireshark will trap and filter all traffic.Amazon has a bunch of hubs.Note: A switch won't work...

author: Kjelt
author_rank: Super Contributor
timestamp: July 03, 2018, 09:20:57 pm
content: Quote from: rstofer on July 03, 2018, 08:17:05 pmA cheap managed switch with port mirroring works perfectly.A non managed switch does not have this facility and can not be used for this purpose.

author: TomS_
author_rank: Frequent Contributor
timestamp: July 06, 2018, 01:20:07 pm
content: Quote from: NivagSwerdna on July 03, 2018, 05:08:37 pmActually, a cheap switch probably is a switch - but it will be nothing else.Yes, there are things called "layer 3 switches", but when you start talking layer 3, you stop talking about switches.

author: rhb
author_rank: Super Contributor
timestamp: July 06, 2018, 10:01:03 pm
content: Quote from: nctnico on July 03, 2018, 04:57:06 pmWhich is precisely why I have kept my old hubs. Sometimes they are the best answer.An RPi or similar setup as a router will also do a good job. However, a good bit more work than plugging in a hub and turning on a network monitoring program.

author: westfw
author_rank: Super Contributor
timestamp: July 07, 2018, 03:04:06 am
content: If you just want to see the packets that your thing is transmitting, you can plug an ethernet cable into it, connect to a port on a PC, and use wireshark (as others have mentioned.) If you need to eavesdrop on communications between your thing and some other thing, THAT'S when you start to need fancier equipment.QuoteYou can get 100M hubs, that aren't switches? I thought actual hubs died back in the 10Mbps days, and were essentially unobtainium ever since silicon vendors put the whole "switch" functionality on a chip.Can you point to specific products? I've been depressed thinking that I need to invest in a managed switch.

author: chickenHeadKnob
author_rank: Super Contributor
timestamp: July 07, 2018, 05:36:41 am
content: Along time ago,before utube fame, Great Scottput his 100T passive tap circuit "throwing star" board on OSHPARK as open hardware. He now also sells it here:https://greatscottgadgets.com/throwingstar/edit: bloody confusing, great scott gadgets is Michael Ossmann, I don't think he is connected to the youtube personality

author: Kjelt
author_rank: Super Contributor
timestamp: July 07, 2018, 06:46:55 am
content: Quote from: chickenHeadKnob on July 07, 2018, 05:36:41 amYes got them too but you can only "see" one direction, so only c->s or s->c not both, so if you want to monitor a protocol between c and s its useless.Buy the managed switch for €35 and you're done.

author: chickenHeadKnob
author_rank: Super Contributor
timestamp: July 07, 2018, 10:19:27 am
content: Quote from: Kjelt on July 07, 2018, 06:46:55 amTo get both directions you need two monitoring ports, not very convenient, but completely undetectable to the intercepted stream.

author: Kjelt
author_rank: Super Contributor
timestamp: July 07, 2018, 05:32:11 pm
content: Quote from: chickenHeadKnob on July 07, 2018, 10:19:27 amUndetectable? A 1Gbps will be downconverted in negotiations due to the tap to 100Mbps , pretty detectable AFAIK.