Quoting Arnau <[EMAIL PROTECTED]>:
Hi all,
Yesterday I had a problem with a server and adding/removing ips to a nic.
I have two servers and I had to switch their ips remotely. To do
that then I decided to add two extra ips to each server, then stop
the "interface" with ip that I had to switch and then leave just one
ip in each server. What I did is the following:
1.- Edit the /etc/network/interfaces of each server and add the second ip:
# The loopback interface
# automatically added when upgrading
auto lo eth0
iface lo inet loopback
iface eth0 inet static
address 192.168.10.3
netmask 255.255.255.0
gateway 192.168.10.1
#added part
auto eth0:0
iface eth0:0 inet static
address 192.168.10.4
netmask 255.255.255.0
gateway 192.168.10.1
2.- then I did ifup eth0:0 and everything goes ok, The problem is
when I want to stop the primary ip. I wasn't able to do it. With
"ifdown eth0" I stopped the whole interface and I had to call
somebody to go there an do an ifup eth0.
I tried to modify again the interfaces file and try with
/etc/init.d/network restart, even modify the file and:
ifdown eth0; /etc/init.d/network restart; ifup eth0. Nothing worked,
finally what I did was modify the interfaces and restart the server.
I think there should be a better way to do this, do you know how?
Subinterfaces must be brought up after the parent and brought down
before the parent. Thus, you can't add eth0:0 and then do an ifdown
eth0. What I have done in the past is edit the /etc/network/interfaces
to have the ip that I wanted and then something like this:
$ at now+2min
/sbin/ifdown eth0 && /sbin/ifup eth0
^D
$ exit
Then wait until after the appointed time and try to log in over the new
IP address.
-Roberto
--
Roberto C. Sanchez
http://familiasanchez.net/~roberto
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]