3

Actually I'm doing an online course and in the Address Resolution Protocol video lecture, this statement is made in the following context. enter image description here enter image description here

And here's what the instructor says:

It needs to because of the concept of a netmask. For example, look at this hypothetical setup. The gateway, in the middle, has a single IP address: 192.168.0.1. It has two network cards, one connecting it to the destination 171.43.22.5, one connecting it to the source, 192.168.0.5. The address 192.168.0.1 can really only be in one of these networks, the source network. The netmask needed for 192.168.0.1 to be in the same network as 171.43.22.5 is 128.0.0.0, or just one bit of netmask! But it can’t be that all IP addresses whose first bit is 1 are in the same network as 171.43.22.5 -- 192.168.0.5, for example, needs to be reached through the gateway. So instead we often see setups like this, where the gateway or router has multiple interfaces, each with their own link layer address to identify the card, and also each with their own network layer address to identify the host within the network that card is part of. For the gateway, the left interface has IP address 192.168.0.1, while the right interface has IP address 171.43.22.8.

I specially don't understand the bold statements. Why can't 192.168.0.1 be in both networks?

Akshay Arora
  • 133
  • 4
  • That is one of the more convoluted explanations I've seen in a while. Part of the confusion is that he is using "network" to refer to two different things: an IP subnet and a physical medium, I think you need to back up and fully understand IP addressing and the role the netmask plays. Then the answer will be much clearer. – Ron Trunk Jul 19 '15 at 17:25
  • yes, it's enough of a dupe. Understanding prefixes/network numbers is the key to answreing this Q. – Craig Constantine Jul 20 '15 at 15:10
  • Thanks a lot guys! The answer you linked to indeed cleared the confusion completely. – Akshay Arora Jul 22 '15 at 15:11

3 Answers3

1

For my explanation lets assume the mask on both subnet's is /24 255.255.255.0

On any single subnet, all the hosts (including the gateway) must have the same network portion (as defined by the mask), else they are not on the same subnet.

  • net1: 192.168.0.0/24 range of ip's 192.168.0.1 - 192.168.0.254 in subnet.
  • net2: 171.43.22.0/24 range of ip's 171.43.22.1 - 171.43.22.254

Thus if a GW/Router has interfaces in different subnet's it needs a IP on each interface that is from that subnet, to allow it to talk to the hosts in the subnet.

In your example, if the Gateway only had ip 192.168.0.1 it would not be able to talk to 171.43.22.5 directly, as 172.43.22.5 would refuse to send packets to a ip not on its subnet, and rather forward them to it's configured gw(who has to be in the 171.43.22.0/24 subnet)

Pieter
  • 1,427
  • 10
  • 14
0

Each port of router MUST BE connected to a different network. If we connect the ports of the router to the same network, then the router will discard any incoming packets.

So if we assume a mask of 24, then the left side is in the network 192.168.0.0 and the right side is in the network 171.43.22.0. So if you try to configure 192.168.0.1 for the right network, then you are connecting both ports of the router to the same network, which you must not.

GandalfDGrey
  • 301
  • 1
  • 3
  • 6
0

Okay so lets start off with what a Network mask is.

Most people are familiar with 192.168.1.1 or sometimes we see 192.168.0.1, now the network mask you typically see for this is 255.255.255.0

Evert time you see a 255, that part of the Ip/address is part of the "network" address. Every time you see a 0. That part is part of the "host" address.

so for 192.168.0.1 with a net mask of 255.255.255.0 the network part is 192.168.0 (and we would actually say the network is 192.168.0.0) and the host part is just .1 if we compare this to 192.168.44.111 we look at the network part and we see that they are in 2 different networks

for 171.43.22.8 with a netmask of 255.255.255.0 (also called /24 and ill get to that) the network part is 171.43.22 (remember that network is 171.43.22.0) and the host part is .8

Now because the netmask is /24 (255.255.255.0) only the last part can be used for host, .1-.254 (.255 is your broadcast address)

Now what if the mask changes? 255.255.0.0 or /16 ? well lets look again.

192.168 is now network and the rest will point to host. so 192.168.44.111 and 192.168.0.1 are now in the same network.

so what's all the /16 and /24? it's just another way to express the netmask. Each 255 in binary is 8 bit's of all 11111111's so if I say a netmask of /8 it means 255.0.0.0 and /16 255.255.0.0 and /24 255.255.255.0

Now this was just a primer, lots more to learn about netmask and how to apply them using ACL's and stuff's.

So now you can answer your own question =)

Each NIC can only be in one network. And since 192.168.0.5 has a gateway of 192.168.0.1 we know the netmask to be /24. If you apply the /24 to 171.43.22.5 it's easy to see they are not in the same network and will need a router to route the packets for them from network to network.

Good Luck with your studies =)

Levi
  • 256
  • 2
  • 8