Author Topic: UDP recieveing and transmitting  (Read 2014 times)

0 Members and 1 Guest are viewing this topic.

Offline csheldonTopic starter

  • Contributor
  • Posts: 46
UDP recieveing and transmitting
« on: July 03, 2018, 01:29:06 pm »
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?
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6460
  • Country: nl
Re: UDP recieveing and transmitting
« Reply #1 on: July 03, 2018, 01:34:54 pm »
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.
« Last Edit: July 03, 2018, 01:40:19 pm by Kjelt »
 

Offline csheldonTopic starter

  • Contributor
  • Posts: 46
Re: UDP recieveing and transmitting
« Reply #2 on: July 03, 2018, 02:27:07 pm »
what if i want to use PC without router?
 

Offline agehall

  • Frequent Contributor
  • **
  • Posts: 383
  • Country: se
Re: UDP recieveing and transmitting
« Reply #3 on: July 03, 2018, 02:43:27 pm »
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.
 

Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: UDP recieveing and transmitting
« Reply #4 on: July 03, 2018, 03:06:24 pm »
Ethernet Crossover cable, PC and WireShark.

Or 2 Ethernet Cables, cheap switch, PC and WireShark
 

Online ajb

  • Super Contributor
  • ***
  • Posts: 2599
  • Country: us
Re: UDP recieveing and transmitting
« Reply #5 on: July 03, 2018, 04:35:44 pm »
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.
 
The following users thanked this post: TomS_

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26891
  • Country: nl
    • NCT Developments
Re: UDP recieveing and transmitting
« Reply #6 on: July 03, 2018, 04:57:06 pm »
A simpler solution is to get a 100Mbit/s hub from Ebay. Unlike a switch a hub replicates all traffic on all ports.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: UDP recieveing and transmitting
« Reply #7 on: July 03, 2018, 05:08:37 pm »
A cheap switch won't do the job if the traffic of interest is unicast.
a cheap switch probably isn't a switch.  :)

Not in a Layer 3 sense.

PS
GS108E looks nice for the $
« Last Edit: July 03, 2018, 05:47:06 pm by NivagSwerdna »
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6460
  • Country: nl
Re: UDP recieveing and transmitting
« Reply #8 on: July 03, 2018, 05:18:01 pm »
A simpler solution is to get a 100Mbit/s hub from Ebay. Unlike a switch a hub replicates all traffic on all ports.
But you are limited to 100Mbps
With the named €35 managed switch you can also use it for your other network monitoring which can be quite handy from time to time.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: UDP recieveing and transmitting
« Reply #9 on: July 03, 2018, 08:17:05 pm »
A simpler solution is to get a 100Mbit/s hub from Ebay. Unlike a switch a hub replicates all traffic on all ports.

Yup!  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...
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6460
  • Country: nl
Re: UDP recieveing and transmitting
« Reply #10 on: July 03, 2018, 09:20:57 pm »
Note:  A switch won't work...
A 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.
 

Offline TomS_

  • Frequent Contributor
  • **
  • Posts: 834
  • Country: gb
Re: UDP recieveing and transmitting
« Reply #11 on: July 06, 2018, 01:20:07 pm »
a cheap switch probably isn't a switch.  :)

Not in a Layer 3 sense.

Actually, 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.
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Re: UDP recieveing and transmitting
« Reply #12 on: July 06, 2018, 10:01:03 pm »
A simpler solution is to get a 100Mbit/s hub from Ebay. Unlike a switch a hub replicates all traffic on all ports.

Which 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.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: UDP recieveing and transmitting
« Reply #13 on: July 07, 2018, 03:04:06 am »
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.

Quote
A simpler solution is to get a 100Mbit/s hub from Ebay.
You 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.

 

Offline chickenHeadKnob

  • Super Contributor
  • ***
  • Posts: 1055
  • Country: ca
Re: UDP recieveing and transmitting
« Reply #14 on: July 07, 2018, 05:36:41 am »
Along time ago, before utube fame, Great Scott put 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
« Last Edit: July 07, 2018, 10:16:38 am by chickenHeadKnob »
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6460
  • Country: nl
Re: UDP recieveing and transmitting
« Reply #15 on: July 07, 2018, 06:46:55 am »
Along time ago,  before utube fame, Great Scott put his 100T passive tap circuit "throwing star" board  on OSHPARK as open hardware. He now also sells it here:
https://greatscottgadgets.com/throwingstar/
Yes 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.
 

Offline chickenHeadKnob

  • Super Contributor
  • ***
  • Posts: 1055
  • Country: ca
Re: UDP recieveing and transmitting
« Reply #16 on: July 07, 2018, 10:19:27 am »
Yes 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.

To get both directions you need two monitoring ports, not very convenient, but completely undetectable to the intercepted stream.
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6460
  • Country: nl
Re: UDP recieveing and transmitting
« Reply #17 on: July 07, 2018, 05:32:11 pm »
Yes 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.

To get both directions you need two monitoring ports, not very convenient, but completely undetectable to the intercepted stream.
Undetectable? A 1Gbps will be downconverted in negotiations due to the tap to 100Mbps , pretty detectable AFAIK.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf