8

Please assume a simple LAN on 192.168.100.0/24. Would you configure the default router on 192.168.100.1 or 192.168.100.254 and why?

Thanks

10 Answers 10

21

I am of the "put the gateway at the top of the subnet" religion. It makes absolutely no difference, though.

For kicks, I've put the gateway in a /23 on the ".0" or ".255" address (i.e. 192.168.0.0/23, spanning 192.168.0.0 to 192.168.1.254, with 192.168.0.255 and 192.168.1.0 both being valid host IPs)... That's some good fun, that. I enjoy watching the heads of people who don't understand IP subnetting asplode when I tell them-- "The default gateway is 192.168.0.255..."

8
  • 4
    I've used both as well, but usually for more practical reasons than just seeing peoples heads asplode ;) May 20, 2010 at 22:23
  • 4
    That may be fun buts can cause problems later when someone who doesn't properly understand subnetting has to debug a network problem. May 21, 2010 at 5:31
  • 1
    I was at one lab where we had a segment where we worked on "completely legal per standard, but different from common practice" stuff to check for standards compliance. One of the head explodey things was non-contigous netmasks, like aaaaaaaa or ffff00ff.
    – mpez0
    May 21, 2010 at 12:04
  • 4
    @ John Gardeniers: I'd love to say that people who don't understand subnetting shouldn't be debugging a tcp/ip network... but we all know that doesn't always work
    – Rob Moir
    May 21, 2010 at 14:52
  • 1
    thumbs up for .0 / .255 ...; some people refuse to accept simple fact of life that it's all about a netmask, not a last octet.
    – pQd
    May 22, 2010 at 17:38
10

I would use 192.168.100.1, then asign IP starting at 192.168.100.10 (I keep some free IP if I need to add some network device like load balancer, etc.)

Why ? Imagine you need to shrink the network to a /25, if you have used 192.168.100.254 you must change the gateway all host.
Ok you will tell me, I can use 192.168.100.254 and start affecting IP from the top instead of the bottom then shrink to 192.168.100.128/25 instead of 192.168.100.0/24. That's right.
Now imagine you need to extend the network to 192.168.100.0/23. If a gateway set as 192.168.100.1, the gateway is still the first IP of the network when 192.168.100.254 would be in middle.

That why I prefer to take the first IP most of the time, it's also easier for others person, they just know that the gateway if the first IP in the subnet and most of the time changing the subnet will not affect this statement.

4
  • 2
    BAD argument - if you this way need to shring the network, you still need to change the network mask on all host. Ergo go to all hosts anyway -> same situation.
    – TomTom
    May 21, 2010 at 6:17
  • 2
    Yes but this is a lot easier... if you change gateway on host first, you loose network on host untill you changed all host then the gateway IP (Of course you can't change gateway first or you loose your host, then can't do the change). Changing the mask doesn't imply a cut!
    – radius
    May 21, 2010 at 6:23
  • (I assume you need to go through the router to connect to hosts to do modification)
    – radius
    May 21, 2010 at 6:30
  • 2
    I think this is a valid answer. In the case of changing the subnet size it feels more natural to keep the low adresses and take care of the other hosts in the next step.
    – Thomas
    May 21, 2010 at 14:23
5

From what I've seen, it's almost entirely personal/organizational preference. As long as you are consistent, neither way is wrong. If you really wanted to, you could set up the router to have both IPs (but this would be silly.)

0
4

Less important than "is the gateway high or low?" is "did you document what you did so so in the future people will know how to find things?"

0
2

There is no hard and fast rule about this, but on nearly all of the networks I've designed and/or worked on, the lowest IP in the subnet is used for the router/default gateway. In your case, this would be 192.168.100.1.

As for your "why?" question - it's really just a convention that the networking community has settled on. If you want to put the default gateway somewhere else, feel free, but really you may be asking for confusion at some point in the future.

3
  • From school I remember that the last IP should be used. But in real life I see most routers on the first IP. I wonder if there is a spec or convention for either way.
    – Thomas
    May 20, 2010 at 22:25
  • 2
    That's probably because most "routers" these days are consumer-spec devices that also do DHCP, and the fewer number of characters Mrs Jones has to type (10.1.1.1 vs 192.168.101.254) the less chance she'll get it wrong. May 21, 2010 at 2:20
  • Okay. That's a small but also interesting advantage for low IPs.
    – Thomas
    May 21, 2010 at 14:17
2

Usually people stick with what the device shipped with - which is very often 192.168.0.1. I work in an environment where the convention is that the gateway is .254, managed switches live on .253 downwards, backup connection on .1, servers on .2 upwards.

1

I've always had the router at the bottom. Then come the servers, followed by any other devices that need or benefit from fixed addresses. Printers are at the top, also with fixed addresses. Everything in between is DHCP.

That's just the way I do it but as others have already pointed out, it makes absolutely no difference. The only thing that does matter is that you adopt a consistent scheme and stick to it. Don't forget to document it.

0

Toss a coin - it doesn't matter - what's more important is to stick with the result for all subnets to maintain consistency.

0

This is down to site practice and preferences.

The only "rule" I would suggest is whichever one you pick, be consistent. If you manage many networks or one large complex network with lots of subnets and sometimes the router is at 192.168.x.1 and sometimes its on 192.168.x.254... that is a great way to confuse everyone.

1
  • 1
    I agree, consistency is important.
    – Thomas
    May 21, 2010 at 14:24
0

It doesn't matter what IP the default gateway has, but it's good to have a consistent policy throughout the network. It's usually easiest to say "lowest usable" or "highest usable" since those two are available on any network from a /30 to a /0.

You must log in to answer this question.