now in this setup we will be introduced to the Routes.
Routes define the path that packets take to reach their destination. In networking, a route has two main components:
Destination:
This specifies the target IP range (subnet) or a specific IP address to which the route applies. For example:
192.168.1.0/24
means "any device with an IP address in the range 192.168.1.0 to 192.168.1.255."default
means "any IP address that doesn't match other routes in the table."
In networking, a default route is like a fallback option. It tells the device:
"If I don’t have a specific route for where the packet is supposed to go, send it to this gateway (or router)."
Think of it like this:
Gateway:
This specifies the next hop (typically a router's IP address) where the packet should be forwarded to continue its journey toward the destination.
How it works:
When a host needs to send a packet:
default
route).So now we should put the ip of the interface r2 as gateway of the route of B1 and since routers are designed to connect different subnets. For traffic to leave the host’s subnet, the router must first receive the packet from the host. If the host and router are in different subnets, the host cannot directly send packets to the router because:
so the interface r2 and b1 should be in the same subnet so they will have the same mask and b1 ip should have the same network bytes of r2
same thing for host a with r1