Is there an asm example?
Posted on 2003-12-09 13:30:05 by quaze
BTW how the router know which packet send to which computer ??

is there any non asm implementation out there ???
Posted on 2003-12-09 14:08:12 by AceEmbler
BTW how the router know which packet send to which computer ??


Performing NAT is all about keeping track of the senders and receivers of the packets, by analyzing the IP headers of the packets.
The router will have an internal table that keeps track of which connections belong to which internal PC.
This works, as long as the internal PC starts the connection... It sends a packet to the router, the router stores gets the internal IP from the source address of the packet, adds it to the table, replaces it with the external IP, and sends the packet to its destination.
When a packet from the same destination is received, it will find the internal IP in the table, replace the destination address in the packet with it, and sends it to the internal PC.
If you want connections initiated from the outside to be redirected to internal PCs, you will need to use portmapping, which will statically put the internal IPs in the table for those ports, basically.

is there any non asm implementation out there ???


See linux, FreeBSD, OpenBSD, NetBSD or similar, for free sourcecodes for routers, NAT, firewall, etc.
Posted on 2003-12-09 17:47:38 by Bruce-li
don't get me wrong Bruce-li but in my point of view the problem is not with it you so good described.

You are right but IMO half-right.(you said something about portmapping- could you explain it?)

what will happens when you are behind NAT/Router and want to build a server but your ip is internal...(not public )
does anyone know how to connect with your server from outside??????




if somebody send you packets with your routers address ,the router doesn't resend them to your local server because the packets are addressed for the router.

if somebody wants to connect with your server by local(internal) IP from the outside, the router get it out because of wrong addressing from the public side(the external host shouldn't be know about internal host's IP).


As you see the problem is not trivia....
sometimes multi-encapsulating works ok (IP packet addressed to router includes IP packet with internal destination address) but IMHO it only works for UDP


Merry Christmas
and a Happy New Year

Posted on 2003-12-23 03:22:16 by HarryTuttle
To connect to a server running on a NATed box, the router needs to do port forwarding - simple as that. If you don't have admin access to your router, there isn't really anything you can do.

Of course there's schemes around this, like "connect-back" - but that's not a general solution, and is mostly used for stuff like shellcode, trojans and remote administration software.
Posted on 2003-12-23 05:29:03 by f0dder
how exactly does connect-back work though?
Posted on 2003-12-23 11:32:40 by quaze
By connecting outwards to a specific IP+port, either as the result of an exploit (buffer overflow, whatever) or by periodically trying to connect to IP+port. Both methods are used when the target computer is behind firewall/NAT, and you thus cannot bind to arbitrary ports.

While exploits are bad, the periodical polling CAN be of legit use, but still sucks :)
Posted on 2003-12-23 15:02:44 by f0dder