I'm wondering if it's possible to dynamically read in the IP addresses of network interfaces for use in a bash script. Something like:
#!/bin/bash
MYPUBLICIP= get_eth0_address
MYPRIVATEIP= get_eth0:0_address
- How would I go about this?
- Is it possible to distinguish between eth0 and the virtual eth0:0?
[Background] I'm trying to write a script to apply various rules to iptables for a set of VPSs. I'm trying to avoid having to fiddle around with the individual IPs of each machine.