I know that the command ifconfig
will give you ip, mask and gateway of a given network interface. I want to "programmatically" extract each of those paramaters separately. At the moment the best solution I can think of is to do some parsing by using grep
.
Are there ifconfig
flags to single out ip, mask or gateway? Are there other *nix commands that will extract just one parameter of a given network interface?
Theses are not very elaborates but seems to work at least:
for bond0:
Get the IP
Get the the broadcast address:
Get the netmask:
and for the Gateway:
sure someone will get there with something more simple or straighforward.
Hope this helps.