quarta-feira, 28 de setembro de 2011

Rastrear servidores DHCP da rede no Mikrotik. / Track DHCP servers in the network in Mikrotik.

Neste tutorial, você vai aprender configurar seu servidor Mikrotik para que ele monitore sua rede e lhe informe se existe algum servidor DHCP ativo na sua rede que não era esperado por você. Para isso você precisa dos seguintes pré-requisitos:
In this tutorial you will learn to configure your server so that it Mikrotik monitor your network and you know if there is any active DHCP server on your network that was not expected for you. For this you need the following prerequisites:
  1. Ter o endereço MAC do servidor DHCP permitido por você na rede (isso só se aplica se seu servidor DHCP for algum dispositivo que não seja o servidor Mikrotik onde você vai colocar essa regra)
  1. Having the MAC address of the DHCP server enabled on the network for you (this only applies if your DHCP server is a device other than the Mikrotik server where you will putthis rule)


Imagine a situação:
Imagine the situation:
Você configura seu servidor Mikrotik, ou outro dispositivo qualquer, para ser o servidor DHCP padrão de sua rede, de repente, alguém coloca um outro dispositivo ligado na sua rede física e ativa um outro DHCP SERVER nesse dispositivo. Quando seus clientes, ou usuários, vão solicitar IP na rede, ao invés de pegar os endereçamentos corretos criados por você no seu servidor DHCP, acabam pegando endereçamentos errados do outro dispositivo ativo na rede. Logo, sua rede fica um caos.
Mikrotik you configure your server, or any other device, to be the standard DHCP serveron your network suddenly someone puts another device plugged into your physical network and another active DHCP Server in this device. When your clients or users, will request the IP network, instead of taking the correct addresses that you create in your DHCP server, getting addresses wrong end of another active device in the network.Thus, your network is in chaos.
Esse "macete" que vou lhe ensinar, vai monitorar toda a sua rede, e, se encontrar algum outro servidor DHCP que não seja o autorizado por você, ele executará um script. O script que vou configurar aqui, é pra lhe mandar um e-mail informando essa situação.
This "trick" that will teach you, will monitor your entire network, and meet some otherDHCP server that is not authorized by you, it will execute a script. The script that'll set uphere is to send you an email informing about this.
Vamos começar!
Let's start!

1. Primeiro, vamos configurar seu servidor Mikrotik com os dados do seu servidor SMTP para que ele envie os e-mails. Clique em TOOLS e depois em EMAIL.
1. First, we configure your server Mikrotik with the data of your SMTP server so that it sends e-mails. Click TOOLS and then EMAIL.

2. No campo SERVER, coloque o IP do servidor SMTP que você vai usar. No campo PORT, coloque a porta 25. No campo FROM, coloque um usuário válido desse servidor SMTP que você usou entre < >. No campo USER, repita esse usuário válido sem < >. No campo PASSWORD, coloque a senha válida desse usuário que você utilizou. Agora clique em OK.
2. In the Server field, put the IP of the SMTP server you will use. In the Port field, enter port 25. In the FROM field, put a valid user of the SMTP server that you used the <>. In the field USER, repeat this without valid user <>. In the Password field, enter the passwordvalid for that user that you used. Now click OK.

3. Agora, vamos criar o script que vai enviar o e-mail para você. Na aba SCRIPT, clique no botão +. No campo NAME, coloque um nome qualquer para esse script. No campo POLICY, deixe todas as opções marcadas. No campo SOURCE, coloque o comando abaixo e depois clique em OK.
3. Now, let's create the script that will send the email to you. In the Script tab, click the + button. In the Name field, enter any name for this script. POLICY In the field, leave alloptions checked. In the SOURCE field, place the command below and then click OK.
/tool e-mail to=(seu e-mail) body=(o que vai está escrito no corpo do e-mail entre "") subject=(o assunto do e-mail)
/tool e-mail to=(your e-mail) body=(what will is written in the body of the e-mail between "") subject=(the subject of the e-mail)



4. Agora, vamos criar a regra que vai monitorar a rede. Clique em IP e depois em DHCP SERVER
4. Now, let's create a rule that will monitor the network. IP and then click on DHCP Server

5. Na aba ALERTS, clique no botão +. No campo INTERFACE, selecione a placa de rede que será monitorada. No campo VALID SERVERS, coloque o endereço MAC do servidor DHCP ativo na rede, mas, autorizado por você. Assim, ele não irá tratar seu servidor DHCP como um desconhecido. No campo ALERT TIMEOUT, coloque depois de quanto tempo você quer ser informado novamente de um servidor DHCP desconhecido que já lhe foi avisando antes. Exemplo: O alerta detectou um servidor DHCP desconhecido na rede e lhe mandou um e-mail. Se você configurou esse campo com dez minutos, então, se daqui a dez minutos esse servidor DHCP desconhecido continuar ativo, o alerta vai te avisar de novo. O campo UNKNOW SERVERS é só de leitura. Quando o alerta encontrar um servidor DHCP desconhecido na rede, ele vai te mostrar o endereço MAC desse servidor. Assm fica mais fácil de você identificar qual é o dispositivo desconhecido. No campo ON ALERT, coloque o mesmo nome, exatamente igual com maiúsculas e minúsculas, script que você criou para lhe enviar o e-mail. Depois, clique em OK.
5. ALERTS tab, click the + button. In the Interface field, select the network card that will be monitored. VALID SERVERS in the field, put the MAC address of the active DHCP server on the network, but authorized by you. So he will not treat her as an unknownDHCP server. ALERT TIMEOUT in the field, then put on how long you want to be informed again of an unknown DHCP server that you have been warned before.Example: The alarm has detected an unknown DHCP server on the network and sent him an email. If you set this field with ten minutes, so if in ten minutes this unknownDHCP server remains active, the alert will warn you again. SERVERS UNKNOW field is read-only. When the alert to find an unknown DHCP server on the network, it will show you the MAC address of that server. ASSM is easier for you to identify what the unknown device. ALERT ON the field, put the same name, with exactly the same case,the script you created to send you e-mail. Then click OK.

Pronto. Sua rede está sendo monitorada, e, se alguém ativar um outro servidor DHCP que não tenha sido autorizado por você, um e-mail chegará na sua caixa postal com o aviso.
Ready. Your network is being monitored, and if someone activate another DHCP serverthat has not been authorized by you, an email will arrive in your mailbox with the warning.

6 comentários:

  1. Olá Amigo,

    Esta informação foi muito valiosa para mim. Obrigado.

    Tenho uma pergunta: e como faço para bloquear este outro DHCP não autorizado na minha RB?

    Desde já, obrigado mais uma vez.

    Cristiano Chiacchio

    ResponderExcluir
  2. Simples, é só identificar qual é o equipamento, entrar em suas configurações e desativar o DHCP server.

    ResponderExcluir
  3. Ok.

    Porém, informei que o DHCP é de algum equipamento não autorizado, de alguém que não conheço e nem mesmo sei a sua localização no prédio.

    Acho que não é tão simples assim amigo. De qualquer forma, obrigado pela atenção!

    ResponderExcluir
  4. Nao tem como resolver em ir na casa do cliente!

    Mas esse alerta é útil sim.

    Quando vc localiza, coloca um IP da mesma rede na sua placa e fique pingando o roteador.. e mande um técnico ir retirando os cabos dos clientes um a um.. assim vc identifica de onde vem.

    ResponderExcluir
  5. corrigindo:

    .. sem ir na casa do cliente!

    ResponderExcluir
  6. Faça uma regra no filter rules, um drop no endereço mac, que esta ativado do DHCP.

    ResponderExcluir