Gateway address
A gateway connects individual physical networks into a system of networks. When one node communicates with another on a different network, a gateway transfers the data between the two networks.
IPv4
The following figure illustrates how gateway G connects Network 1 and Network 2.
Gateway example

When host B, with the IP address 128.2.0.1, communicates with host C, it tells from C's IP address that C is on the same network. In an Ethernet environment, B then resolves C's IP address to a media access control address via the Address Resolution Protocol and communicates with C directly.
When B communicates with A, it tells from A's IP address that A is on another network because the network IDs are different. To send data to A, B must have the IP address of the gateway that connects the two networks. In this example, the gateway's IP address on Network 2 is 128.2.0.3.
Gateway G has two IP addresses, 128.1.0.2 on Network 1 and 128.2.0.3 on Network 2, and the first address must be used by hosts on Network 1 and the second by hosts on Network 2. To be usable, a host's gateway must be addressed using a network ID matching its own.
IPv6
Gateway example

When host B with IP address fd00:2::1 communicates with host C, it knows from C's IP address that C is on the same network. In an Ethernet environment, B then resolves C's IP address to a MAC address (via NDP) and communicate with C directly.
When host B communicates with host A, it knows from A's IP address that A is on another network (the net IDs are different). In order to send data to A, B must have the IP address of the gateway connecting the two networks. In this example, the gateway's IP address on Network 2 is fd00:2::3.
The gateway has two IP addresses (fd00:1::2 and fd00:2::3). The first must be used by hosts on Network 1 and the second must be used by hosts on Network 2. To be usable, a host's gateway must be addressed using a net ID matching its own.
Provide Feedback