Updated getv4

main
Jay Moore/NQ4T 1 year ago
parent bbfbcbf504
commit ee83e5acfb

@ -1,12 +1,16 @@
/*
GetV4: Check IP Service for pfSense
10-APR-2023 - dewdude@pickmy.org
GetV4: Self-Hosted Check IP Service
12-APR-2023 - dewdude@pickmy.org
https://git.pickmy.org/dewdude/HEDyn
*/
// Place this file along with getv4.sh in /usr/local/www
// Place this file along with getv4.sh in /usr/local/www on pFSense
// or elsewhere if running on different system. Change script path.
// Change comments for "old" style display if needed.
<?php
$output = shell_exec('/usr/local/www/getv4.sh');
echo "$output";
//echo "Current IP Address: $output";
?>

@ -1,12 +1,15 @@
#!/bin/sh
# GetV4 IP Check Service for pfSense - shell script
# APR-10-2023 - Jay Moore (dewdude@pickmy.org)
# APR-12-2023 - Jay Moore (dewdude@pickmy.org)
# https://git.pickmy.org/dewdude/HEDyn
# Modify "em0" to match your interface name. Place in
# Modify `dev` to match your interface name. Place in
# /usr/local/www along with getv4.php.
# Make sure script is +x
ifconfig em0 | grep inet | awk -F '[ \t]+|/' '{print $3}' | grep -v ^fe80
dev=em0
ifconfig $dev | awk '/inet/ && !/inet6/ {print $2}'
#ip -4 addr show dev $dev | awk '/inet/ {print $2}' # for machines using `ip`

Loading…
Cancel
Save