0

I am learning networks from hardware and software aspects.

assume below scenario: we call computers with c prefix, switches with s and routers with r. all macs and IPs are summerized.

c1 ip=1 mac=xx

c2 ip=2 mac=yy

connected to switch s1

c3 ip=3 mac=zz

c4 ip=4 mac=ww

connected to switch s2

each switch is one network. both switches s1 and s2 are connected to r1 which is our router.

my questions are:

when c1 sends a message to c2, will it go directly to c2 without traversing through router?

how switch s1 knows mac addr of c3 which is in another network?

what happen to src/dst mac addr of frames which going to one port of router, doesn't router check src mac addr of frames? does it accept any src mac addr?

does router know all nodes in any network recursively in sub networks or it only knows what actually connected to its ports, like only switches?

or if we sum all questions into one:

how packets and frames go through switches and routers to rich their destination without being modified?

thanks

1 Answers1

1

when c1 sends a message to c2, will it go directly to c2 without traversing through router?

When c1 and c2 share a common subnet then no router is involved.

how switch s1 knows mac addr of c3 which is in another network?

It doesn't.

When s1 and s2 are connected together all ports are on the same network (=L2 segment) and both switches learn all MAC addresses.

When there's a router in between (your scenario) the switch ports are on different networks and each switch only learns MAC addresses on its side of the router.

what happen to src/dst mac addr of frames which going to one port of router, doesn't router check src mac addr of frames? does it accept any src mac addr?

When the router is required as gateway, encapsulating frames are first addressed to the gateway. The gateway removes the source frame, extracts the packet, decides the next hop, creates a new frame for the packet and transmits it.

does router know all nodes in any network recursively in sub networks or it only knows what actually connected to its ports, like only switches?

A router uses ARP for IPv4 or NDP for IPv6 to learn the MAC addresses of the nodes it requires. It doesn't know any MAC addresses it doesn't use for forwarding.

how packets and frames go through switches and routers to rich their destination without being modified?

Short answer:

  1. frames do not cross routers, packets cross routers
  2. frames are not modified by switches
  3. packets are not modified by routers, except for the TTL field
Zac67
  • 90,111
  • 4
  • 75
  • 141