# CARP source ip



## tpfiler (Oct 6, 2020)

Is there a way to setup CARP for it to send packets with the carp ip as the source ip?

I currently have carp setup with 2 VM's. When I do packet captures to test pings I see the interface ip as the source and not the carp ip.

Any guidance would be much appreciated.

Thank you.


----------



## Jose (Oct 8, 2020)

We're going to need more information. How are your interfaces configured? Are the CARP addresses and interface addresses in the same subnet?


----------



## SirDice (Oct 9, 2020)

tpfiler said:


> When I do packet captures to test pings I see the interface ip


Use the `-S` option with ping.


```
-S src_addr
             Use the following IP address as the source address in outgoing
             packets.  On hosts with more than one IP address, this option can
             be used to force the source address to be something other than
             the IP address of the interface the probe packet is sent on.  If
             the IP address is not one of this machine's interface addresses,
             an error is returned and nothing is sent.
```


----------



## tpfiler (Jan 6, 2021)

Jose said:


> We're going to need more information. How are your interfaces configured? Are the CARP addresses and interface addresses in the same subnet?


Thank you and sorry for the late reply. Yes they are in the same subnet.


----------



## tpfiler (Jan 6, 2021)

SirDice said:


> Use the `-S` option with ping.
> 
> 
> ```
> ...


Thank you SirDice, so by default icmp protocol will use the interface outgoing ip and not the carp ip, right?


----------



## SirDice (Jan 7, 2021)

tpfiler said:


> so by default icmp protocol will use the interface outgoing ip and not the carp ip, right?


Everything (not only ping) will use the first IP address on the interface, that's usually the IP of the host, the CARP address is an alias. So your applications/services will need to be configured to bind to the CARP address too.


----------

