Need to show server netmask in browser
I am writing a PHP script to generate a browser form which will allow an admin to view and/or change the IP settings of a Linux-based embedded PC. I can't figure out how to get the netmask value for display. I know I can exec() a system command (ifconfig eth0 blah grep blah cut) to do this, but the script executes as user www-data which means that I would have to mess with the sudoers file and the permissions of ifconfig to allow the script to execute the ifconfig command. Does anyone know of a simpler way?
It just seems odd that it's a simple matter using PHP to get the IP address of the server, but not the netmask!
Thanks in advance,
Chris
|