A gateway device interconnects two different networks, sometimes using different network protocols. When it connects networks using different protocols, a gateway converts a datagram from one protocol stack into the other. When used to connect two IP-based networks, a gateway (also called a router) has at least two IP addresses, each one belonging to only one network.