networkingiprouter

Difference between a default gateway and a router


Actually, I have three questions in this regard:

  1. IP address: Are routers and default gateways the same? If they are the same, then why is the router's address (internet IP) public and the gateway IP address local (I mean why are they different)?

  2. MAC address: What is the difference between the WAN MAC address, the router MAC address, and the default gateway MAC address? Why are they different?

  3. Difference between data packets and IP packets? Are data packets that travel from a host to a remote server present in some other country through submarine cables or through router to router by hop-by-hop transport?


Solution

  • Router and gateway are essentially the same - a gateway provides access to remote subnets. The hardware for that is called router. Routers route between networks.

    A default gateway is a gateway that the default route (0.0.0.0/0 for IPv4 or ::/0 for IPv6) points to. It provides access to all subnets that are not specifically configured otherwise. At a minimum, a host requires a default gateway to connect to the Internet.

    IP addresses are configured on (logical) interfaces. A router usually requires at least two interfaces, each configured with an IP address from the connected subnet.

    Likewise, a MAC address is required for a physical interface on a MAC-based network - specifically for the data link layer to work (OSI layer 2). It uniquely identifies interfaces within a network segment and is used by network switches for forwarding. It is also used for a network interface controller (NIC) to decide whether to receive a layer-2 frame or ignore it.

    A data packet can be many things. An IP packet is a packet (also protocol data unit PDU) on the network layer (OSI layer 3). IP packets travel between hosts around the globe and transport user data (payload or service data unit SDU) between them.

    User data is actually transported by an application-layer protocol (e.g. HTTP) that in turn uses a transport-layer protocol (e.g. TCP) between processes/applications. The transport layer uses the network layer (IPv4 or IPv6) which in turn uses the data link layer (e.g. Ethernet) which in turn uses the physical layer (physical interfaces and cables).