Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What's the difference between these two tools?

Can anybody tell me what the main workflow of networking behind Linux (in relation to IPv4 packet filtering, NAT and IP routing table) is?

share|improve this question
up vote 15 down vote accepted

route is a command that displays, adds and deletes entries from the kernel's TCP/IP routing table (aka "Forwarding Information Base").

iptables is a command that displays, adds, and deletes entries from Netfilter, the Linux kernel's packet filtering and manipulating subsystem. It handles NAT.

Since IP forwarding, i.e. routing, is basically rewriting a packet with a different source address and shipping it out of a different network interface, I believe you could technically do static routing with the proper iptables rules in the mangle table, but I believe it's generally fastest to let the routing part of the kernel do that.

There are many diagrams that are out there that illustrate exactly how a TCP/IP packet traverses the kernel (including Netfilter and the routing facility) - an example is this: http://www.adminsehow.com/2011/09/iptables-packet-traverse-map/

share|improve this answer
1  
That map is great. – Jacob Margason Feb 2 at 20:54
    
does the "TCP/IP routing table" of route also in/belone the iptables's table ? – lovespring Mar 10 at 0:43
    
I haven't tried it but I think you can compile the kernel with Netfilter disabled, yet forwarding will still work if it's enabled. So I believe Netfilter and the routing facility are separate. – LawrenceC Mar 10 at 0:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .