Using ethernet connection for two completely different purposes - ethernet

I have a Dell desktop machine with one ethernet port and one NIC.
I need to use ethernet connection for two completely different purposes.
One is to get internet access via LAN and read more stackoverflow.
The other is to talk to my FPGA eval board and send/receive data
using ethernet.
Is having two NICs a good option, a splitter box externally connected or any other solutions for this kinds of usecases?
(I do not want to mess or change the configurations everytime I switch between internet to eval board with just one ethernet port on the system.(I am doing it currently))

Yes, that is no problem.
The one you connect to internet typically use DHCP.
The other set it to static IP address with another subnet than the first one.
The FPGA also use static IP address.

Related

How to connect two ABB plcs with cp635 HMI?

I want to connect two PLCs ABB PM592 with HMI CP635 via ethernet? I will assign the same ip addresses to both plcs and will connect the ethernet port of each plc with ethernet port of HMI. Will it work?
Will the both ethernet ports of CP635 HMI can work on same ip addresses? Because if I assign different IPs to each plc then i will also have to import tags for each ip with different name but we can assign single tag to one object in HMI design.
Waiting for reply
TIA :)
The PLCs will need seperate IP addresses
The solution is to run two protocols.
To save having to retype all tags, how can export to xml file then import to the new protocol. panel builder 600 will automatically rename by appending a number to the duplicate tags.

Is there an ethernet link layer protocol to get remote IPv4 settings?

Given one or more embedded devices of the same type with some unknown IPv4 addresses or maybe no IPv4 addresses set at all: is there any Ethernet based network protocol to ”find“ those devices in the local net (LAN) from remote (PC) and get their IPv4 settings?
What not works for me:
ARP: IP address must be known or only finds device I communicated with before (or ugly ARP floods …)
LLDP: point to point only (?), so I would only see the switch between device and me. Also, just announces, no response on request (because there are no requests). Further: asking the switch (which supports LLDP) through SNMP is no option when using dumb switches
IP based protocols: I played with UDP and broadcasts (both as request and response), but that does not work reliably if device and me are on different subnets, and it does not work at all if device has no IPv4 set.
DHCP: does not work in networks without DHCP server, maybe no DHCP client on the embedded device
I assume others had the same problem before, take manufactures of network equipment like access points which should be configured remotely, powerline adapters, switches … all those where the vendor gives you some proprietary tool, the device shows up like magic in a list and you can assign some IPv4 then.
Of course the device must have some daemon listening and responding to certain requests, but what would be a standard protocol for such a task? Or do I have to make up some new protocol for that? May some of the above mentioned is possible, but I overlooked something?
Ethernet only provides a layer 2 connection, so anything Ethernet-based can't ever work across a router (ARP, LLDP - LLDP doesn't even cross a decent switch as it's link layer only).
Depending on the network, routed multicasts or directed broadcasts could work - normally they don't. All vendor tools I've seen just use (Ethernet) broadcasts and don't work across routers.
Most often, simple DNS is used for this purpose - the device registers with the DNS server or is preregistered and you just resolve the name.
Edit: without the router problem, the simplest way is to use a UDP broadcast to some unused port. With DHCP unavailable, the device could fall back to zeroconf (169.254.0.0/16) and broadcast from there.
Without IP, you'd need a "raw" Ethernet socket and use an Ethertype that doesn't interfere with normal network operations.

socket connection between raspberry pi and android app using cellular network,NOT a localor wifi network

Is there a way to use socket connection between raspberry pi 3 and android app using cellular network,NOT a localor wifi network ?
Theoretically, yes absolutely - so long as each device has an IP network connection you can open a socket between them.
In practice, however, you may find you have two issues:
getting 'external' IP addresses
ensuring that your stream is allowed on your target networks
By external IP addresses, I mean ones that are globally recognised and not just on a local or private network. Most local networks and operator mobile networks use private addressing internally and some sort of NAT (Network Address Translation) function to map these internal addresses to external addresses.
Unless you have a fixed IP address, which is not the norm, you will have to discover what IP address your deice appears on externally and then share that with the other device to allow the socket to be set up. This may change every time you connect to the network, or even more frequently, depending own how the network is set up. Techniques and protocols do exist to do this, such as STUN: https://en.wikipedia.org/wiki/STUN
Assuming you can get the end point addresses in a form that allows them communicate with each other, you will also need to check that your operator, and any local network policies or firewalls you have, allow the type of traffic you want to use. Cellular network operators sometimes block certain traffic types, either for security or to try to stop services which they see as competing with their own services.

Send values over wifi via Matlab

I need to send int and double values from one computer to another. The two pc's are connected to the same wireless network and the values I get are generated by a Matlab code. Can this be done in Matlab or do I need to use a medium between the two?
Sending data over WiFi is basically the same as sending it over any network. You'll need the other computer's local IP address (various ways to find this on different operating systems, ask google). You don't want to use an external IP address like this, since this would usually require you to change some settings on your router (e.g. port forwarding).
Once you have a local IP address, you could use something like Sockets - Loren has a good blog post.

Coordinating peer-to-peer messages using multicast, how to get receiving IP?

I have been working on a local LAN service which uses a multicast port to coordinate several machines. Each machine listens on the multicast port for instructions, and when a certain instruction is received, will send messages directly to other machines.
In other words the multicast port is used to coordinate peer-to-peer UDP messaging.
In practice this works quite well but there is a lingering issue related to correctly setting up these peer-to-peer transmissions. Basically, each machine needs to announce on the multicast port its own IP address, so that other machines know where to send messages when they wish to start a P2P transmission.
I realize that in general the idea of identifying the local IP is not necessarily sensible, but I don't see any other way-- the local receiving IP must be announced one way or another. At least I am not working on the internet, so in general I won't need to worry about NATs, just need to identify the local LAN IP. (No more than 1 hop for the multicast packets is allowed.)
I wanted to, if possible, determine the IP passively, i.e., without sending any messages.
I have been using code that calls getifaddrs(), which returns a linked list of NICs on the machine, and I scan this list for non-zero IP addresses and choose the first one.
In general this has worked okay, but we have had issues where for example a machine with both a wired and wifi connection are active, it will identify the wrong one, and the only work-around we found was to turn off the wifi.
Now, I imagine that a more reliable solution would be to send a message to the multicast telling other machines to report back with the source address of the message; that might allow to identify which IP is actually visible to the other machines on the net. Alternatively maybe even just looking at the multicast loopback message would work.
What do you think, are there any passive solutions to identify which address to use? If not, what's the best active solution?
I'm using POSIX socket API from C. Must work on Linux, OS X, Windows. (For Windows I have been using GetAdapterAddresses().)
Your question about how to get the address so you can advertise it right is looking at it from the wrong side. It's a losing proposition to try to guess what your address is. Better for the other side to detect it itself.
When a listening machine receives a message, it is probably doing do using recvfrom(2). The fifth argument is a buffer into which the kernel will store the address of the peer, if the underlying protocol offers it. Since you are using IP/UDP, the buffer should get filled in with a sockaddr_in showing the IP address of the sender.
I'd use the address on the interface I use to send the announcement multicast message -- on the wired interface announce the wired address and on the wireless interface announce the wireless address.
When all the receivers live on the wired side, they will never see the message on the wireless network.
When there is a bridge between the wired and the wireless network, add a second step in discovery for round-trip time estimation, and include a unique host ID in the announcement packet, so multiple routes to the same host can be detected and the best one chosen.
Also, it may be a good idea to add a configuration option to limit the service to certain interfaces.