Routing - default gateway
When it comes to routing in IPv4 and IPv6 networks, a default gateway is an important component that enables devices within one network to communicate with devices in different networks.
A default gateway serves as a point of access that a network host uses to send information to a host in another network. It is essentially the point through which a local network/subnet/VLAN/broadcast domain communicates with other networks or subnets.
Network hosts are configured with a default gateway that must be in the same subnet as the device itself. For example, a PC with an IP address of 10.10.20.5 and a subnet mask of 255.255.255.0 must have a configured default gateway within the range of 10.10.20.1 to 10.10.20.254. Otherwise, the operating system will typically respond with an error message stating that the default gateway is outside of the local network (and is thus unreachable).
The device that owns the IP address that acts as the default gateway is a Layer 3 device, typically a router, an SVI on a Layer 3 switch, a firewall, a wireless access point, or a WAN terminating device such as an xDSL modem or a cable modem.
Any hosts that don't have a default gateway configured will not be able to communicate outside of their own Layer 2 network.
The default gateway is a component of the network settings of an end host. Network intermediary devices such as routers and layer 3 switches use a similar concept of the default route, but this is used also for transient traffic.
So the default gateway in IP networks is the device that acts as the intermediary to forward network traffic from a local network to other networks, including the internet. This functionality is essential for the global interconnectivity of different networks.
Links
https://networklessons.com/cisco/ccna-200-301//what-is-a-default-gateway