1

Does a gateway need to be designated?

I thought a gateway between two networks is a device explicitly designated to be a gateway, out of several qualified devices connected to both networks. That was my impression when I heard that I could find out gateways from a routing table (e.g. from the output of route -n).

But now suppose that I am to create a new network, and add a line to the routing table of a host, so I have to pick a gateway, without looking up the routing table.

Is any device which satisfies the following two conditions already a gateway between two networks without being explicitly designated:

  • with two network interfaces connected to the networks respectively, and

  • with a routing table allowing packets to be transmitted from a network to the other (Is it correct that every device in network(s) has a routing table?)

?

Thanks.

3
  • 1
    This really becomes a functional definition. If you're using it as a gateway, meaning you have other devices that use this device to get to other networks, then it's a gateway.
    – Ron Trunk
    Commented Mar 27, 2019 at 12:03
  • by "functional" definition, do you mean "it is currently being used as" or "it has all the qualifications and can be used as, even if not being used as"?
    – Tim
    Commented Mar 27, 2019 at 12:43
  • Tim, consider joining Network Engineering Chat. You might get your questions answer more completely and more quickly. chat.stackexchange.com/rooms/11177/…
    – Ron Trunk
    Commented Mar 27, 2019 at 13:21

4 Answers 4

4

The device meets the minimum requirements to be a gateway, but I would say if you’re not using it as a gateway, then it’s not a gateway.

4
  • (1) "The device meets the minimum requirements to be a gateway", do you mean any gateway has to at least satisfy the two conditions that I listed? (2) in "but I would say if you’re not using it as a gateway, then it’s not a gateway", what do you mean by "using it as a gateway" ?
    – Tim
    Commented Mar 27, 2019 at 12:47
  • 1. As a functional definition of a gateway I would say yes. 2. If no device has the gateway listed in its routing table, then it's not being used as a gateway. Is your PC a server if no one uses it as such?
    – Ron Trunk
    Commented Mar 27, 2019 at 12:51
  • In the following scenario, is my laptop used as a gateway? My laptop is connected to a wifi network, and there is also a network for all the loopback interfaces. The default routing table doesn't seem to route traffic from the wifi network to the loopback network or the other way round.
    – Tim
    Commented Mar 27, 2019 at 13:12
  • I would say no. do you feel different;y?
    – Ron Trunk
    Commented Mar 27, 2019 at 13:20
6

This is more a semantic thing than a technical one.

An IP network, like 192.168.1.0/24 usually contains several hosts. An host can be -among other things- a computer, a printer or a router. Yes, a router is also an host in IP terminology.

When a non-router host, let's call it X, want to communicate with another host that is not in the local network, it has to send the traffic to a router.

So X lookup in its own IP routing table and search for a route. If a route exists for the destination it seeks, X sends the packet to the router given by the route.

A host can have several routes to different destinations pointing to different routers in the same LAN.

However this imply for the administrators to maintain on each and every host a routing table. This is really impractical.

So usually a standard host has only one route, to a single router, and this router will forward (or redirect) traffic to other routers as needed.

This is this unique router that is called the gatewayused by host X.

The gateway of a network is the router that hosts in this network have as router / default gateway / default router in their IP settings.

This is a host related concept. For a router there's not really a concept of gateway.

2
  • It is as you say really a semantic question, but I'd have said that as a matter of implementation most hosts actually have a an interface route as well as a default route. For explanatory power I'd also say that "routing table" is a much better explanation that "LAN-mechanism and Gateway-mechanism".
    – jonathanjo
    Commented Mar 28, 2019 at 12:26
  • @jonathanjo agree, but considering the various questions asked by the OP, I choose to leave aside technicalities that would be more confusing than helping, IMO.
    – JFL
    Commented Mar 28, 2019 at 12:33
3

Is any device which satisfies the following two conditions already a gateway between two networks without being explicitly designated:

with two network interfaces connected to the networks respectively, and

with a routing table allowing packets to be transmitted from a network to the other (Is it correct that every device in network(s) has a routing table?)

The device also has to support forwarding of packets between networks and have that functionality enabled. Most general purpose operating systems (rather than devices specifically sold as routers) will not forward packets between networks by default.

2
  • Thanks. (1) Isn't my secon point about packet forwarding? (2) How can I know if my Linux enable or disable packet forwarding?
    – Tim
    Commented Mar 27, 2019 at 22:55
  • The routing table determines where to send packets, (both locally generated and forwarded). But the system will only forward packets if it is configured to do so which is not the default "/proc/sys/net/ipv4/ip_forward" controls forwarding for ipv4, /proc/sys/net/ipv6/conf/all/forwarding controls forwarding for ipv6. Commented Mar 28, 2019 at 2:38
2

Each and every device has no routing table. Every layer 3 device has a routing table.

Gateway is physical device or virtual device which allow to flow data between different network. (Gateway is a IP Level Router)

If you want to communicate between two separate network, you have to have a gateway. As per i mentioned above line, it could be a physical or virtual device. what you need is route between two network.

Hope this will help

1
  • 3
    That's not quite true. Every IP device has a routing table.
    – Ron Trunk
    Commented Mar 27, 2019 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.