- push @router_config, "bgp router-id $ifaceip";
- push @router_config, "!";
- push @router_config, "address-family ipv4 unicast";
- push @router_config, " redistribute connected";
- push @router_config, "exit-address-family";
- push @router_config, "!";
- push @router_config, "address-family l2vpn evpn";
- push @router_config, " advertise ipv4 unicast";
- push @router_config, "exit-address-family";
- push(@{$config->{router}->{"router bgp $asn vrf $vrf"}}, @router_config);
+
+ my $is_gateway = undef;
+ my $local_node = PVE::INotify::nodename();
+
+ foreach my $gatewaynode (PVE::Tools::split_list($gatewaynodes)) {
+ $is_gateway = 1 if $gatewaynode eq $local_node;
+ }
+
+ if ($is_gateway) {
+
+ @router_config = ();
+ #import /32 routes of evpn network from vrf1 to default vrf (for packet return)
+ #frr 7.1 tag is bugged -> works fine with 7.1 stable branch(20190829-02-g6ba76bbc1)
+ #https://github.com/FRRouting/frr/issues/4905
+ push @router_config, "!";
+ push @router_config, "address-family ipv4 unicast";
+ push @router_config, " import vrf $vrf";
+ push @router_config, "exit-address-family";
+ push(@{$config->{router}->{"router bgp $asn"}}, @router_config);
+
+ @router_config = ();
+
+ #add default originate to announce 0.0.0.0/0 type5 route in evpn
+ push @router_config, "!";
+ push @router_config, "address-family l2vpn evpn";
+ push @router_config, " default-originate ipv4";
+ push @router_config, "exit-address-family";
+ push(@{$config->{router}->{"router bgp $asn vrf $vrf"}}, @router_config);
+ }