Vlan – Inter VLAN Routing with same subnet IP

vlan

I am having 2 VLAN
VLAN1 – IP range 192.168.1.100 to 192.168.1.149 subnet 255.255.255.0 i.e. I have 50 host in VLAN1
VLAN2 – IP range 192.168.1.200 to 192.168.1.249 subnet 255.255.255.0 i.e. I have another 50 host in VLAN2

Now I want to communicate in between the above 2 VLAN, for that I can place router with multiple sub interface equal to number of VLAN's i.e. in our case 2. The issue is that same subnet IP cannot be assigned to different sub-interface over the router.

As a solution to this I see many tutorials using complete different set of IP having differing by subnet. But then what is point to subnet, since we already have altered the subnet. That can be done any way even without VLAN.

What is the solution keeping same subnet IP's. Do share some tutorial or configured .cpt file.

Best Answer

There's some confusion here.

I suppose you wanted to say :

VLAN1 IP range 192.168.1.100 - 199   
VLAN2 IP range 192.168.1.200 - 299

First the IP range 192.168.1.200 - 299 doesn't exist, an IP address cannot be higher than x.x.x.255. IP addresses are binary numbers, coded on 32 bits. The decimal representation "192.168.1.200" is just that, a representation of a binary number, made to be more conveniently handled by human.

The fourth number in the decimal notation correspond to the last 8 bits in binary. 8 bits in binary give 256 value in decimal, thus 0 -> 255.

Second routing deal with networks / subnetworks, not IP range, and those network are also truly expressed in binary, so they are bound by power of 2 addresses.

192.168.1.100 to 199 doesn't correspond to a network so you can't route this sole specific network range.

192.168.1.0/24 is a network that contains 256 IP addresses and can be divided for example in 4 subnets like

192.168.1.0/26 I.E. 192.168.1.0 to 63
192.168.1.64/26 I.E. 192.168.1.64 to 127
192.168.1.128/26 I.E. 192.168.1.128 to 192.168.1.191
192.179.1.192/26 I.E. 192.168.1.192 to 192.168.1.255

You need to redesign your addressing to fit in actual networks.

You will find more information about subnet in this excellent answer :

How do you calculate the prefix, network, subnet, and host numbers?

Edit
if you want to have 2 VLANs with 50 host in each you can use:

VLAN1 with network 192.168.1.0/26
VLAN2 with network 192.168.1.64/26

On your router you set:

  • VLAN1 interface with IP 192.168.1.1 , subnet mask 255.255.255.192
  • VLAN2 interface with IP 192.168.1.65, subnet mask 255.255.255.192

In the first vlan you can use IP addresses 192.168.1.2 to 192.168.1.62, so 61 possible hosts

In the second vlan you can use IP addresses 192.168.1.66 to 192.168.1.126, so again 61 possible hosts.

Why 61 and not 64?
Well first it's actually 62, since the router IS a host but you usually don't count it as a machine that can be connected in the network.
Second the network address and the broadcast address are reserved and cannot be used by hosts.

Once again you CANNOT decide to have a (sub)network that has an arbitrary number of IP (like 50), it's always a power of 2 size (minus the network and broadcast address).