I need to write a script to set ip address/mask/broadcast as an alias on eth0:0 plus set the default gateway.
This solution works:
ifconfig eth0:0 <ip> netmask <mask> up
ip route replace default via <ip>
but sometimes the second call gets an error "network unavailable".
Adding a sleep between them fixes it, but is unreliable. What is the proper way to wait for the network to be ready?
The best I came up with so far is retrying the ip call a couple times. This works, but feels ugly.