Network Routing Table: Gateway vs. Interface?

deleyd
deleyd used Ask the Experts™
on
I've been examining the network routing table on my Windows computer, and I'm wondering why there are 3 entries instead of just 2.

At a command prompt I type "route print".

The resulting display has columns "Network Destination | Netmask", "Gateway", "Interface".

I'm wondering what the difference is between a Gateway and an Interface.

I'm thinking of a very simple Dial-Up Network setup:
Network AdapterThe Network Adapter has the following IP address:
Network Adapter IP addressIs this the "Gateway" IP address, or the "Interface" IP address? And what would the other IP address be for

If I wanted my program to send some data to IP 1.1.1.1, and I want this data to go out over Network Adapter 7.7.7.7, I could add to the network routing table a line with: 1.1.1.1   255.255.255.255 for Destination and Mask, then would I add 7.7.7.7 to the "Gateway" or to the "Interface"?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Instructor
Top Expert 2015
Commented:
In the windows routing table, "interface" is the IP address of your computer that the packet will exit.

"Gateway" is the next hop address to the destination.  In other words, the IP address of the local interface of your router.

If you want to add a route, the context is:

ROUTE ADD <destination network> MASK <mask> <next hop address> <metric (optional)> IF <interface ID (optional)>

So in your case the command would be something like:

route add 1.1.1.0 mask 255.255.255.0 7.7.7.1

Open in new window

I would note the route to 0.0.0.0 - that is generally the system's "internet gateway" and will be the next hop for the modem/router.
There you should see something like:
Network Destination        Netmask          Gateway           Interface        Metric
          0.0.0.0                       0.0.0.0               192.168.0.1     192.168.0.7    281

So, in this case, the Gateway is the networks "internet gateway" (the modem/router) and the Interface is the IP address of the computer's NIC.
You may see other Gateways listed in "route print".  And, you will see other Interfaces listed such as 127.0.0.1, etc.  but for your purposes they may amount to the same thing as the first one mentioned.
deleydSoftware Engineer

Author

Commented:
Going in the other direction, from my router towards the computer, does my router see the computer as 7.7.7.7?
Don JohnstonInstructor
Top Expert 2015

Commented:
The routers routing table would show the network (I.e. 7.7.7,0/24) your computer is on.  If the router is connected to that network, then the router would see the computer's IP address in its ARP cache.
Beyond Don Johston's correct answer:
Yes, the router will "see" your computer at 7.7.7.7 as could be evidenced with a PING.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial