cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1633
Views
0
Helpful
11
Replies

layer 3 to layr2

Network Pro
Level 1
Level 1

Hi,

if i want to connect a layer 3 (router ) to layer 2 (Switch) connection, what wikll be the config ( i would like to allow the entire 172.21.x.x range)

router - 172.21.10.1 ip address

switch - trunk mode

can you please provide me with the config


Thanks

11 Replies 11

Peter Paluch
Cisco Employee
Cisco Employee

Hello,

If you are connecting a router to a switch then there is no special configuration required at all, assuming you are not using the router to route between several VLANs. In this simple case, you configure the router with the usual configuration:

interface FastEthernet0/0

ip address 172.21.10.1 255.255.255.0

no shutdown

And you connect it to a switchport configured for access mode in the same VLAN as the remaining ports where the stations in the network 172.21.10.0/24 are connected, for example, VLAN 1 and port Fa0/24:

interface FastEthernet0/24

switchport mode access

switchport access vlan 1 ! This is the default

Alternatively, you could use a different VLAN, say, VLAN 10 for this deployment. The configuration on the router would remain exactly the same. The switchport configuration would be slightly different:

interface FastEthernet0/24

switchport mode access

switchport access vlan 10

Note that in this case, also other ports leading to stations in the 172.21.10.0/24 network must be placed into VLAN10.

Your requirement is described a little too briefly - if this does not answer your question then please provide more information about what is your network topology and what are you trying to achieve.

Best regards,

Peter

Peter is correct.  The only thing that I would change is the subnet mask.  Assuming you wanted to allow the whole 172.21.x.x (or 172.21.0.0/16) range, using 172.21.10.1 as the gateway your config on the router would be:

interface FastEthernet0/0

ip address 172.21.10.1 255.255.0.0

no shutdown

Antonio,

Thanks for the update. Yes, you are correct... I have slightly ignored the OP's indicated address space.

Best regards,

Peter

Thanks for the replies.

this is my requirment

router ip address 172.21.100.3

I have the following vlans on my switches

switch vlan1 - 172.21.1.x

switch vlan2 - 172.21.2.x

switch vlan3 - 172.21.3.x

say if i add more and would like to allow the whole of 172.21x.x range then what would be the config ?

say in the above example my config is as below

router

int fas0/1

ip address 172.21.100.3 255.255.255.0

no shu

switch

int vl 1

ip address 172.21.1.1 255.255.255.0

int vl100

ip address 172.21.100.1 255.255.255.0

int fas0/1

swithport mode trunk

the above wouldnt work, would it as its diffenerent subnet (only vlan 100 would be allowed, and not vlan 1 - since same subnet)

so we need to create a sub interface on the router, isnt it ?

int fas0/1

ip address 172.21.100.3 255.255.255.0

int fas0/1.1

ip address 172.21.1.3 255.255.255.0

will the abvoe work ?

if the above works, then if i want to allow whole of 172.21.x.x range then what do i do ?

do i just create on the router

int fas0/1

ip addrss 172.21.100.3 255.255.0.0

will the abvoe work as per your explanation ?

please let me know (also the alternative of adding a default route on the router will it solve the problem ?)

Thanks

any thoughts on the above pls ?

From your description, you want to route multiple subnets. There are two ways to do it.

Router on a stick configuration:

- Need to create a sub-interface for every vlan you want to route.

1. Router config:

int fa0/1

no ip address

int fa0/1.1

ip address 172.21.1.2 255.255.255.0

enacapsulation dot1q 1 native

int fa0/1.2

ip address 172.21.2.2 255.255.255.0

enacapsulation dot1q 2

int fa0/1.100

ip address 172.21.100.1 255.255.255.0

enacapsulation dot1q 100

...

Switch:

int fa0/24

switchport trunk encapsulation dot1q

switchport mode trunk

int vlan 1

ip address 172.21.1.1 255.255.255.0

int vlan 100

ip address 172.21.100.1 255.255.255.0

...

2. Routed option: This requires a L3 capable switch. What switch do you have?

Hope this helps. Here is a link whic explains router on a stick configuration.

http://www.cisco.com/en/US/tech/tk389/tk815/technologies_configuration_example09186a00800949fd.shtml

AJ

thanks for the reply ajasti..i understand router on stick config..my doubt is ..what will be the output of this ?

router

int fas0/1

ip address 172.21.100.3 255.255.0.0 (please note /16 subnet mask)

no shu

switch (please note /24 bit mask)

int vl 1

ip address 172.21.1.1 255.255.255.0

int vl100

ip address 172.21.100.1 255.255.255.0

int vl 2

ip address 172.21.2.1 255.255.255.0

int fas0/1

swithport mode trunk


will the above work?

also if i make the trunk to a access port on the switch, should i just be able to ping from the native vlan - vlan 1 ?

please let me know

thanks

Will the above work?

NO. Router will send the traffic to switch but switch will drop it. ARP will also not get resolved properly. Also all packets (except in vlan1) will be dropped as invalid packets (due to presence of dot1q tag in them).

also if i make the trunk to a access port on the switch, should i just be able to ping from the native vlan - vlan 1 ?

YES.

AJ.

but as per Anotnio and Peter's comment, they have said anything in /16 subnet should work? so  i am confused now ?

so what will be the way to allow the whole of 172.21.x.x range ?