ipcalc where have you been hiding
Somehow I've lived this long and never stumbled upon ipcalc. It made scripting a secondary interface and route file very easy. I wanted to be able to dynamically configure /etc/sysconfig/network-scripts/route-eth1 during boot. I was working on my own convoluted sed script to get the right values, but ipcalc was already there and simplified my work. Normally, I'd put something like: ADDRESS0=6.6.1.0 NETMASK0=255.255.255.0 GATEWAY0=6.6.1.1 But in Amazon, some of these values can vary and for puppet to be able to distribute to any of my environments across my AZs: VPC_CIDR_URI="http://169.254.169.254/latest/meta-data/network/interfaces/macs/${ETH0_MAC}/vpc-ipv4-cidr-block" SUBNET_CIDR_URI="http://169.254.169.254/latest/meta-data/network/interfaces/macs/${ETH1_MAC}/subnet-ipv4-cidr-block" ADDRESS0=`ipcalc -n ${VPC_CIDR_RANGE} | sed -e's/^NETWORK/ADDRESS0/'` NETMASK0=`ipcalc -m ${VPC_CIDR_RANGE} | sed -e's/^NETMASK/NETMASK0/'` GAT...