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

Connecting various subnets

The Learned
Level 1
Level 1

Hello everyone, I am new to networking and was wondering if someone could explain to me how switch/router handles multiple subnets.

Lets say i have 3 subnets/ip ranges mentioned below

10.0.0.1 to   10.15.255.254
10.16.0.1   to 10.31.255.254
10.32.0.1   to 10.47.255.254

i want them to be able to talk to each other and also have access to the internet. lets say i have one router. outside interface will have a public ip. on the internal interface, i'd have one ip as well. so how can 3 of my subnets which will have 3 different gateway address communicate to the same router?

thanks in advance.

5 Replies 5

cadet alain
VIP Alumni
VIP Alumni

Hi,

if you want them to talk to each other, you must route between them. Now what you would have is each subnet = 1 VLAN

and you must use either Router on A Stick( using a router with subinterfaces in different VLANs) or a L3 switch( with a SVI per subnet).If you use the second way then you can either have a routed port for connecting to external router(usually a /30) or you can have a dedicated vlan with a /30 SVI and put an access port going to the external router.

Now you'll have to put a static default pointing to IP of external router.On the router you'll need a route for each subnet(VLAN) pointing to the L3 switch.

If you need config example, I'll post one.

Regards.

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.

thank you alain for the reply. i am totally new so i am not familiar with the methods you mentioned. i will try looking it up but if you could post the config as well that would be great. it will help me understand better.

thanks again

Hi,

ok let's suppose this:

10.0.0.0/20 is in VLAN 10

10.16.0.0/20 is in VLAN 20

10.32.0.0/20 is in VLAN 30

we have :

-PC in VLAN 10 connected to f0/1 of  switch SW1

its IP config is

IP address 10.0.0.1

default gateway 10.0.0.254

-PC in VLAN 20 connected to f0/2 of  switch SW1

its IP config is

IP address 10.16.0.1

default gateway 10.16.0.254

-PC in VLAN 30 connected to f0/3 of  switch SW1

its IP config is

IP address 10.32.0.1

default gateway 10.32.0.254

the switch is a  L3 switch and it is connected to a border router through f0/4

Here is the config of the switch:

enable

config t

ip routing

ip route 0.0.0.0 0.0.0.0 172.16.1.2

vlan 10,20,30

int f0/1

switchport mode access

switchport access vlan 10

int f0/2

switchport mode access

switchport access vlan 20

int f0/3

switchport mode access

switchport access vlan 30

int f0/4

no switchport

ip address 1172.16.1.1 255.255.255.252

int vlan 10

ip address 10.0.0.254 255.240.0.0

int vlan 20

ip address 10.16.0.254 255.240.0.0

int vlan 30

ip address 10.32.0.254 255.240.0.0

On the router:

ip route 0.0.0.0 0.0.0.0 x.x.x.x

int f0/0

ip address 172.16.1.2 255.255.255.252

no shutdown

Now let's suppose the switch is L2 then you can use RoAS:

on the switch:

enable

config t

vlan 10,20,30

int f0/1

switchport mode access

switchport access vlan 10

int f0/2

switchport mode access

switchport access vlan 20

int f0/3

switchport mode access

switchport access vlan 30

int f0/4

switchport mode trunk

switchport allowed vlan 10,20,30

on the router:

ip route 0.0.0.0 0.0.0.0 x.x.x.x

int f0/0

no ip address

no shutdown

int f0/0.10

encapsulation dot1q 10

ip address 10.0.0.254 255.240.0.0

int f0/0.20

encapsulation dot1q 20

ip address 10.16.0.254 255.240.0.0

int f0/0.30

encapsulation dot1q 30

ip address 10.32.0.254 255.240.0.0

   Regards.

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.

thank you so much. i will give it a try when i get a chance.

Are this IPs configured on routers Fa/ interfaces or S0/ interfaces because if they are configured on Fa interfaces then the switch connecting to the Fa interface of the router will be able to foward any information going to any computer having any of the IPs you have listed. in as much they belong to thesame IP network.

Subnet is only to create allocation of IPs to specified groups or department.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco