Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Define the list of devices
- devices=("sender1" "sender2" "router1" "router2" "receiver1" "receiver2")
- # Loop through devices and fetch interface details
- for device in "${devices[@]}"; do
- # Use SSH to fetch interface and IP details
- ssh $device "ip -brief address" | while read -r line; do
- interface=$(echo "$line" | awk '{print $1}')
- ip_address=$(echo "$line" | awk '{print $3}' | cut -d'/' -f1)
- if [[ $ip_address == 10.* ]]; then
- # Print space-separated info
- echo "$device $interface $ip_address"
- fi
- done
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement