{"id":370,"date":"2018-03-08T14:09:57","date_gmt":"2018-03-08T14:09:57","guid":{"rendered":"https:\/\/d1m0.com\/?p=370"},"modified":"2018-03-08T14:32:50","modified_gmt":"2018-03-08T14:32:50","slug":"redundancy-network-linux-router-keepaliveconntrackd-etc-pt1","status":"publish","type":"post","link":"https:\/\/d1m0.com\/?p=370","title":{"rendered":"Redundancy network linux router keepalive,conntrackd &#038; etc. pt1."},"content":{"rendered":"<p>I have two identical  Centos7 latest relase machines.One is named rotuer1 and other one is router2.<br \/>\nI will use VRRP protocol for router redundancy.In my test bench im not gonna use any layer 2\/3 switches.<\/p>\n<p>Specification :<\/p>\n<p>MB: A2SDi-8C-HLN4F<br \/>\n1x Intel(R) Atom(TM) CPU C3758<br \/>\n1x *8gig memory<br \/>\n2\u0445 HUS722T1TALA604<br \/>\n4x internal network interfaces.<\/p>\n<p>1.Network connectivity.<br \/>\nRouters are connected with crossover ethernet cable.In my case in eno3 interface.<\/p>\n<p><strong>router1<\/strong> eno3 network interface config file<\/p>\n<blockquote><p>TYPE=&#8221;Ethernet&#8221;<br \/>\nBOOTPROTO=&#8221;static&#8221;<br \/>\nNAME=&#8221;eno3&#8243;<br \/>\nDEVICE=&#8221;eno3&#8243;<br \/>\nONBOOT=&#8221;yes&#8221;<br \/>\nIPADDR=&#8221;10.10.10.10&#8243;<br \/>\nPREFIX=&#8221;24&#8243;<\/p><\/blockquote>\n<p><strong>router2 <\/strong>eno3 network interface config file<\/p>\n<blockquote><p>TYPE=&#8221;Ethernet&#8221;<br \/>\nBOOTPROTO=&#8221;static&#8221;<br \/>\nNAME=&#8221;eno3&#8243;<br \/>\nDEVICE=&#8221;eno3&#8243;<br \/>\nONBOOT=&#8221;yes&#8221;<br \/>\nIPADDR=&#8221;10.10.10.20&#8243;<br \/>\nPREFIX=&#8221;24&#8243;<\/p><\/blockquote>\n<p>Make sure to have ping form router1 <-> rotuer2 and telnet in 22 port for ssh.<\/p>\n<p>Network card configuration in Centos <\/p>\n<p>At the usual directory in centos7 we fill find configuration files for network interfaces.<br \/>\n\/etc\/sysconfig\/network-scripts\/<br \/>\nifcfg-* files should not have any configuration for network addresses.<br \/>\nExample:<\/p>\n<p>For vlan interface:<\/p>\n<blockquote><p>\nDEVICE=eno2.22<br \/>\nONBOOT=yes<br \/>\nVLAN=yes<br \/>\nTYPE=&#8221;Ethernet&#8221;\n<\/p><\/blockquote>\n<p>And for non vlan interface:<\/p>\n<blockquote><p>\nNAME=eno2<br \/>\nDEVICE=eno2<br \/>\nTYPE=Ethernet<br \/>\nONBOOT=yes<br \/>\nBOOTPROTO=static\n<\/p><\/blockquote>\n<p>Be sure all network interfaces are set with option <strong>ONBOOT=yes<\/strong> or keepalived will not start.<\/p>\n<p>2.Pkgs<br \/>\nyum install keepalived conntrackd openvpn quagga <\/p>\n<p><strong>Keepalived<\/strong> high-availability is achieved by VRRP protocol. VRRP is a fundamental brick for router failover. In addition, Keepalived implements a set of hooks to the VRRP finite state machine providing low-level and high-speed protocol interactions. <\/p>\n<p>Using following configuration in \/etc\/keepalive\/keepalived.conf for master router1<\/p>\n<blockquote><p>\nglobal_defs {<br \/>\n    notification_email {<br \/>\n        dimo@d1m0.com #who get notifications .<br \/>\n        pich@d1m0.com<br \/>\n    }<br \/>\n    notification_email_from dimo@dm10.com<br \/>\n    smtp_server 192.168.3.7 # mail server to send mails<br \/>\n    smtp_connect_timeout 30 # wait before retry .<br \/>\n    router_id firewall      #name of our machine<br \/>\n}<\/p>\n<p>vrrp_sync_group router {<br \/>\n    group {<br \/>\n        <strong>router_eno1<\/strong><br \/>\n        router_eno2<br \/>\n        router_eno4<\/p>\n<p>    }<br \/>\n# this script is in \/usr\/share\/doc\/conntrack-tools-1.4.4\/doc\/sync\/. You may want to place it it keepalive config directory. It is used to notify Master and Backup for theirs states.<br \/>\n    notify_master &#8220;\/etc\/keepalived\/primary-backup.sh primary&#8221;<br \/>\n    notify_backup &#8220;\/etc\/keepalived\/primary-backup.sh backup&#8221;<br \/>\n    notify_fault  &#8220;\/etc\/keepalived\/primary-backup.sh fault&#8221;<br \/>\n}<\/p>\n<p>vrrp_instance <strong>router_eno1 <\/strong>{<br \/>\n    state MASTER # OR BACKUP<br \/>\n    interface eno3 ### This is important interface.Over this interface router1 and router2 will talk to each others.<br \/>\n    dont_track_primary<br \/>\n    virtual_router_id 50<br \/>\n    priority 100<br \/>\n    advert_int 3<br \/>\n    authentication {<br \/>\n        auth_type PASS<br \/>\n        auth_pass 11router #password is limited to 8 characters.<br \/>\n    }<br \/>\nvirtual_ipaddress {<br \/>\n        #<IPADDR>\/<MASK> brd <IPADDR> dev <STRING> scope <SCOPE> label <LABEL><br \/>\n        # eno1<br \/>\n        192.168.100.1\/24        brd 192.168.100.255     dev eno1<br \/>\n        172.31.31.253\/16        brd 172.31.31.255      dev eno1.13 #simple vlan interface<br \/>\n        10.22.201.1\/24          brd 10.22.201.255      dev eno1.1111 #set 2 ip addresses in one interface<br \/>\n        10.10.201.33\/24         brd 10.10.201.255      dev eno1.1111#set 2 ip addresses in one interface<br \/>\n        192.168.14.2\/30          brd 192.168.14.3        dev eno1.790<br \/>\n        }<br \/>\n    preempt_delay 900<br \/>\n    garp_master_delay 2<br \/>\n}<\/p><\/blockquote>\n<p><strong>IMPORTANT: vrrp_instance limitations is UP TO 20 IP addresses.If your router have more than 20 ip addresses, set second vrrp_instance.<\/strong><\/p>\n<blockquote><p>\nvrrp_instance router_eno4 {<br \/>\n    state MASTER # or BACKUP<br \/>\n    interface eno3<br \/>\n    dont_track_primary<br \/>\n    virtual_router_id 51<br \/>\n    priority 100 # backup&#8217;s priority shoud be less than master&#8217;s<br \/>\n    advert_int 3<br \/>\n    authentication {<br \/>\n        auth_type PASS<br \/>\n        auth_pass 11router<br \/>\n    }<br \/>\n    virtual_ipaddress {<br \/>\n        #<IPADDR>\/<MASK> brd <IPADDR> dev <STRING> scope <SCOPE> label <LABEL><br \/>\n        10.72.72.5\/24         brd 195.72.112.255  dev eno4<br \/>\n        192.168.10.1\/24       brd 192.168.8.255   dev eno4.3<br \/>\n        }<br \/>\n    preempt_delay 900<br \/>\n    garp_master_delay 2<br \/>\n}<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>I have two identical Centos7 latest relase machines.One is named rotuer1 and other one is router2. I will use VRRP protocol for router redundancy.In my test bench im not gonna use any layer 2\/3 switches. Specification : MB: A2SDi-8C-HLN4F 1x Intel(R) Atom(TM) CPU C3758 1x *8gig memory 2\u0445 HUS722T1TALA604 4x internal network interfaces. 1.Network connectivity. &#8230;<\/p>\n<p><a href=\"https:\/\/d1m0.com\/?p=370\" class=\"more-link\">Continue reading &lsquo;Redundancy network linux router keepalive,conntrackd &#038; etc. pt1.&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-370","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/posts\/370","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=370"}],"version-history":[{"count":9,"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/posts\/370\/revisions"}],"predecessor-version":[{"id":382,"href":"https:\/\/d1m0.com\/index.php?rest_route=\/wp\/v2\/posts\/370\/revisions\/382"}],"wp:attachment":[{"href":"https:\/\/d1m0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/d1m0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/d1m0.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}