You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
253 B
Bash
12 lines
253 B
Bash
4 years ago
|
#!/bin/sh
|
||
|
|
||
|
function arp {
|
||
|
printf "$(cat /proc/net/arp)"
|
||
|
}
|
||
|
|
||
|
gateway_ip="$(ip route | grep default | awk '{print $3}')"
|
||
|
ping -c 1 "$gateway_ip" -W 1 &> /dev/null
|
||
|
gateway_mac="$(arp | grep -w "$gateway_ip" | awk '{print $4}')"
|
||
|
|
||
|
echo "$gateway_mac"
|