cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2902
Views
5
Helpful
9
Replies

Should the gw of an ip address always be in the same range of the ip address itself ?

Odys (CSC)
Level 1
Level 1

Hello guys,

As far as i know, the gateway of a certain public ip address should be in the range of the ip addres itself.

for instance:

ip: x.x.x.2 , gw: x.x.x.1

However I've heard from our senior that in case of L2 connections, the gateway isn't really necessary to be in the same range.

for instance:

ip: x.x.x.2 , gw: y.y.y.254

Can someone explain to me how this is possible ?

thanks

1 Accepted Solution

Accepted Solutions

There are several aspects to this discussion and it seems to me that we are getting them a bit confused.

One aspect is a layer 3 question of whether the default gateway for a device IP address should be in the same range as the IP address itself. I believe that the discussion has been fairly clear that yes the default gateway "should" be in the same range as the IP address, but that there are some circumstances where the device still works and has connectivity to outside when the default gateway is not in the same range as the IP address.

Another aspect is a layer 2 question and in layer 2 there is no concept of default gateway. So when we discuss layer 2 functionality there is no requirement about default gateway.

Part of the confusion may be that the situation we are dealing with apparently uses pppoe. PPP uses a combination of layer 2 processes (especially the Ethernet part of pppoe) and part uses layer 3 processes (especially the part where it negotiates layer 3 addresses). The senior is correct that a layer 2 ppp connection does not use gw. But the question in this discussion is not just layer 2.

The fundamental part of the question is that different results are obtained when pinging x.x.x.1 or x.x.x.2. I do not believe that there has been any real knowledge of the relationship between x.x.x.1 and x.x.x.2. I have not seen anything that demonstrates that either one is necessarily the gw of the other.

HTH

Rick

HTH

Rick

View solution in original post

9 Replies 9

Jon Marshall
Hall of Fame
Hall of Fame

The short answer to your question is yes and to do anything else really isn't recommended.

Not entirely sure what your senior was saying as the default gateway is used to send traffic to a remote subnet which is L3.

He may be talking about L2 switches, for example, and having a different or no default gateway and still being able to send packets to remote subnets via a L3 device.  

If so he is probably referring to proxy arp which would allow this to happen but really shouldn't be relied upon.

So he may say it is not really necessary but I would say why would you not configure it correctly because it works and it is less likely to cause any confusion for anyone else looking at the configurations.

Jon

I agree with Jon that we need a better understanding of what your senior was saying, and the context in which he said it.

Technically speaking when we are at layer 2 there is no default gateway. So from a layer 2 perspective it does not matter where the gateway is because there is no need to access the gateway when we are forwarding at layer 2. But when we are looking at layer 3 there is a need for a gateway and things work much better when the gateway is in the same subnet as the IP address we are dealing with.  I have seen situations where a device with an IP address in one subnet was configured with a gateway that was in a different subnet and things worked. But as Jon has said this requires that proxy arp be enabled. And we should not on purpose set things up so that they depend on proxy arp.

Going back to the original question: "Should" the gateway always be in the same range as the IP address? I would say that Yes it SHOULD be in the same range. Bear in mind that Should is not the same as Must. So if the question is Must the gateway always be in the same range as the IP address then the answer is no, that there are ways to get it to work when the gateway is in a different range from the IP address. But that as Best Practice Yes the gateway should always be in the same range as the IP address.

HTH

Rick

HTH

Rick

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages wha2tsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

As a side note, concerning proxy ARP, as mentioned by both Jon and Rick, in a different thread, I mentioned proxy ARP would allows hosts, without a defined gateway could go off the local network if the gateway supported proxy ARP.  Peter Paluch then added a note that many newer hosts use a local route table and wouldn't work with a proxy ARP gateway.

Odys (CSC)
Level 1
Level 1

Let me clear it up:

When I ping a cable internet subscriber's ip address (say x.x.x.2) from outside his network, i get a 0% packet loss. When i ping x.x.x.1 (supposing this is the gateway) i get 10% packet loss. Which seems weird to me.

When I asked the senior he told me exactly what Richard has said:

"Technically speaking when we are at layer 2 there is no default gateway. So from a layer 2 perspective it does not matter where the gateway is because there is no need to access the gateway when we are forwarding at layer 2."

In other words "x.x.x.2 isn't x.x.x.1's gw. its just a router somewhere in the core network of isp. and this customer is connected through a l2 3th party infrastructure before he gets into the isp's network"

Is there any network diagram for such a connection you can post ? I'd like to understand how it looks like.

If you ping between two devices in the same vlan/IP subnet then default gateways don't come into it because the traffic is L2 switched.

If you ping between two devices in different IP subnets then default gateways do matter because the traffic has to be routed.

That is what the statement you highlighted meant but your interpretation of that statement has left me somewhat confused.

Perhaps you could clarify ?

Jon

I'm afraid you've got me wrong.

I didn't ping between a LAN devices. I pinged from outside the lan (say u.u.u.55) to an ip address (x.x.x.2) and its gateway (x.x.x.1) learned by the edge router via a dhcp ppoe connection.

But the senior says that x.x.x.1 isn't the gateway. a L2 ppp connection doesn't use gw.

All i'm asking is an article/discussion/video going over this technology.

There are several aspects to this discussion and it seems to me that we are getting them a bit confused.

One aspect is a layer 3 question of whether the default gateway for a device IP address should be in the same range as the IP address itself. I believe that the discussion has been fairly clear that yes the default gateway "should" be in the same range as the IP address, but that there are some circumstances where the device still works and has connectivity to outside when the default gateway is not in the same range as the IP address.

Another aspect is a layer 2 question and in layer 2 there is no concept of default gateway. So when we discuss layer 2 functionality there is no requirement about default gateway.

Part of the confusion may be that the situation we are dealing with apparently uses pppoe. PPP uses a combination of layer 2 processes (especially the Ethernet part of pppoe) and part uses layer 3 processes (especially the part where it negotiates layer 3 addresses). The senior is correct that a layer 2 ppp connection does not use gw. But the question in this discussion is not just layer 2.

The fundamental part of the question is that different results are obtained when pinging x.x.x.1 or x.x.x.2. I do not believe that there has been any real knowledge of the relationship between x.x.x.1 and x.x.x.2. I have not seen anything that demonstrates that either one is necessarily the gw of the other.

HTH

Rick

HTH

Rick

I think -herewith-  the main question in the subject has been answered.

For further queries regarding L2 pppoe network I'll start a separate discussion .

Thank to Rick

Garry

Garry

It has been an interesting discussion and I am glad that our suggestions have been helpful. Thank you for using the rating system to mark this question as answered. Indeed the original question is answered, and a new question emerged. A separate discussion is the best way to investigate that new question. It might be helpful in that new discussion to post a link to this discussion in case something help provides helpful background for the new question.

HTH

Rick

HTH

Rick
Review Cisco Networking products for a $25 gift card