Generating a dynamic ARP Request in C? - networking

Having simulated a router, it's important that it should be able to generate an ARP Request and respond to the same. I do not understand how to begin implementing the same?
Are there an API's that exist in C that generate ARP Request.
Suppose I have a route lookup in my simulated router and I find out that, the route exists but there is no static ARP entry, the process should be able to generate an ARP Request.
Do I need a tap interface for this sort of functionality?

I believe to answer your question, knowledge of the environment is needed. What OS is your simulator running in? Unix, Linux, Windows, OS X? And you are developing router software for which hardware (or chipset or embedded software, real-time operating system?)
If you are simulating your hardware router software in an OS like windows, there are utilities and commands that you can have your sandboxed simulator environment issue that can be intercepted by your simulated router.
Bottom line, a little more knowledge of the environment of your simulator might help! Good luck :)

Related

Serial COM port data over WebRTC

I'm currently looking at options to allow me to build a remote COM-port solution.
The idea is to be able to access from my remote PC, another PC that's directly connected to a device locally via its serial COM-port.
I know that the obivous answer is to use a VPN between the 2 Internet connected PCs.
However, I need this solution to be as seamless to the end-user as possible.
i.e. no installing and configuring VPN software, etc.
So I was thinking that WebRTC would be great because the end-user can simply use their web-browser and not have to install any additional software.
My question is, is it possible to stream the COM port data between the 2 PCs via WebRTC?
If so, can you please point me in the right direction as to how I can go about achieving this?
Sorry if this is a ridiculous question, I'm very new to WebRTC, just exploring my options.
Thanks.
That should work great!
Networking wise you get NAT Traversal. That means the two computers can be in completely different networks, and still communicate. You may have to run a TURN server if P2P isn't possible.
Data wise you can exchange anything you want via data channels. It is datagram based and you can send/receive binary data. You get a callback telling you how much has been delivered, that way you can detect backpressure.
Are you ok with installing software on the remote host? You can do something like Pion WebRTC's data-channels. This shows you can have a browser connect to a Go process via WebRTC. Then use tarm/serial on the remote host to interact with the device.
If you want a browser on both ends there is the Web Serial API I haven't used it myself though. That locks you into only doing Chromium which might be an issue.

Implementing VPN in an embedded system using LwIP

I've been asked to implement VPN capabilities in an existing software project on an embedded system, in order to make the device available via network to an external server while avoiding trouble with firewalls (no need for encryption, just to make it accessible).
Unfortunately, the embedded system is based on a Cortex-M4 MCU, therefore Linux, which would allow for VPN nearly out of the box, is not an option. All I've got is an RTOS and a working LwIP stack.
I've used VPNs in the past. However, my network knowledge is rather limited concerning implementing VPNs, so I'm rather stumped. As I think, I'd use the current LwIP instance for building up the tunnel connection, and the application would use a second instance for the actual network communication, while the network interface of the second instance is a virtual one (like a tap device on linux), encapsulating its low level data and tranceiving it via the tunnel connection of the first LwIP instance.
Maybe this way I'd be able to create a custom solution for the problem, but the solution should conform to any standards (as the server will be any kind of sophisticated system).
So I wonder if anyone has been confronted with a task like this, and would appreciate any hint what to do, at least a direction where to look at.
Thanks in advance!

Connecting two machines wirelessly without router or ad-hoc network

I have been struggling to find a definitive way to be able to connect my two computers wirelessly without a router and without setting up an ad-hoc network. I really hoped it would be as simple as changing my network adapter settings to have static IPs, say 192.168.5.10 on the first machine and then 192.168.5.11 on the other machine. But unfortunately, I can't even see these IPs on the output of ipconfig (or ifconfig). I have been researching this for quite a bit and no success yet... Any guidance would be greatly appreciated!!
Check WiFi-direct - it's designed for your use case. However, currently it's only supported by mobile devices (Android or iOS).
On desktop, maybe you could install an app and make one machine itself behave as a router, and let the other one connect to it. But I guess this solution doesn't solve your problem since it's no better than ad hoc mode.
The last solution I would suggest is a little painful: record MAC addresses of both machines, and generate the MAC frame by yourself somehow. This requires interception into the WiFi driver.

is it possible to limit the network traffic from my PC to my PC?

Hi Guys I'm debugging some CS program and to view the performance of the application in slow internet I tried many different ways. However the best would be the Server and the client be in the same PC ---- my debugging environments for both the server side and the client is setup in one PC.
So I'm wondering is there anyway to limit the speed? I'm using TCP but I don't know too much in-depth knowledge of it.
Thank you
There are two important factors regarding a "slow" internet connection that you need to test out since they have different implications for your application: bandwidth and latency.
If you provide some more details about what os you are running your tests on, it would be easier to recommend a way to limit the network performance.
On a related side note, it's generally a bad idea to performance test any kind of networking using the loopback device on your machine, since many aspects of this will perform very different than the regular network device on your machine.
You mention in the comments this needs to be done on windows, while the Network Emulators I know of (e.g. netem, TCN, other variants) all require Linux. So one thing you could do is create a virtual machine (VirtualBox is fine, I did similar things with it), install linux on it, configure 2 network interfaces, emulate the slow/long/lossy/jittery network between them, and route the test traffic through it from windows.
Finally I found this does what I need.
http://www.nirsoft.net/utils/socket_sniffer.html
Captures Windows Socket traffic, no matter it's local or not.

Router to handle multiple public IP addresses

I am presently running several websites and a mail server from my home network. I have a business DSL account with 8 public IP addresses (1 by itself, and 7 in a block). To handle routing/firewall/gateway, I am presently using RRAS, DNS, & DHCP from Windows 2003 running on a ancient (circa 2001) PC -- which I suspect is going to fail any time now.
What I would like to do is replace that with a simple router. Have a consumer model LinkSys Wifi-router, which I'm presently just using as an access point (don't have the model number handy, but it's one of their standard models). It seems to be able to handle all the NAT/firewall/DHCP tasks -- except for handling routing the multiple public addresses. (e.g., I need x.x.x.123, port 21 getting to one machine, but port 80 of x.x.x.123 & x.x.x.124 to going to another, and x.x.x.123, port 5000 to still another etc).
So my questions are:
Can this be done with standard Linksys router, which they just don't explain in the consumer manual?
Can this be done ... if I replace the firmware with a community/OS version (and if so, which one?)
If neither of the above, can someone recommend a profession router (preferably with wifi) that does do this, which is close to a consumer level price point.
Alternately, is there a reliable OS/3rd party replacement to RRAS which handles this (since RRAS is the part causing the most trouble)
Alternate-Alternately, can someone point to a VERY simple HOWTO to doing this (ie. follow these steps and forget about it), to installing a LINUX system to do this) (since I assume I can run Linux longer on the old machine)?
This can't be done on a Linksys router with stock firmware. It can be done if you load a third-party firmware, but there's no GUI (afaik) to accomplish it, so you'll be hacking system shell scripts which is pretty hairy. I would recommend getting a low-power or older PC and installing PFSense.
PFSense is an open-source router appliance OS distribution with a very easy to use web front end.
Install DD-wrt On your linksys box. I believe this will have everything you need link text

Resources