Exercício - configurar roteador personalizado
- 15 minutos
Atenção
Este conteúdo faz referência ao CentOS, uma distribuição Linux com status de Fim de Vida (EOL). Considere a sua utilização e planeie em conformidade. Para obter mais informações, consulte as diretrizes de Fim da Vida Útil do CentOS.
Use as seguintes instruções para configurar a infraestrutura para FRR e gerar a rota padrão:
az network vnet subnet create -n <NVA-Subnet-name> -g <resource-group-name> --vnet-name <vnet-name> --address-prefix 10.0.2.0/24
az network nic create -g <resource-group-name> --vnet-name <vnet-name> --subnet <NVA-Subnet-name> -n <NVA-nic-name>
az vm availability-set create --name <nva-availability-set-name> --resource-group <resource-group-name> --location <your-preferred-azure-region>
az vm create --name <nva-vm-name> --resource-group <resource-group-name> --location <your-preferred-azure-region> --image OpenLogic:CentOS:8_5:8.5.2022012100 --size Standard_D1_v2 --availability-set <nva-availability-set-name> --authentication-type password --admin-username <vm-admin-user-name> --admin-password <vm-admin-username-password> --storage-sku Standard_LRS --nics <NVA-nic-name>
Configurar o roteamento FRR no NVA
Agora, você vai configurar o software FRR.
Atualize as variáveis routeServerSubnetPrefix e bgpNvaSubnetGateway no script a seguir.
# # IP prefix of the RouteServerSubnet in the Firewall VNet. # routeServerSubnetPrefix="<azure-route-server-subnet-prefix>" # # The first IP address of the subnet to which the "eth0" device is attached. # bgpNvaSubnetGateway="<nva-azure-subnet-first-ip-address>" # Install FRR sudo dnf install frr -y # Configure FRR to run the bgpd daemon sudo sed -i 's/bgpd=no/bgpd=yes/g' /etc/frr/daemons sudo touch /etc/frr/bgpd.conf sudo chown frr /etc/frr/bgpd.conf sudo chmod 640 /etc/frr/bgpd.conf # Start FRR daemons sudo systemctl enable frr --now # Add static routes to ensure reachability for Route Servers (Route Server are not-directly-connected external BGP neighbours). # Please note that this configuration is transient and will be lost if the VM is rebooted. # On CentOS VMs, you can add these routes to /etc/sysconfig/network-scripts/route-eth<X> to make them persistent across reboots. sudo ip route add $routeServerSubnetPrefix via $bgpNvaSubnetGateway dev eth0Copie o script editado da etapa 1.
Inicie sessão no shell da VM NVA.
Cole o script copiado da área de transferência como texto sem formatação no shell NVA (Ctrl-Shift-V).
Execute o script e aguarde até que ele termine em um minuto ou mais.
Certifique-se de que nenhum erro seja relatado após a execução.
Executar sudo vtysh
Verifique se o FRR está em execução e se o seu shell de comando está iniciado.
Configurar o vizinho BGP e a rota padrão para o NVA
Esta etapa configura o NVA FRR para ter o Azure Route Server como seu vizinho BGP. Uma rota padrão (0.0.0.0/0) também é adicionada no NVA.
Atualize as seguintes variáveis no script.
- <Endereço IP privado do firewall>
- <Endereço IP da instância #0 do Route Server>
- <Endereço IP da instância #1 do Route Server>
conf term ! route-map SET-NEXT-HOP-FW permit 10 set ip next-hop <Firewall Private IP address> exit ! router bgp 65111 no bgp ebgp-requires-policy neighbor <IP address of Route Server instance #0> remote-as 65515 neighbor <IP address of Route Server instance #0> ebgp-multihop 2 neighbor <IP address of Route Server instance #1> remote-as 65515 neighbor <IP address of Route Server instance #1> ebgp-multihop 2 network 0.0.0.0/0 ! address-family ipv4 unicast neighbor <IP address of Route Server instance #0> route-map SET-NEXT-HOP-FW out neighbor <IP address of Route Server instance #1> route-map SET-NEXT-HOP-FW out exit-address-family ! exit ! exit ! write file !Inicie sessão no shell FRR.
Cole o script com variáveis atualizadas.
Execute
show ip bgppara confirmar que o NVA não aprendeu rotas, exceto sua própria rota padrão.Execute
show ip bgp sumpara confirmar que o NVA não estabeleceu sessões BGP.
Configurar o emparelhamento com o Azure Route Server
As etapas a seguir estabelecem uma relação de par BGP entre o FRR NVA e o Azure Route Server.
Execute os seguintes comandos no prompt da CLI do Azure:
az network routeserver peering create --name <nva-vm-name> --peer-ip <private-ip-of-nva-vm-name> --peer-asn <asn-value-other-than-65515-65520> --routeserver <routeserver-name> --resource-group <resource-group-name>` az network routeserver update --name <routeserver-name> --resource-group <resource-group-name> --allow-b2b-traffic true`Inicie sessão no shell FRR.
Execute
show ip bgppara confirmar que o NVA aprendeu rotas do Azure Route Server.
Verifique se o Firewall do Azure tem conectividade direta com a Internet usando o portal do Azure para inspecionar a Tabela de Rotas associada à sub-rede do Firewall do Azure.
Neste ponto, você configurou a nuvem privada do Azure VMware Solution para implementar conectividade segura de saída com a Internet. Você implantou o Azure Route Server para uma troca de rota eficaz entre a nuvem privada do Azure VMware Solution e o NVA. Em seguida, você implantou o Firewall do Azure como o ponto de saída para todo o tráfego vinculado à Internet. Depois, foi usado o FRR, um router personalizado que injeta uma rota padrão usando o Azure Firewall como o próximo salto na nuvem privada da Azure VMware Solution.
Na próxima unidade, você aprenderá como implementar controles de acesso refinados no Firewall do Azure, que permite/nega o tráfego de rede da nuvem privada do Azure VMware Solution.