Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What should the default gateway setting be set to for a simple network of 2 computers and one switch? Basically when there is no gateway (ie. no router, no internet, and no other connections into the switch).

Should it be set to:

  • 0.0.0.0
  • IP address of computer ON network.
  • IP address of computer NOT on network.
  • Something else.

Other notes:

  1. Some applications require 'something' entered. So gateway cannot just be 'blank' or ingored.
  2. Does the particular gateway address used affect the PING time performance between these two machines? (ie. more/less traffic).
share|improve this question
    
What OS are you using? –  BillP3rd Sep 6 '13 at 0:54
    
Let's say Window 7. –  Nicholas Sep 6 '13 at 0:55

2 Answers 2

up vote 2 down vote accepted

You don't have to have a default gateway. If no router exists on your network, you want to NOT specify one.

In the Windows configuration for a network adapter you can leave the default gateway blank.

Linux has no problem if you want to delete the default route, or not specify one.

The default gateway address will only come into play if a system is trying to reach a subnet that's not currently on any network adapter. So if your network adapter is set to 192.168.15.1/255.255.255.0, and you send traffic to 192.168.15.5/255.255.255.0, the default gateway never comes into play. It would only possibly use it you tried to send traffic to something like 192.168.16.1 or something not in that subnet.


What should happen is if a process attempts to send traffic to a network access, and there is no route to it, then it should receive a "No route to host" error. If you don't specify a default gateway at all, it shouldn't even try to send traffic to any IP that's not in the subnet of your network adapter.

If you specify any other IP (including 127.0.0.1), it's going to try to send traffic to that IP if the destination IP is not in the same subnet as your network adapter (and no other interface matches the subnet). Nothing will respond, and the connection will time out. Waiting for the timeout will consume more time than simply not specifying a default gateway and letting the Windows TCP/IP software issue an error to the process trying to make a connection.

share|improve this answer
    
True, but there is generally always 'some' process trying to access some other network (especially on windows). Would specifying a valid address (as opposed to nothing) likely lead to shorter time-outs, more process sleeping, and/or less general traffic on the network. –  Nicholas Sep 6 '13 at 1:18

Generally speaking, you don't need a default gateway, however, since you seem to "need" it for certain applications, we can provide a "dummy" gateway.

By convention, I usually reserve the IPv4 address ending in ".1" as my gateway. So, let's assume your Computer "A" is 192.168.1.2, and "B" is 192.168.1.3. You can supply 192.168.1.1 as the default gateway. Traffic between the two systems won't be affected because the default gateway only comes into play if you try to reach a computer that's on another network. If that happens in this case, you'll get something like "Gateway failed to respond" as an error.

I'd be interested to know what applications you have that require a default gateway. As @ultrasawblade points out, Windows itself is perfectly happy if you leave the default gateway blank.

share|improve this answer
    
So your basically saying: A valid IP address in the subnet range of a computer NOT currently on the network. Do you think this increases, decreases, or has no change to network usage. (as opposed to say using the IP address of an existing computer). –  Nicholas Sep 6 '13 at 1:05
    
It should have no effect on your network traffic unless one of your two computers tries to reach a computer in another subnet. In that case, you'd get the "Gateway not found," or similar. –  BillP3rd Sep 6 '13 at 1:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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