{"id":1296,"date":"2023-12-20T16:11:53","date_gmt":"2023-12-20T15:11:53","guid":{"rendered":"https:\/\/ndk.sytes.net\/wordpress\/?p=1296"},"modified":"2024-01-15T14:16:28","modified_gmt":"2024-01-15T13:16:28","slug":"install-ucarp-on-debian-12","status":"publish","type":"post","link":"https:\/\/ndk.sytes.net\/wordpress\/?p=1296","title":{"rendered":"Install uCARP on Debian 12"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Download the ucarp package first:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">apt install ucarp<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Configure the interface in <strong>\/etc\/network\/interfaces<\/strong> on your <strong>PRIMARY<\/strong> server:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">iface eth0 inet static\n    address 10.1.1.4\/24\n    gateway 10.1.1.1\n    # dns-* options are implemented by the resolvconf package, if installed\n    dns-nameservers 1.1.1.1 9.9.9.9\n    dns-search domain\n\niface eth0:ucarp inet static\n    address 10.1.1.30\n    netmask 255.255.255.0<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">now do the same thing on your <strong>SECONDARY<\/strong> server:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">iface eth0 inet static\n     address 10.1.1.5\/24\n     gateway 10.1.1.1\n     # dns-* options are implemented by the resolvconf package, if installed\n     dns-nameservers 1.1.1.1 9.9.9.9\n     dns-search domain\n\niface eth0:ucarp inet static\n     address 10.1.1.30\n     netmask 255.255.255.0<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">you can check on your primary if carp is working with<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ifup eth0:ucarp<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">if this is fine we have to create a config file and the systemd startup unit as the package comes without such a unit file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First create <strong>\/etc\/ucarp\/vip-common.conf<\/strong> on both servers and paste the following. This is for the primary so you have to adapt it to fit the secondary, notably SOURCE_ADDRESS and ADVSKEW. Set the ADVSKEW higher on the secondary, e.g. ADVSKEW=&#8221;100&#8243;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">BIND_INTERFACE=\"eth0\"\nPASSWORD=\"mysimplepass\"\nVIP_ADDRESS=\"10.1.1.30\"\nSOURCE_ADDRESS=\"10.1.1.4\"\nVHID=\"1\"\nADVBASE=\"1\"\nADVSKEW=\"10\"\nOPTIONS=\"-P -z\"\nUPSCRIPT=\"\/usr\/share\/ucarp\/vip-up\"\nDOWNSCRIPT=\"\/usr\/share\/ucarp\/vip-down\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then create the systemd unit file <strong>\/etc\/systemd\/system\/ucarp.service<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[Unit]\nDescription=UCARP virtual interface %I\nAfter=network.target\n\n[Service]\nEnvironmentFile=-\/etc\/ucarp\/vip-common.conf\nExecStart=\/usr\/sbin\/ucarp $OPTIONS -i $BIND_INTERFACE -p $PASSWORD -v $VHID -a $VIP_ADDRESS -s $SOURCE_ADDRESS -b $ADVBASE -k $ADVSKEW -u $UPSCRIPT -d $DOWNSCRIPT\nKillMode=control-group\n\n[Install]\nWantedBy=multi-user.target<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Last but not least start it<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ systemctl enable --now ucarp<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/ucarp.wordpress.com\">https:\/\/ucarp.wordpress.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Download the ucarp package first: apt install ucarp Configure the interface in \/etc\/network\/interfaces on your PRIMARY server: iface eth0 inet static address 10.1.1.4\/24 gateway 10.1.1.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 1.1.1.1 9.9.9.9 dns-search domain iface eth0:ucarp inet static address 10.1.1.30 netmask 255.255.255.0 now do the same thing on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,7],"tags":[],"class_list":["post-1296","post","type-post","status-publish","format-standard","hentry","category-linuxunix","category-servers"],"_links":{"self":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1296"}],"version-history":[{"count":4,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1296\/revisions"}],"predecessor-version":[{"id":1307,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1296\/revisions\/1307"}],"wp:attachment":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}