LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-10-2023, 04:42 AM   #1
testsia
LQ Newbie
 
Registered: Apr 2023
Posts: 2

Rep: Reputation: 0
Centos7 carp default ip


Hi all. I ask for the help of specialists, as my head is already spinning. There are two Centos 7 servers, the Carp protocol is configured on them. It works and ip goes from one server to another when the main one goes down. On the local network everything works perfectly. The problem begins when there is a communication in other subnet. For clarity, I give an example:
Master:
VIP_ADDRESS="192.168.98.210"
ID=001
PASSFILE=/etc/ucarp/vip-001.pwd
BIND_INTERFACE="eth0"
SOURCE_ADDRESS="192.168.98.214"
OPTIONS="-k 2 --shutdown --preempt"

Slave:
VIP_ADDRESS="192.168.98.210"
ID=001
PASSFILE=/etc/ucarp/vip-001.pwd
BIND_INTERFACE="eth0"
SOURCE_ADDRESS="192.168.98.215"

Added net.ipv4.ip_nonlocal_bind=1 option to kernel

There is a server that has ip 192.168.120.15, we start ping it from 192.168.98.214 (Master)
10:38:38.315935 IP 192.168.98.214 > 192.168.121.15: ICMP echo request, id 17900, seq 2, length 64
10:38:38.315996 IP 192.168.121.15 > 192.168.98.214: ICMP echo reply, id 17900, seq 2, length 64

Trying a reverse ping to the cluster ip
10:40:26.227616 IP 192.168.121.15 > 192.168.98.210: ICMP echo request, id 17969, seq 2, length 64
10:40:26.227658 IP 192.168.98.210 > 192.168.121.15: ICMP echo reply, id 17969, seq 2, length 64

On reverse ping everything goes right. How to make it so that the routing would go from the cluster ip?????
 
Old 04-10-2023, 08:38 AM   #2
testsia
LQ Newbie
 
Registered: Apr 2023
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by testsia View Post
Hi all. I ask for the help of specialists, as my head is already spinning. There are two Centos 7 servers, the Carp protocol is configured on them. It works and ip goes from one server to another when the main one goes down. On the local network everything works perfectly. The problem begins when there is a communication in other subnet. For clarity, I give an example:
Master:
VIP_ADDRESS="192.168.98.210"
ID=001
PASSFILE=/etc/ucarp/vip-001.pwd
BIND_INTERFACE="eth0"
SOURCE_ADDRESS="192.168.98.214"
OPTIONS="-k 2 --shutdown --preempt"

Slave:
VIP_ADDRESS="192.168.98.210"
ID=001
PASSFILE=/etc/ucarp/vip-001.pwd
BIND_INTERFACE="eth0"
SOURCE_ADDRESS="192.168.98.215"

Added net.ipv4.ip_nonlocal_bind=1 option to kernel

There is a server that has ip 192.168.120.15, we start ping it from 192.168.98.214 (Master)
10:38:38.315935 IP 192.168.98.214 > 192.168.121.15: ICMP echo request, id 17900, seq 2, length 64
10:38:38.315996 IP 192.168.121.15 > 192.168.98.214: ICMP echo reply, id 17900, seq 2, length 64

Trying a reverse ping to the cluster ip
10:40:26.227616 IP 192.168.121.15 > 192.168.98.210: ICMP echo request, id 17969, seq 2, length 64
10:40:26.227658 IP 192.168.98.210 > 192.168.121.15: ICMP echo reply, id 17969, seq 2, length 64

On reverse ping everything goes right. How to make it so that the routing would go from the cluster ip?????


I found a solution
iptables -t nat -A POSTROUTING -o eth0 -m state --state NEW ! -s 192.168.98.210 -j SNAT --to-source 192.168.98.210
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Requires: perl(Carp) - URGENT nagikondaveti Linux - Desktop 9 11-08-2013 08:32 PM
LXer: How To Configure A pfSense 2.0 Cluster Using CARP LXer Syndicated Linux News 0 10-28-2011 07:50 PM
Should I switch from OpenBSD to Linux. CARP ( opinion ) dlublink Linux - Networking 6 05-03-2010 03:34 PM
CARP virtual address/interface assinmet sarajevo *BSD 3 06-25-2009 04:18 AM
Squid error (token='carp-load-factor=0.5') spangler Linux - Software 2 10-25-2007 08:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration