I'm Looking at this routing table from netstat -r. routing table

How does the interface relate to the Gateway? the first entry has gateway which is the gateway to the router. the Interface says which is private IP in the 192.168.1.* network current. so I think any packet that doesn't match any other entry is sent to the router. My confusion is with an entry like the 5th one with subnet mask so a packet going to for example is taken to Gateway On-link (not 100% sure what that means) and the interface is which is the same interface as the default. so is this entry doing the same as the default? does the gateway make a difference?

so what happens when a packet wants to go to does it go to the router or does it mean that it just goes to which is the same as just staying on the computer?

2 Answers 2


Welcome to Network Engineering.

The "Destination" is what's important here. Packets destined towards in this case is on the same network as your network interface, which is why it's considered "On-link", which is why it has no gateway. You do not need to send traffic to a gateway when it's on the same network as you are.

Regarding "Interface" IP's, this is the IP Addresses of your network interface. You have two - is your Network Adapter, and the is your loopback adapter. All computers have an invisible loopback adapter. The Interface will show which interface is being used to send the traffic to the destination network.

A "gateway" is a router - when you need to send traffic to anywhere else not listed (, then it will send the traffic to the gateway IP Address, so that it can route the traffic accordingly.

  • Hi, So the gateway and interface are basically saying we are sending this packet to this gateway from this interface. also, where are these packets that are being routed coming from. are these packets created by the computer itself? or are they just coming in from other devices and the computer routes them to the specified interface(if on-link) or to a gateway(like a router) from a specific interface. May 8, 2021 at 14:07
  • The answer depends on what kind of device it is. If the device needs to send a packet it uses the routing table to determine which interface to use.
    – Ron Trunk
    May 8, 2021 at 15:00
  • 1
    The packets are coming from your own computer. Windows machines will not by default do any routing of its own, so all traffic sourced will be from your own computer. For example, if it's doing windows updates, it needs to reach Microsoft, so it will use your default gateway. If you have a local printer like - then it will send the traffic out using the On-Link line 5 that you mentioned.
    – KeyszerS
    May 9, 2021 at 7:57
  • Thanks, I think this makes sense now. May 9, 2021 at 16:49

How does the interface relate to the Gateway?

The gateway needs to be connected to the interface through a data-link-layer network (e.g. Ethernet). Both must share a common IP subnet (here that's

The first entry matches any address due to its zero-length mask. It's called the default route and its gateway the default gateway.

The entry is for the locally connected subnet. Those hosts are on-link and can be talked to without a gateway (sometimes the local interface is displayed as the gateway as well).

In your case, there's only one interface and one gateway beyond the network connected there - the most simple case. Your host could have multiple interfaces (multi-homed) with multiple subnets on-link. In any of those subnets there could be gateways connecting elsewhere - to route to these 'elsewhere' networks, specific routes are required. Without those routes, the default gateway would be used.

what happens when a packet wants to go to does it go to the router

No. matches the route destination which says On-Link. Accordingly, the destination IP is sent to directly (for a MAC-based network, the destination IP is resolved to a MAC address using ARP and the packet is encapsulated by a frame addressed to that MAC). No gateway is used.

Your Answer

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

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