{"id":377,"date":"2018-03-08T14:31:11","date_gmt":"2018-03-08T14:31:11","guid":{"rendered":"https:\/\/d1m0.com\/?p=377"},"modified":"2018-03-08T14:32:21","modified_gmt":"2018-03-08T14:32:21","slug":"redundancy-network-linux-router-keepaliveconntrackd-etc-pt2","status":"publish","type":"post","link":"https:\/\/d1m0.com\/?p=377","title":{"rendered":"Redundancy network linux router keepalive,conntrackd &#038; etc. pt2."},"content":{"rendered":"<p>conntrackd &#8211; conntrackd is the user-space daemon for the netfilter connection tracking system. This daemon synchronizes connection tracking states between several replica firewalls. Thus,  conntrackd  can  be used  to deploy highly available stateful firewalls.<\/p>\n<p> config file is in<strong> \/etc\/conntrackd\/conntrackd.conf<\/strong><\/p>\n<p>Im gonna use FTFW mode for syncing between 2 routers.<\/p>\n<p>Add this configuration at the end of config file in router1 and router2.<\/p>\n<blockquote><p>\nSync {<br \/>\n        Mode FTFW {<br \/>\n        }<\/p>\n<p>        UDP {<br \/>\n                IPv4_address 10.100.200.1<br \/>\n                IPv4_Destination_Address 10.100.200.2<br \/>\n                Port 3780<br \/>\n                Interface eno3<br \/>\n                SndSocketBuffer 1249280<br \/>\n                RcvSocketBuffer 1249280<br \/>\n                Checksum on<br \/>\n        }<br \/>\n}<\/p><\/blockquote>\n<p>On  second node &#8211; router 2 <strong>IPv4_address<\/strong> and <strong>IPv4_Destination_Address<\/strong> shoud be opposite =><\/p>\n<p>IPv4_address 10.100.200.2 and IPv4_Destination_Address 10.100.200.1<\/p>\n<p>3.Tuning some stuff<br \/>\nCreating simple script can be made to start\/stop anything when router1 and router2 switch.<\/p>\n<p>example of script<\/p>\n<blockquote><p>#!\/bin\/bash<br \/>\ncase &#8220;$1&#8221; in<br \/>\n   primary)<br \/>\n        sleep 5 # give time to keepalive to wake up<br \/>\nip addr add 10.12.13.11\/24 dev eno4<br \/>\nsystemctl start openvpn<br \/>\nsystemctl start bgp<br \/>\nsystemctl do smethig else.<br \/>\n   ;;<br \/>\n        backup)<br \/>\nip addr del 0.12.13.11\/24 dev eno4<br \/>\nsystemctl start openvpn<br \/>\nsystemctl start bgp<br \/>\n   ;;<br \/>\nesac<\/p><\/blockquote>\n<p>Edit primary-backup.sh and add following line under &#8220;send a bulk update to backups&#8221;<\/p>\n<blockquote><p> logger &#8220;ERROR: failed to invoke conntrackd -B&#8221;<br \/>\n    fi<br \/>\n<strong>\/etc\/keepalived\/script.sh primary<\/strong><br \/>\n    ;;<br \/>\n  backup)<\/p><\/blockquote>\n<p>And&#8230;.<\/p>\n<blockquote><p> logger &#8220;ERROR: failed to invoke conntrackd -n&#8221;<br \/>\n    fi<br \/>\n<strong>\/etc\/keepalived\/script.sh backup<\/strong><br \/>\n    ;;<br \/>\n  fault) <\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>conntrackd &#8211; conntrackd is the user-space daemon for the netfilter connection tracking system. This daemon synchronizes connection tracking states between several replica firewalls. Thus, conntrackd can be used to deploy highly available stateful firewalls. config file is in \/etc\/conntrackd\/conntrackd.conf Im gonna use FTFW mode for syncing between 2 routers. Add this configuration at the end &#8230;<\/p>\n<p><a href=\"https:\/\/d1m0.com\/?p=377\" class=\"more-link\">Continue reading &lsquo;Redundancy network linux router keepalive,conntrackd &#038; etc. pt2.&rsquo; &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-377","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/posts\/377","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/d1m0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=377"}],"version-history":[{"count":2,"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/posts\/377\/revisions"}],"predecessor-version":[{"id":380,"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/posts\/377\/revisions\/380"}],"wp:attachment":[{"href":"https:\/\/d1m0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/d1m0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/d1m0.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}