This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

TCP/IP Stack with router

Hello,

I am looking to turn my LPC2468 into a router. It seems that the RL-ARM TCPnet doesn't have any functionality to support this. Does anyone know of either an open-source solution or a product that supports this?

Any thoughts on this would be really appreciated!

Thanks!
Eric

Parents Reply Children
  • So is it correct that I need to add NAT to lwip in order to do this?

    I thought NAT was already available. It appears, I was mistaken:
    savannah.nongnu.org/.../

    You can always implement it yourself, of course. But it will be a challenge if you are a newcomer to TCP/IP. Well, integrating lwip into your application is a challenge in itself.

  • NAT is _one_ way of having multiple machines share a connection.

    But it is the most common method, since it is quite easy to have a router filter all traffic and replace the source IP number before sending out data on the public interface.

    Remember that your modem only get one IP number and the first issue is that if a local machine tries to reach another machine out somewhere in the world, that machine somewhere far away must know where to send back any response. So a NAT:ing router replaces the source IP of the local machine with the IP it got on the public (WAN) interface before sending out data.

    And when answers comes back, it has a table of ongoing NAT:ed connections, so it can figure out which of multiple local machines that should get the answer. So with the received data, the destination IP gets replaced from the public IP of the modem to the IP of the local machine.

    An alternative method - at least when just trying to reach foreign web pages - is to instead have a small proxy program. The difference is that the web browser must know about the existence of the proxy. It makes a connect specifically to the IP of the proxy machine, and sends data telling which IP and what connect the proxy machine should to to talk with machines out in the world. But the proxy solution requires that your local PC machines must know about the proxy. And it only works for protocols that both the PC and the proxy have proxy support for.

    A PC game that expects that it should be able to send UDP data directly to a game server somewhere will not manage to go through a proxy.

    Note that most cellular subscriptions don't give you a fixed IP number that may be connected to from the outside. So local machines can (using NAT or proxy) connect to external machines and send data and get answers back. But external machines will normally not be able to connect to your modem, allowing your router to send data to a mail or web server hosted behind the router. If you need support for incomming connections (that needs to be destination-NAT:ed or similar to the relevalt local server) then you must check specifically what operator and subscription to use.

  • Without NAT support in the stack, it will probably be easier for a TCP/IP beginner to write a proxy. But that will limit support to specific protocols, and to PC applications that supports the use of a proxy.

    A proxy is easier to implement, since it is a man-in-the-middle. A server program run in the router that accepts connections from the PC, reads info in the message what to do and then create a new, outgoing connection to some machine on the WAN. If the local machines have 5 connections to the proxy, then the proxy will have 5 connections to the outside world. So when answers arrives back, it will have a one-to-one association between local and external connection and just being able to take bytes from one connection and forward to the other connection in the local/external connection pair.

  • Wow, thank you, Per. This is very helpful information!

    I like your idea of a proxy. I think I may do this until I can learn enough to get NAT to work.