Routing in home LAN

MulliGan81

Junior Member
May 26, 2016
18
0
6
I'm trying to understand some basic concepts of networking. I have following home LAN:



  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:
    Code:
    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:
    Code:
    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:
    Code:
    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.
    Code:
    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?
 

MulliGan81

Junior Member
May 26, 2016
18
0
6
This structure is mainly for testing purposes. Can You tell me why doesn't it select 192.168.0.0 route after removing the 192.168.0.11 since 192.168.0.11 belongs to 192.168.0.0?
 

MulliGan81

Junior Member
May 26, 2016
18
0
6
I have the following routing table (on my Win-7 desktop, 192.168.0.11 is it's IP)
Code:
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
The strange thing is that when i remove 192.168.0.11 route i got TIMEOUT trying
Code:
nc -zv -s 192.168.0.11 192.168.0.11 80
I wonder why doesn't it select 192.168.0.0 route since 192.168.0.11 belongs to 192.168.0.0?
 

Gryz

Golden Member
Aug 28, 2010
1,551
204
106
That is because you don't know what you're doing. And because we might not know what we're seeing exactly when looking at the routing table in Windows.

How packets are forwarded over the network is specified in standard documents. (For IP that's mainly in RFCs. For Ethernet and WiFi that is in IEEE802 documents). But how that is implemented in a specific OS is up to the implementers.

Normally a route in the routing table consists of at least three things:
1) the destination prefix (aka the range of addresses you want to send packets to).
2) the prefix length (how many bits in the prefix are significant. a /24 means 24 bits are significant. this corresponds to the old fashioned notation of netmasks 255.255.255.0.
3) the ip-address of the router you need to send packets to to get it towards the destination.
4) the outgoing interface
5) sometimes a metric too

This is simple and straight-forward.
Except for one case. When destinations are directly connected. Then you need more than just a route towards a prefix. You need to know how to reach the next-hop. For IPv4 that means ARP gets involved. (ARP is the protocol to find a MAC-address/layer-2 address that belongs to an IP-address/layer-3 address). Those mappings are stored in the ARP table. You can see it by typing "arp -a".
You also need to have a table of your own IP-addresses. So you know which IP-packets don't need to be forwarded to another box, but given to your upper layers in the OSI-stack (e.g. TCP, UDP or ICMP).

Some OSs store the arp-entries in the routing table too. So you only need to search in one table, in stead of 2. I think Linux stores ARP-entries in the routing table, I can't remember for sure. Some OSs also store the list of their own IP-addresses in the routing table. So you need 1 table in stead of 3.

Windows seem to store its own IP-addresses in the routing table. But not ARP-entries. If you have an interface with an ip-address, it seems Windows will install 3 routes in the routing table:
1) one for the prefix of the network connected to that interface. e.g. 192.168.0/24
2) one for its own ip-address on that interface. e.g. 192.168.0.11/32
3) one for the broadcast-address for that network. e.g. 192.168.0.255/32

What you did is remove the entry for your PCs own ip-address on the network ! So when your PC receives return-packets, it looks in its routing table to see what it needs to do with it. And there is no entry anymore telling it that those packets are destined for itself. So your PC doesn't know what to do with those incoming packets. And drops them on the floor. Stuff stops working.
 

mv2devnull

Golden Member
Apr 13, 2010
1,511
149
106
How do you configure the two interfaces of the PC2? Both with DHCP, both static, or a mix?

Both your modem and your router are DHCP-servers. They are simple to use, which means that you are out of luck if you should accomplish something else than what they have been designed to do. It is not their fault.

They both offer "default route" aka "gateway". If the PC2 listens both, it receives two defaults. That is by definition not correct.

Analog:
* You have been told to buy a hat for a lady. The color was not specified.
* You have been told before that the color is yellow by default.
* You have been told before that the color is blue by default.

Will you buy a blue hat? Will you buy a yellow hat? Will you buy a red shirt and prepare to die?

There can be only one default.


The PC2 needs four logical routes:
1. To self
2. To subnet A: 192.168.0/24
3. To subnet B: 192.168.1/24
4. To everywhere else

It would be logical to have that last *default* route via 192.168.0.1.
In other words, to refuse route entries offered by the 192.168.1.1 DHCP server.
 

MulliGan81

Junior Member
May 26, 2016
18
0
6
Thx for explanation
I know I've removed the entry for your PCs own IP-address BUT there is still left 192.168.0.0 routeand 192.168.0.11 is an address that belongs to that subnet so why isn't it being used instead of deleted route?
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |