cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
344
Views
20
Helpful
7
Replies
Beginner

Unable to connect two routers with a switch.

Hello all,

 

I need to connect two routers (IP: 10.1.1.2/24 (router 1) and 10.1.1.1/24 (router 2)) with a switch and be able to ping router router 1 from router 2. I executed below commands but so far, it is not working.

 

R1(config)#int fa0/0

R1(config-if)#ip address 10.1.1.2 255.255.255.0

R1(config-if)#no shut

 

R2(config)#int fa0/0

R2(config-if)#ip address 10.1.1.1 255.255.255.0

R2(config-if)#no shut

 

Switch(config)#int fa0/0

Switch(config-if)#ip address 10.1.1.3 255.255.255.0

Switch(config-if)#no shut

Switch(config-if)#int fa0/1

Switch(config-if)#ip address 10.1.1.4 255.255.255.0

% 10.1.1.0 overlaps with FastEthernet0/0

 

Please let me know if you have any suggestion.

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
VIP Advisor

Re: Unable to connect two routers with a switch.

Try below config  on switch :

 

config t

vlan 10 <<-- you can create any vlan here - make sure access port belong to same vlan

Switch(config)#int fa0/0
Switch(config-if)#switch mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#no shut

Switch(config-if)#int fa0/1
Switch(config-if)#switch mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#no shut
!
interface vlan 10
ip address 10.1.1.3 255.255.255.0
no shut
!
end
wr

BB
*** Rate All Helpful Responses ***
7 REPLIES 7
VIP Advisor

Re: Unable to connect two routers with a switch.

Try below config  on switch :

 

config t

vlan 10 <<-- you can create any vlan here - make sure access port belong to same vlan

Switch(config)#int fa0/0
Switch(config-if)#switch mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#no shut

Switch(config-if)#int fa0/1
Switch(config-if)#switch mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#no shut
!
interface vlan 10
ip address 10.1.1.3 255.255.255.0
no shut
!
end
wr

BB
*** Rate All Helpful Responses ***
Beginner

Re: Unable to connect two routers with a switch.

Hello Balaji,

After creating a VLAN and using switchport commands, the problem is solved.

Thank you very much for your help.

Best regards.
Advocate

Re: Unable to connect two routers with a switch.

Hi @Impisnoth 

 

If you are working on PacketTracer, compress your exercise (winzip) and attach it to review.

Theoretically, you should not be able to enter an IP into the physical interfaces of a layer2 switch, so I would like to see your exercise.

Regards

 

Beginner

Re: Unable to connect two routers with a switch.

Hello Luis,

I am using GNS3. After creating a VLAN and using switchport commands, the problem is solved.

Thank you.
VIP Advocate

Re: Unable to connect two routers with a switch.

Hi,

Try with below commands:

vlan 100

!

interface VLAN 100

IP address 10.1.1.3 255.255.255.0

!

interface range fa0/0, fa0/1

Description "Connected-to-Routers"

switchport mode access

switch access vlan 100

!

!

 

Why are you failed? You failed to add because we can't add an overlapping subnet on two difference Layer 3 interfaces in a single switch or router without any virtualization option such as VRF.

 

 

Regards,
Deepak Kumar,
Don't forget to vote and accept the solution If this comment will make help you!
Highlighted
Hall of Fame Master

Re: Unable to connect two routers with a switch.

The original post presents a pretty simple requirement: 2 routers, connecting their interface to a switch must be able to ping each other. The proposed router config in the original post is reasonable - it puts IP addresses in the same subnet on the router interfaces and does no shut. On the switch the requirement can be achieved by putting the 2 switch interfaces connecting to the routers in to the same vlan, it might be vlan 1 or might be vlan 10, or might be whatever vlan number you like (and making the switch interfaces access ports) and perhaps no shut on the interfaces.  While it might be nice for the switch to have an IP address, in terms of the original requirement that the routers connect to a switch and be able to ping each other I do not see any requirement for the switch to have an IP address.

 

HTH

 

Rick

Beginner

Re: Unable to connect two routers with a switch.

Hello Deepak,

Problem is solved after creating VLAN and using switchport commands.

Thank you.
CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards