cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1102
Views
20
Helpful
7
Replies

Unable to connect two routers with a switch.

Ylli
Level 1
Level 1

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

balaji.bandi
Hall of Fame
Hall of Fame

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 *****

How to Ask The Cisco Community for Help

View solution in original post

7 Replies 7

balaji.bandi
Hall of Fame
Hall of Fame

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 *****

How to Ask The Cisco Community for Help

Hello Balaji,

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

Thank you very much for your help.

Best regards.

luis_cordova
VIP Alumni
VIP Alumni

Hi @Ylli 

 

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

 

Hello Luis,

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

Thank you.

Deepak Kumar
VIP Alumni
VIP Alumni

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 help you!

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

HTH

Rick

Hello Deepak,

Problem is solved after creating VLAN and using switchport commands.

Thank you.
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:

Review Cisco Networking products for a $25 gift card