# simple CARP question



## einthusan (May 23, 2012)

If ServerA and ServerB are sharing a carp IP address and that IP address is an alias for the NIC on ServerA, can we still use CARP? If yes, what if serverA goes down, the IP address is not accessible anymore, wouldn't CARP fail?


----------



## SirDice (May 23, 2012)

einthusan said:
			
		

> If ServerA and ServerB are sharing a carp IP address and that IP address is an alias for the NIC on ServerA, can we still use CARP?


No, that would defeat the entire purpose of CARP. Besides that, you're bound to get all sorts of "duplicate IP address" errors.


----------



## einthusan (May 23, 2012)

So do I need 3 machines to setup CARP? I thought I only need 2 servers..

Do dedicated server providers hand out static ip addresses that are not associated to any specific machine? I am not sure how this works.


----------



## SirDice (May 23, 2012)

einthusan said:
			
		

> So do I need 3 machines to setup CARP? I thought I only need 2 servers..


Two servers, each with their own IP addres. They share one 'virtual' interface between them. It's that virtual address you use for CARP. So, in total you have 3 IP addresses assigned, two physical and one virtual.


----------



## einthusan (May 23, 2012)

SirDice said:
			
		

> Two servers, each with their own IP addres. They share one 'virtual' interface between them. It's that virtual address you use for CARP.



Yes, I have two servers each with their own dedicated static IP address. Sorry about all the confusion. The part I'm having difficulties understanding is where do i get the IP address for the virtual interface. I understand this virtual interface must also be a static IP address facing the public internet, but I don't know where to get it.


```
|-----------------|     |-----------------| 
|Server A - IP 01 |     |Server B - IP 02 |
|-----------------|     |-----------------|
            ^                          ^
            |       --------------     |
            |_______|Virtual IP  |_____|
                    |------------|
                           ^
                           |
                           |
                    |---------------| 
                    |  Client       |
                    |---------------|
```


----------



## SirDice (May 23, 2012)

Your network administrator or hosting provider will supply you with IP addresses. The address on the CARP interface can be from the same subnet as the two physical addresses on the machines.

So, assuming you've been assigned a 10.0.0.0/24 range you can put

Server A = 10.0.0.1
Server B = 10.0.0.2
CARP     = 10.0.0.3

Clients will connect to the 10.0.0.3 address.


----------



## einthusan (May 23, 2012)

Awesome Thanks! I didn't know that was possible! I contacted the service provider and they have assigned me a 'portable' static ip block that can be used by multiple servers on the same VLAN. I bet this is what I needed. I was so confused before as to how an IP address can just float around without being bound to a specific servers NIC. Everything makes sense now, I will mark this thread as solved! Thanks.


----------



## SirDice (May 23, 2012)

einthusan said:
			
		

> I contacted the service provider and they have assigned me a 'portable' static ip block that can be used by multiple servers on the same VLAN. I bet this is what I needed.


That's exactly what you needed


----------

