2

I'm trying to understand some basic concepts of networking. I have following home LAN:

enter image description here

  1. Is it right (like above) to have 2 NIC's each one having 2 different gateways on one station? There PC2 have 2 NICs - the first's one gateway is 192.168.0.1 the second's 192.168.1.1?
  2. Initially (just after system startup) the ip table is like that:

    192.168.0.0    255.255.255.0         On-link      192.168.0.11    276
    192.168.0.11   255.255.255.255       On-link      192.168.0.11    276
    192.168.0.255  255.255.255.255       On-link      192.168.0.11    276 
    

    and when i run netcat:

    nc -zv -s 192.168.0.11 192.168.0.11 80 
    

    to test if port 80 is open it works - the port 80 is indeed open. But when i remove the 192.168.0.11 route i got "TIMEOUT" on nc test. Shouldn't it pick 192.168.0.0 route and work? Moreover when i add the route manually:

    route add 192.168.0.11 mask 255.255.255.255 0.0.0.0 it still doesn't work!

  3. I can't change the metric to desired value. When i run for eg.
    route change 192.168.0.11 mask 255.255.255.255 192.168.0.11 metric 500
    the result metric is't 500 but 520! (no matter if auto-metric is enabled or not)?

  4. Is there any connection between -s flag (local source address) in netcat and routing table's Interface column?
5
  • You removed the interface route. It’s part of how Windows networking works. Note the “On-link” part where the gateway would normally be.
    – Daniel B
    May 22, 2016 at 17:37
  • @Daniel B What do You mean "interface route"?
    – Mulligan
    May 23, 2016 at 9:09
  • It’s a route that tells Windows that a specific target is reachable directly on the local network, ie. without a gateway. As such, it is “on-link”.
    – Daniel B
    May 23, 2016 at 16:22
  • @Daniel B ok i but even if i removed 192.168.0.11 there is still 192.168.0.0 route so why it's not beeing picked?
    – Mulligan
    May 25, 2016 at 19:42
  • It's (probably) a special route that is required for "loopback" connections.
    – Daniel B
    May 25, 2016 at 20:43

1 Answer 1

2
  1. There is no problem with this network layout - except that it makes your network topology a bit confusing. Unless you explicitly need PC3 to be behind another NAT and PC2 to be on both networks - there isn't any practical benefit from this. It'd be easier to have Router (192.168.0.10) connected as switch instead.

  2. Judging by your route output syntax, you are on Windows. In other operating systems an additional network interface is implemented (loopback device). This interface is automatically used for all connections, where destination is the same computer. In Windows, however, this device is missing and so you need additional routing table entry (the one you've deleted).

Edit: It seems that deleting and re-adding loopback route on Windows 7 machine will break it until next reboot. Restarting tcp/ip stack doesn't help. Your route add command is correct.

  1. Since your routing table is already pre-configured at startup, there could be some background services interfering with your route command. What happens when you add metric 480 instead?

  2. There is partially. netcat should refuse to set -s to ip address, that isn't configured on any local interface. You can, however, set same ip address on more interfaces. In that case netcat should take route into account (destination, metric) to decide which interface takes priority.

2
  • 2.) I don't think You are right. As i checked the option for adding "on-link" route (local, directly available subnet) is 0.0.0.0 for the gateway as i typed. 4.) What do you mean "set same ip address on more interfaces"? Do You mean to have in the routing table one destination addres and two routes for it (reachable from 2 different interfaces/gateways )
    – Mulligan
    May 23, 2016 at 13:14
  • @Mulligan 2.) your syntax was valid - but both should correctly create the on-link route. Problem seems to be elsewhere. 4.) What you said is indeed possible - yes. What i was talking about when i said "set same ip on more interfaces" is something akin to this: superuser.com/questions/336854/… . In short: There is connection between the netctl -s option and routing table interface, but they aren't always pair with 1to1 relation.
    – Marek Rost
    May 23, 2016 at 14:56

You must log in to answer this question.

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