Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know some of you may have CCNA / networking experience, so I hope that you can answer the following question for me.

How does an industry standard router handle local IP's, with two connected networks, with a single routing table?

I.e if a host on connected network 1 sends a packet with destination IP 192.168.0.4, what line in the routers routing table deals with this request, or is this all handled by the switches and host (arp) tables within the network. Does the router just ignore it?

Thanks!

share|improve this question
1  
Either I misread or you are asking the wrong question. If "both networks were using a 192.168.0.0/24" address range as you write, then there would not be two networks but only one, thus nothing to route. –  bytesum Apr 9 '12 at 20:41
    
Please don't cross-post questions on multiple Stack Exchange sites. Choose which site your question is most appropriate for, and ask it there. –  nhinkle Apr 9 '12 at 20:52
add comment

5 Answers

up vote 1 down vote accepted

I remember the theory, you'd have a line for each subnet. and each port/interface of the router corresponds to a subnet. infact each port has an IP on its subnet.

the router has one routing table, with each row for each subnet. and each associated port/interface.

a row of the routing table might say 192.168.0.0/24 (i.e. it includes 192.168.0.4) and there's an interface 192.168.0.1 and the interface may be called Eth0

Any packet sent to the router, whichever port it comes in on, if it has an IP on 192.168.0.0/24 will end up going out on Eth0.

The router looks at the destination ip of the incoming packet sees it 192.168.0.4 sees that is on subnet 192.168.0.0/24 and looks through its routing table and sends it out Eth0.

Whether networks connected to the router are private IPs or public IPs is irrelevant.

A contrast between that router and a NAT Modem Router, is that the NAT Modem Router at home is like a 2 port machine, with a switch at the local side and you can't connect multiple local networks to it. Whereas a proper router has no switch in it and has more than 2 ports and you can configure subnets on the various ports.

If you read about Routing, I think you'd find that it only describes it like that, it make no distinctions as you do between industrial routers or not, local networks or not, there are no distinctions. And they all have one routing table. Not sure where you got the idea they'd have more than one. The only point i'd make though is that which is in the paragraph above, about some home routers having in built switches. But one tends not to read that in articles on Routing.

share|improve this answer
    
Thats great, thanks! –  James Wilson Apr 9 '12 at 19:22
add comment

Paste your routing table if you want an exact answer. It's going to be the network number that's generated from applying the netmask to the destination IP. If there's no such entry, then it goes to the default.

share|improve this answer
add comment

I'm not an expert on this, but I think it's like this: The router is the gateway for the "host".

The router has two network interfaces/two IPs, one in each network, let's say 192.168.1.1/255.255.255.0 (for network 192.168.1.0) and 192.168.0.1/255.255.255.0 (for network 192.168.0.0).

The host machine has the IP address 192.168.1.100 in the network 192.168.1.0. The host has its own routing table, from which one is something like this "default 192.168.1.1" which makes any packet with an IP not resolved by its table to be ant through the router.

The router receives on the first interface (192.168.1.1) the packet with the destination IP 192.168.0.4. One line in the routing table is "192.168.0.0 255.255.255.0 0.0.0.0" which means the packet which has the IP from network 192.168.0.0 is sent to the network 192.168.0.0, to be resolved by who can resolve it.

Now, if there is a switch in the way, the switch has an physical addresses - IP addresses table (mac address table). If it finds any IP equal to the one of the packet it sends it to that physical address. If the receiver host is connected directly to the router, the IP is resolved by the the mac address table of the router.

  • FYI: ARP tables are used for resolving IPs from Host Names.

Hopefully, I'm not completely wrong. :)

Oh, and this router is a proper router. There are just more types of routers.

share|improve this answer
add comment

As per my knowledge when a Host of one network sends a packet to another networks host it will work like: 1-The switch connected to sending host will send the packet to the router as he will not find the destination in his table. 2-The router then send the packet to the second switch as he found that the receivers network is on that switch. 3-The second switch will forward the packet to the destination.

share|improve this answer
add comment

Note: If "both networks were using a 192.168.0.0/24," it's not two networks, it's a single class C network with a router inexplicably stuck in the middle.

Short answer: it depends on protocol and topology.

Imagine 256 hosts connecting wirelessly to one Internet-connected router: all packets, whether local or not, go through the router (since the wireless hosts are not connected directly to one another), and the router sends local packets to locally connected hosts and non-local packets out its default gateway to the Internet. On an Ethernet network, however, local traffic (meaning: hosts on the same bus) may be addressed with MAC addresses rather than IP addresses and may never even reach the router. Some packets may be handled by switches.

If you have two separate networks attached to a router, each network will have its own subnet and will be connected to a specific interface on the router. (You could not, for instance, have a host with 192.168.1.12 on one interface, and another host connected to another interface with the same IP address.) Packets reaching this router will be looked up in the table and sent out the appropriate interface.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.