I would like to ask something. Probably, that was a simple thing but I'm new at network business so thanks for your kindness. In the topology image given below, the router "Router1" has an input address 10.2.2.1 and its neighbor is the switch with 192.168.2.1. Can someone explain how the router can change the address like that? I'm familiar with VLSM but no expert.
2 Answers
Your picture can't be viewed but if you have both networks directly connected to your router that networks are tipically used to explain Network Address Translation (NAT) Protocol. http://en.wikipedia.org/wiki/Network_address_translation
That is not NAT, is just a normal router connection. The goal of a router is interconnecting networks. The router you comment, for example, have this configuration:
Interface IP
Serial0/0/0 10.2.2.1
FastEthe0/0 192.168.2.1
And it knows that each network is on that interfaces. But how can reach PC1 to PC0? Because there are static or dynamic routing: Router 1 have a sentence like that.
192.168.1.0 255.255.255.0 10.2.2.2
That means:
The whole network 192.168.1.0/24 can be reached with next hop 10.2.2.2 (The other side of your Serial Interface).
In this picture, when PC0 sends a packer to PC1, it will send a packet with source IP address 192.168.1.10 (it's own) and destination address 192.168.2.20 (PC2's address). PC1 knows that PC2 is not on the local network, so it will hand this packet off to his default gateway, Router2. It does this by sending this IP packet with source MAC address his own MAC address and destination MAC address the address of Router2. Router2 will look up where to reach 192.168.2.20, which is through Router0. Router will replace the MAC addresses (source MAC: Router2, destination MAC Router0), but not change the IP addresses. Router0 will forward the packet the packet to Router1 in the same way as Router2 did. Finally, Router1 knows that the packet is local for him. So he forwards on the packet, which will end up having:
- Source IP: 192.168.1.10
- Destination IP: 192.168.2.20
- Source MAC: Router2's MAC address
- Destination MAC: PC2's MAC address
The switches in this picture only need to know on what port to forward the packet to the next hop, but they don't alter the MAC address.