03-06-2024 05:18 AM
I am trying to manage a Catalyst 2960 switch with Ansible. The ansible controller is installed on a Linux VM. I haven't been able to SSH to the switch from the controller despite the service being enabled on the switch and the controller.
Connection:
- PC connected to switch with an ethernet cable. The port is configured with an IP in the same subnet as the VM.
Switch configuration
version 12.2
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname ansible
!
boot-start-marker
boot-end-marker
!
!
username mikko privilege 15 password 0 P@ssw0rd
username pocha privilege 15 secret 5 $1$OgQZ$HheCqdqxYg5az5KEaTrNV.
no aaa new-model
system mtu routing 1500
ip subnet-zero
!
ip domain-name ansible.bh
!
!
!
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
ip ssh version 1
!
!
interface FastEthernet0/1
switchport mode access
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
ip address 192.168.7.17 255.255.255.0
no ip route-cache
!
ip http server
ip http secure-server
!
control-plane
!
!
line con 0
line vty 0 4
login local
transport input ssh
line vty 5 15
login local
transport input ssh
!
end
Whenever I try to ssh to the switch from the vm, I get a 'no route to host' error. Pinging gives a destination unreachable error.
I've tried to ssh to the switch using Putty, but the connection timed out.
Is it actually possible to manage the switch using Ansible with the current setup?
Solved! Go to Solution.
03-09-2024 10:56 PM
I added another Bridged adapter with PC attached to F0/1, no luck.
I also set a static IP on the Linux VM for the other adapter to be in the same subnet, but still unable to ping the switch.
I'm not sure if the adapter type matters because from what I read it wouldn't make any difference in this case.
The PC itself can ping and SSH to the switch just fine, so I'm pretty sure the problem lies somewhere in the VM, just don't know where.
03-10-2024 12:18 AM
Change the Promiscuous Mode for the Bridged Adapter, Adapter 1, to Allow.
03-10-2024 03:23 AM - edited 03-10-2024 03:23 AM
I tried that, but still unable to ping.
I setup a static IP connection for the ethernet interface on Linux. Before that, the ethernet would just not connect at all
03-10-2024 04:51 AM
It's more than sure a problem related to VirtualBox or it's configuration. I presume that pinging the switch from the PC on which you installed VirtualBox is successful.
I think you would get more info on a Oracle/VirtualBox forum.
03-10-2024 05:52 AM
The PC can indeed ping and SSH to the switch.
I shall head over to VB forums then. Thank you so much for the time and effort!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide