how to check packet flooding in bridging - testing

I am a newbie in networking and learned about bridging concepts .I have a device which functions as bridge which works in transparent mode and filter mode.In the latter mode , whenever the packet is received to Ethernet port (which is bind to bridge ports of bridge) it floods to other Ethernet ports except the received one through bridging, If the mac address is not learned .How can i ensure this ? can anyone suggest a method to test this.

Every Ethernet switch you can find is a bridge. It learns MAC addresses from ingress frames and uses this MAC table for efficient forwarding. In the unlikely event of an unknown destination address is mimicks a repeater and outputs the frame to all ports but the one it was received from.
If you connect several computers with a bridge/switch and run a packet capture on all of them you'll see that you won't see traffic between two computers on a third computer. Some - broadcast - traffic - will show up on all of them, e.g. when you start a connection and ARP is requesting the destination MAC address for the destination IP address.

Related

Is there a way to uniquely identify a specific usb port on a host device?

This question may be very broad but I'm trying to keep it platform agnostic.
If I connect a device to a USB port on a computer, is there a way for that device to uniquely identify the port it's connected to?
e.g. I have a PC with 10 USB ports. I have a smart phone that's programmed to run Function A if it's connected to Port 1 and Function B if it's connected to Port 2, etc...
Is there a way that the smartphone (the peripheral in this case) can identify the specific port on the host?
Is there a way it can identify the host device as a whole?
Basically, does the peripheral know anything about the host?
Is there a way that the smartphone (the peripheral in this case) can identify the specific port on the host?
No, only the host knows which port a device is connected to. They all look the same from the phones point of view.
Is there a way it can identify the host device as a whole?
Basically, does the peripheral know anything about the host?
Not with USB per se, but you could implement some identification in a higher protocol.
Look at later implementations of the android debugging protocol for example: The host sends an ID to the device, and unless it matches in the device database the user will be asked: "Do you want PC (ID) to be able to debug this device?"

What is the best way to send data to PC from "MCU + Wifi Module"?

I don't know anything about wireless protocols. With this quick setup i want to get inside. I just want to write a windows desktop application which receives only a couple of bytes of data from a mcu+wifi module "NodeMCU" which is connected to the same router. I can write a simple desktop app with visual studio. But sending data over ip has many methods as far as i read.
What is the simplest way to achieve? (I'm experienced in STM32 mcu's and electronics except internet protocols.)
You can send the data from the embedded board (with the mcu) to a TTL-To-WiFi module. Then from your PC application you should open a socket and connect to the module IP to listen in the correct port the data from your board.. There are a lot of module in the market used as "bridge" or converter: you have only to setup in it the local IP address, the destination IP (your PC) and the TCP port where you want to send data. From point of view of the board you use a standard USART and the message is sent to the destination IP. In your PC application you should be able to create a socket and connect it to the wi-fi module.

how to transmit serial data from GPS device to computer through IP?

Well..I have found some third party application regarding sending data from com port to IP. but I have not found any basic tutorial regarding them. so can anyone help me with this? I have a GPS device which I will connect to my laptop through usb to serial adapter.Now I need to send that data from a laptop to another laptop on same network. Can I use putty to view that data in another laptop(receiver)? Is virtual serial port driver meant for this kind of application?
If you do not want to write your own tool for it, you can simply use ncat and set up a daemon that reads piped data from one process and broadcasts it to all connected clients.
If you want something that reads the data from the serial port and then transmits it to clients, you'll need to write a server application that accepts connections and sends data around, but there's entire books on this. It should be easy to do for your purposes as written here, but it depends on the amount of control you need.
Alternatively you can use a virtual serial port application as you had mentioned, which might be the easiest route. The two devices will need to be on the same network unless the application supports TCP based virtualization instead of the common Ethernet based implementation.
This Python script works very well as a free "device server". Just enter the serial port configuration and the IP address and port information.
https://github.com/jaredly/pydbgp/blob/master/symbian/serial_tcp_redirect.py
This can work on both Windows and Linux.
You need pyserial.
You can always try using stand alone hardware such as the SENA LS100 device server.

How to detect all devices in a LAN?

I want to detect all devices in a LAN which have IP: 10.x.x.x Mask: 255.0.0.0.
I first wrote a synchronous ping program to ping IPs one by one, but it's tooooo slow.
Therefore I improved it by using asynchronous ping, then it's much faster.
Now I can use it to detect 10.x.0~255.0~255 in an acceptable time.
But it still use tooooooooooooo long time to detect all the IPs 10.0~255.0~255.0~255.
Is there any method/protocol that can just broadcast one message and let all devices in a LAN to respond, so I can detect all the devices?
(either Ethernet broadcast or UDP/IP broadcast or any other broadcast.)
(I've researched ARP & ICMP but haven't find suitable methods.)
Or any other method even don't need broadcast?
I just need to detect all the devices, any method is OK.
Not sure if it's what you are looking for but you can go in command prompt and run the command:
arp -a
I recommend "Angry IP Scanner" http://angryip.org/
It is fast, detects all devices in a given ip/netmask.
Angry IP scanner is a very fast IP address and port scanner.
From site:
It can scan IP addresses in any range as well as any their ports. It
is cross-platform and lightweight. Not requiring any installations, it
can be freely copied and used anywhere.
Angry IP scanner simply pings each IP address to check if it’s alive,
then optionally it is resolving its hostname, determines the MAC
address, scans ports, etc. The amount of gathered data about each host
can be extended with plugins.
It also has additional features, like NetBIOS information (computer
name, workgroup name, and currently logged in Windows user), favorite
IP address ranges, web server detection, customizable openers, etc.

UDP Hole punching unsuccessful, but tests show it should work (mobile network)

For the past two week I have been unsuccessfully trying to implement udp hole punching, but I'm not sure why. I understand that the algorithm for hole punching is not guaranteed to work, but I believe it should work in my test case because I have noticed that once I bind my socket on my home-network, the port is the same to the outside world as it is locally, and stays that way for all connections made from this socket. Any help after reviewing my trials would be appreciated.
I have three computers, my osx desktop, my iPhone, and my amazon ec2 ami.
on the desktop I've built a cocoa app which uses the GCDAsyncUDPSocket library to bind a port and contact the ec2 server, where a java app using apache's mina library stores the sockets external ip/port and associates it with a username passed in the payload.
the iphone, which is on the AT&T network runs an app which uses the same GCDAsyncUDPSocket library to contact the ec2 server with the same username, which then the ec2 does a lookup for the username, finds the desktops info and informs the desktop of the iphones address and the iphone of the desktops address.
now the iphone & the desktop know about each other they start shooting off packets at each other in hopes to get a punched hole.
in theory this should work, but maybe I am missing something about mobile networks that would make this difficult? But then again running a simple udp echoer on a 4th external computer to manually msg the desktop did not work either, so maybe its my router, but I don't see how that could be as all my tests show that the port the desktop asks for is the same one assigned by the router.
I've been at this for nearly two weeks with little progress and any tips would be appreciated!
"once I bind my socket on my home-network, the port is the same to the outside world as it is locally"
I highly doubt that. To traverse NAT given peers A and B which have sent datagrams to a 3rd party: S you need to send datagrams from A to B and vice versa using their public IPs as seen by S and their port as seen by S (i.e. not the port A, B are bound to from their point of view).