1

i've been reading "tcp/ip illustrated" and i started reading about ip forwarding. all about how you can receive a datagram and work out where to send it next based on the desination ip and your routing table. but what confused me is how (in a home network setting) the table itself is populated. is there a lower layer protocol at work here? does it come along with dhcp? or is it simply based on the ip address and netmask of each interface? i do know (from other books) that in the early days of ethernet one had to set up routing tables by hand, but i know i didn't do that.

Robbie Mckennie
  • 1,123
  • 1
  • 8
  • 21

2 Answers2

1

in home networking setting you are probably using only one network (meaning same network address and mask for all hosts, so routing is not really happening inside) There is default gateway, and all packets addressed elsewhere are sent to default gateway. Forwarding packets on the switch happens based on mac addresses / IP address pair from received packets. In larger networks, where you need to route packets from one network to another, besides static routing there are routing protocols like rip, eigrp, ospf and others. yaMan

yaMan
  • 26
  • 1
0

For a typical host getting its IP address by DHCP, the only normal routes it will have are to its own network and to its default gateway. It gets both of these by DHCP.

David Schwartz
  • 31,449
  • 2
  • 55
  • 84
  • okay, great, new question. if i want to have 2 seperate subnets on my network (one assigned by dhcp and one assigned by hand), i can set up dhcp to send out both routes? – Robbie Mckennie Dec 08 '12 at 08:29
  • Just make the gateway between the two subnets the default router and it will all work without any additional routes. Otherwise, tell us what you're using as a DHCP server. – David Schwartz Dec 08 '12 at 08:36
  • right now, i'm using a dsl modem/router thing. what i'm thinking is having MY computers on their own subnet (for no other reason than just 'cause). if i let them all run on the same network, but have all the computers use both routing rules, i shouldn't need a router to interface them, right? – Robbie Mckennie Dec 08 '12 at 08:42
  • Yes, you would need a router to interface them. You need a router to interconnect distinct subnets. What would the route to the other subnet have as its next hop if not a router that connects to that subnet? – David Schwartz Dec 08 '12 at 08:44
  • one of my boxes has 2 NICs, and i configured one with a static ip (10.0.0.1) and by adding a static route to my other box (192.168.1.68) i could access the other subnet. is this some kind of bad practice? – Robbie Mckennie Dec 08 '12 at 08:47
  • Are these two subnets on the same physical network or are they separate physical networks? Also, how do you expect machines not on the same subnet as the router to have Internet access? (SoHo routers will only NAT devices on their subnet.) – David Schwartz Dec 08 '12 at 08:49
  • they are on the same physical network, i only want the subnets for logical separation. i did not know that about NATs – Robbie Mckennie Dec 08 '12 at 08:53
  • You don't want to put two physical interfaces in the same physical network. You're causing yourself a world of pain for no good reason. – David Schwartz Dec 08 '12 at 08:54
  • i originally put it there for traffic sniffing, what problems can you have? – Robbie Mckennie Dec 08 '12 at 08:55
  • @RobbieMckennie: This is very bad for Linux because Linux considers an IP address owned by the system, not the interface (weak end system model). So both adapters own both IP addresses. This assumption is built deep into the Linux stack and you can only work around the problems you will cause one by one -- there's no switch you can flip to change the end system model. – David Schwartz Dec 08 '12 at 08:57
  • i don't understand, they both have distinct mac addresses and ip addresses, according to ipconfig – Robbie Mckennie Dec 08 '12 at 08:59
  • This is an illusion. On Linux, IP addresses are owned by the system, not interfaces. Unlike Windows, Linux has a weak end system model. There is no switch to change the end system model. See, for example, [this thread](http://linux.derkeiler.com/Newsgroups/comp.os.linux.networking/2007-05/msg00149.html). – David Schwartz Dec 08 '12 at 09:01
  • well i can test this, i'll set up both NICs to the same subnet, make sure i can ping both, then unplug one. – Robbie Mckennie Dec 08 '12 at 09:06
  • Linux has a weak end system model. You can't change that. That you couldn't replicate this one particular symptom doesn't change anything. You don't want multiple physical interface in the same broadcast domain unless this device is making them the same broadcast domain. Linux fundamentally was designed to do the very opposite of that. – David Schwartz Dec 08 '12 at 09:11
  • well look at that, my entire model of networking shattered in a single bound – Robbie Mckennie Dec 08 '12 at 09:22
  • i guess i'll have to leave my project until after i've learned about configuring ip forwarding – Robbie Mckennie Dec 08 '12 at 09:30