2014年10月21日 星期二

What is the effect or purpose of subnet on client PCs?

Q:

I understand that the subnet mask when combined with an IP is used to define the range of IPs that the router is responsible for routing. e.g. a router with 192.168.3.1 subnet 255.255.254.0, will route 192.168.2.1 to 192.168.3.255 through its LAN port, all other will be forwarded to its WAN/gateway. (sanity check please)
What is the subnet mask (as shown on ipconfig /all) for a client computer used for? Does the subnet mask of the client have to be same as its gateway?
A:
It's for precisely the same reason. The client computer needs to know which destinations it should try to reach directly and which it should try to reach through a router.
For IP addresses inside the subnet, the client computer uses ARP to locate the Ethernet hardware address of the destination machine's interface in the subnet. For IP addresses outside the subnet, Ethernet traffic is sent to the router's Ethernet hardware address in the subnet.
While a typical SoHo "WiFi router" has layer 2 (bridging, switching) and layer 3 (routing, NAT) functions combined, the client computer still acts precisely the same as it would if the switching and routing functions on the network were entirely separate like they typically used to be.


Calculate IP Subnet from netmask. (Link)

Address (Host or Network) Netmask (i.e. 24) Netmask for sub/supernet (optional)
/ move to:
 

Address:   192.168.123.124       11000000.10101000.011110 11.01111100
Netmask:   255.255.252.0 = 22    11111111.11111111.111111 00.00000000
Wildcard:  0.0.3.255             00000000.00000000.000000 11.11111111
=>
Network:   192.168.120.0/22      11000000.10101000.011110 00.00000000 (Class C)
Broadcast: 192.168.123.255       11000000.10101000.011110 11.11111111
HostMin:   192.168.120.1         11000000.10101000.011110 00.00000001
HostMax:   192.168.123.254       11000000.10101000.011110 11.11111110
Hosts/Net: 1022                  (Private Internet)



沒有留言: