jQuery in Action, 2nd edition*
The moose likes Sockets and Internet Protocols and the fly likes something i don't understand in my routing table (simple question) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "something i don Watch "something i don New topic
Author

something i don't understand in my routing table (simple question)

mikey strauss
Greenhorn

Joined: Nov 02, 2009
Posts: 19
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.0.0.221 10.0.0.201 3
10.0.0.0 255.255.255.0 10.0.0.201 10.0.0.201 3
10.0.0.201 255.255.255.255 127.0.0.1 127.0.0.1 3
10.255.255.255 255.255.255.255 10.0.0.201 10.0.0.201 3
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
224.0.0.0 240.0.0.0 10.0.0.201 10.0.0.201 3
255.255.255.255 255.255.255.255 10.0.0.201 10.0.0.201 1
Default Gateway: 10.0.0.221

well when i send a packet with let's say 10.0.0.32/24 it well go to the second line in the table
so it sould be sent to the gateway 10.0.0.201 is't that my computer? what does it mean?
maybe it means th connection my router has with my computer then way would the defalt be to 10.0.0.221??
please help me .........................
maybe i don't understand what exactly gateway is (the ip number of the router that connects me to a other network)




Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

Hi Mikey,

a gateway can be a router. But it can simply be a network interface as in this case. The gateway for the network 10.0.0.0/24 has the IP address 10.0.0.201 which is the address of an interface (physical or virtual) directly located at this machine, right? So packets for this network are sent to the gateway 10.0.0.201 which is not a distant router but instead the entry point to this net from this local machine! And this gateway in turn has to decide what to do with these packets, for example just release them to a ethernet segment, maybe do some address rewriting before or send the packets via a VPN to a remote gateway etc.

As a side note: because the machine is directly connected to the 10.0.0.0/24 network there is no need to use the default gateway 10.0.0.221. The machine can directly access this network and therefore it doesn't use the default gateway!

I hope this helped to explain what you see in your routing table

Marco
mikey strauss
Greenhorn

Joined: Nov 02, 2009
Posts: 19
ok that was a lot of help thanks
the local packet is not going to a diffrent network so the gateway is on the network card of this
computer but a packets that is for the internet the gateway is on the router connection with the isp???
write the local packet goes through the router but not really through the table this Straight to the enthrnet connection to the
other computer???
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

Basically the routing process works (simplified) as follows:

- A host receives some IP packet and decides, based on the destination IP, if it should process this packed. The machine feels responsible for a packet if a) the destination IP belongs to the machine itself or b) the machine is configured to operate as a router.

- The machine looks at its routing table (usually from top to bottom) in the destination (= first) column for any network or host destination address which matches the destination address of the packet. In this case it will first notice a packet for destination network 10.0.0.0/24 and find in the 2nd line of the routing table that this packet has to be sent to the gateway 10.0.0.201 which is a network interface on the machine, that is the machine will consume the packet itself.

- Now imagine the machine can't find a matching destination net/host in its routing table. It will still process the routing table from top to bottom until it finally reaches the entry for the default gateway (which is a distant remote destination or say your typical internet router). If there is a default gateway in this table the machine will simply send all packets for which it can't find any other (local) destination to this default gateway.

- The default gateway in turn will do exactly the same. It looks in its routing table if there is a destination for the packet in question. If it finds one, it will send the packet to this destination network/host. This can be another LAN directly attached to your default gateway. If your (home) default gateway can't find a matching entry in its routing table it will do the same as the machine before: it will in turn send any packet which doesn't match any destination to its own default gateway (if configured). And the default gateway of your home router is typically a destination at your provider's site!

That's how all network packets which don't belong to any of your local machines or networks usually end up in the internet! It's more or less no explicit routing but rather a fallback with the default gateways.

An additional note: You can try this and remove the default gateway (it isn't required). If there is no matching, explicit routing destination and the packet would end up at the default gateway, you will get a "no route found" error or similar.

Marco
mikey strauss
Greenhorn

Joined: Nov 02, 2009
Posts: 19
thank you that help alot very clear thank's

one more question....
is the default gateway 10.0.0.221 the ip number of my router or the NAT address it gave my computer to
know it by?
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

You're welcome

10.0.0.221 is the IP address of the interface of your router. It is directly connected to your LAN with this address and therefore can be reached by your other machines through the LAN.

NATting as nothing to do with it. NAT comes into play when the router sends packets from the insided (= LAN) to the outside (= internet). I then modifies all packets an replaces the source IP addresses (which are the ones from you LAN machines) with its own public internet IP address. This is needed because otherwise you wouldn't get a single response for any packet because target machines on the internet wouldn't know how to reach LAN addresses from you home network. But they do know how to reach the public address of your router because the sender IP is, well, public. That's what NAT is for!

Marco
 
Consider Paul's rocket mass heater.
 
subject: something i don't understand in my routing table (simple question)