Networking Forums

Networking Forums > Computer Networking > Linux Networking > Adding Virtual IP Address

Reply
Thread Tools Display Modes

Adding Virtual IP Address

 
 
Vijay
Guest
Posts: n/a

 
      05-24-2004, 02:05 PM
Hi,

I have a problem in shutting down an already added virtual ip thru
ifconfig. Consider this snippet below :

/sbin/ifconfig eth0:1 192.168.220.1 netmask 255.255.255.255 up
/sbin/ifconfig eth0:2 192.168.220.2 netmask 255.255.255.255 up
/sbin/ifconfig eth0:3 192.168.220.3 netmask 255.255.255.255 up

I am adding three virtual ip address on eth0 interface. Now if I try
to down, for example, 192.168.220.2 , i don't have problems. But If I
try to down the IP, 192.168.220.1, I see that all the other virtual
ips 192.168.220.2 and 192.168.220.3 are also gone. I am not able to
ping any of the other ips also.

Now, just change the order of the snippet below :
/sbin/ifconfig eth0:2 192.168.220.2 netmask 255.255.255.255 up
/sbin/ifconfig eth0:1 192.168.220.1 netmask 255.255.255.255 up
/sbin/ifconfig eth0:3 192.168.220.3 netmask 255.255.255.255 up

Now If down the virtual ip 192.169.220.2, the other vips are also
gone.

Put simply, whenever i down the first virtual ip , all the other vips
also goes down.

Why is it so ? Am i missing something ?

Thanks,
Vijay.
 
Reply With Quote
 
 
 
 
David Efflandt
Guest
Posts: n/a

 
      05-24-2004, 06:37 PM
On 24 May 2004 07:05:53 -0700, Vijay <(E-Mail Removed)> wrote:
> Hi,
>
> I have a problem in shutting down an already added virtual ip thru
> ifconfig. Consider this snippet below :
>
> /sbin/ifconfig eth0:1 192.168.220.1 netmask 255.255.255.255 up
> /sbin/ifconfig eth0:2 192.168.220.2 netmask 255.255.255.255 up
> /sbin/ifconfig eth0:3 192.168.220.3 netmask 255.255.255.255 up
>
> I am adding three virtual ip address on eth0 interface. Now if I try
> to down, for example, 192.168.220.2 , i don't have problems. But If I
> try to down the IP, 192.168.220.1, I see that all the other virtual
> ips 192.168.220.2 and 192.168.220.3 are also gone. I am not able to
> ping any of the other ips also.


What happens if you down the alias _interface_ instead of the IP, ie,
'ifconfig eth0:1 down'? BTW the first alias is eth0:0, but it does not
matter if you skip it or start at any other number.

--
David Efflandt - All spam ignored http://www.de-srv.com/
 
Reply With Quote
 
Cameron Kerr
Guest
Posts: n/a

 
      05-24-2004, 07:54 PM
Vijay <(E-Mail Removed)> wrote:

> /sbin/ifconfig eth0:1 192.168.220.1 netmask 255.255.255.255 up
> /sbin/ifconfig eth0:2 192.168.220.2 netmask 255.255.255.255 up
> /sbin/ifconfig eth0:3 192.168.220.3 netmask 255.255.255.255 up


So what's assigned to eth0? (no alias)

--
Cameron Kerr
(E-Mail Removed) : http://nzgeeks.org/cameron/
Empowered by Perl!
 
Reply With Quote
 
Vijay
Guest
Posts: n/a

 
      05-25-2004, 10:07 AM
Cameron Kerr <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Vijay <(E-Mail Removed)> wrote:
>
> > /sbin/ifconfig eth0:1 192.168.220.1 netmask 255.255.255.255 up
> > /sbin/ifconfig eth0:2 192.168.220.2 netmask 255.255.255.255 up
> > /sbin/ifconfig eth0:3 192.168.220.3 netmask 255.255.255.255 up

>
> So what's assigned to eth0? (no alias)


eth0 has my machine IP (original ipaddress). I also tried shutting
down the interface using the following command as u mentioned, but in
vain.

'ifconfig eth0:1 down'

Thanks,
Vijay.
 
Reply With Quote
 
Vijay
Guest
Posts: n/a

 
      05-25-2004, 11:18 AM
Cameron Kerr <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Vijay <(E-Mail Removed)> wrote:
>
> > /sbin/ifconfig eth0:1 192.168.220.1 netmask 255.255.255.255 up
> > /sbin/ifconfig eth0:2 192.168.220.2 netmask 255.255.255.255 up
> > /sbin/ifconfig eth0:3 192.168.220.3 netmask 255.255.255.255 up

>
> So what's assigned to eth0? (no alias)


Phew !!! I have configured the vips using the netmask as 255.255.255.0
and not 255.255.255.255 as mentioned in this mail. u ppl might have
helped, but for the typo. I m sorry. It works now.

Thanks for all ur efforts.

Vijay.
 
Reply With Quote
 
P Gentry
Guest
Posts: n/a

 
      05-25-2004, 03:36 PM
(E-Mail Removed) (Vijay) wrote in message news:<(E-Mail Removed) om>...
> Cameron Kerr <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> > Vijay <(E-Mail Removed)> wrote:
> >
> > > /sbin/ifconfig eth0:1 192.168.220.1 netmask 255.255.255.255 up
> > > /sbin/ifconfig eth0:2 192.168.220.2 netmask 255.255.255.255 up
> > > /sbin/ifconfig eth0:3 192.168.220.3 netmask 255.255.255.255 up


Of course, you know that there is no "real" /32 network -- wonder if
that is also part of the gotcha? See below ...

> > So what's assigned to eth0? (no alias)

>
> eth0 has my machine IP (original ipaddress). I also tried shutting
> down the interface using the following command as u mentioned, but in
> vain.
>
> 'ifconfig eth0:1 down'
>
> Thanks,
> Vijay.


You may be running into a shortcoming of ifconfig -- all things ip in
Linux run through the ip command. ifconfig uses ip for relatively
simple tasks but has not been re-written to interface with ip to
handle "aliases" very well.

With the extensive re-working of the IP stack in 2.2.?? links
(interfaces) and ip addresses are treated independently -- adds
greater flexibility to the configuration and routing code, etc.

Currently, with your approach, it _seems_ the first ip address you
assign is a "primary" address, the following are "secondary"
addresses. ip behavior is that if you delete the primary, the
secondaries will also be deleted. The details are not well documented
and I don't understand all the ramifications myself -- another gotcha
is that interfaces are referenced by index # in the code and
_sometimes_ the order of configuration matters (like here?). Not sure
just how ifconfig uses ip, but your netmask of /32 would be the
"right" approach with ip -- all primaries -- but the alias naming
causes a hiccup ...?

You should have a copy of ip-cref on your machine, or try here for an
html version:
http://linux-ip.net/gl/ip-cref/
There is a script -- ifcfg -- at the end that may help or shed light
....

This thread is not a full discussion, but may get you started ...
http://www.uwsg.iu.edu/hypermail/lin...10.3/0003.html
note: I was too busy to chase down the start

Have you tried adding/deleting the addresses with ip instead of
ifconfig? The "best" way may also depend on how/why you're using the
addresses.

Working through qdiscs can seem simple compared to some of the quirks
of ip/ifconfig ;-(

hth,
rpg
email above disabled
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bind outgoing mail connects to virtual ip address? Jack Snodgrass Linux Networking 4 03-13-2008 02:52 PM
virtual IP address - ssh problem Eggert Ehmke Linux Networking 2 12-13-2006 01:56 PM
Virtual MAC/ IP Address calculation Peter Weiss Linux Networking 2 11-26-2005 07:17 PM
Adding virtual NIC (ie: alias) to multi-homed server Brian Linux Networking 0 08-05-2005 12:48 PM
Adding an IP address? Rush Windows Networking 1 11-13-2003 09:25 AM



1 2 3 4 5 6 7 8 9 10 11