How to add new device into rancid?
2 min readAug 31, 2023
Rancid is used to automates retrieval of configs & archives them. Today I will show how to add new device group into rancid.
Scenario:
Pre-requisite:
- rancid server should be installed
- access credentials of device
Add new device group into rancid
vim /etc/rancid/rancid.conf
LIST_OF_GROUPS="Routers Switches Firewalls Cisco"
#Execute bellow commad to apply the chnages.
su rancid -c "rancid-cvs"
Note: When rancid.conf file is edited, above command needs to be executed.
Above command will create following file under this directory /usr/local/rancid/var/cisco/
Add device IP into router.db file.
vim /usr/local/rancid/var/cisco/router.db
1.1.1.1;cisco,up
Add device credentials and others to .cloginrc file
vim /usr/share/rancid/.cloginrc
##Syntax
add user {ip-or-hostname} {username}
add password {ip-or-hostname} {password}
add method {ip-or-hostname} {ssh or telnet}
add autoenable {ip-or-hostname} 1
## Example
add autoenable 10.0.10.10 1
add method 10.0.10.10 ssh
add user 10.0.10.10 admin
add password 10.0.10.10 Jg278edd.fisd%1y
Test if Rancid is working or not
# Take backup
su rancid -c "rancid-run" # This will take all devices backup
su rancid -c "rancid-run cisco" # This will take all cisco group devices backup
su rancid -c "rancid-run -r 10.0.10.10" # This will take backup of 10.0.10.10
# Test if logging into a device succeed
su rancid -c "clogin 10.0.10.10"
# Test logging into a device and run a single command
su rancid -c "clogin -c 'show version' 10.0.10.10"
# Test rancid in Debug mode to find out if any issue arrise
su rancid -c "fnlogin -d 10.0.10.10"