ip addr add on boot

Latest response

I am using "ip addr add 30.1.1.200/24 dev eth0" to add an IP address to an ethernet device in order to listen on a second address.   This works fine. 

 

The question is: how do I setup this on boot?

 

The options I understand are:

 

1) /etc/rc.local - put the ip addr add command here

2) create an ifcfg-eth0:0 alias

 

Neither of these seems to be exactly what I have been looking for.   I would have thought that ifcfg-eth0 could have had some variable like IPADDR_SECOND or something.

 

Anyone know what is the best way to do this?

Responses