Tutoriales

¿Cómo configurar el servidor RADIUS/NPS en Windows Server? – 2xsoftware

RADIUS (autenticación remota en el servicio de usuario de acceso telefónico) es un protocolo de red que implementa la autenticación, la autorización y la recopilación de información sobre los recursos que se utilizan. Está diseñado para transferir información entre la plataforma central y los clientes/dispositivos de la red. Su servidor de acceso remoto (RADIUS) puede comunicarse con un servidor/servicio central (por ejemplo, un controlador de dominio de Active Directory) para autenticar a los clientes de acceso telefónico remoto y autorizarlos para acceder a servicios o recursos de red específicos. NPS le permite autenticar usuarios remotos contra Active Directory, lo que les permite conectarse usando diferentes dispositivos cliente y tipos de conexión (puntos de acceso Wi-Fi, controladores inalámbricos, VPN, acceso telefónico, conmutadores 802.1x, enrutadores, etc.)

En este artículo, mostraremos cómo configurar un servidor RADIUS en Windows Server 2022, 2019 o 2016, y cómo configurar la autenticación RADIUS en conmutadores/enrutadores Cisco y Mikrotik (actúan como clientes RADIUS) mediante el servidor de políticas de red (NPS ) servicio.

Instalación del rol RADIUS (NPS) en Windows Server 2022/2019/2016

Suponiendo que ya haya implementado el entorno de Servicios de dominio de Active Directory, porque vamos a configurar la autenticación en los dispositivos de red bajo las cuentas de usuario de AD.

Primero, cree un nuevo grupo de seguridad en el dominio de Active Directory (por ejemplo, RemoteCiscoUsers) y agregue todos los usuarios que podrán autenticarse en los enrutadores y conmutadores de Cisco a este grupo.

Por lo tanto, debe instalar la función del servidor RADIUS en su Windows Server 2022/2019/2016. Abre el Administrador del servidor consola y ejecutar el Agregar funciones y funciones mago. El protocolo RADIUS (Remote Authentication Dial-In User Service) de Windows Server forma parte de la función del Servidor de directivas de red (NPS). La función NPS le permite autenticar clientes remotos en Active Directory mediante el protocolo Radius.

En el asistente que aparece, seleccione el Política de red y servicios de acceso rol en el paso de selección de rol.

Nota. Además, puede instalar funciones de NPS y herramientas de administración desde una consola de PowerShell elevada:

Install-WindowsFeature NPAS –IncludeManagementTools

Compruebe si la función NPAS está instalada en su host de Windows Server:

Get-WindowsFeature -Name NPAS

servidor de radio de Windows

Una vez completada la instalación del rol, abra el Servidor de directivas de red (nps.msc) en el menú Herramientas.

cómo configurar el servidor de radio en el servidor de Windows paso a paso

Para usar el servidor NPS en el dominio, debe registrarlo en Active Directory. En el complemento NPS, haga clic con el botón derecho en una raíz y seleccione Registrar servidor en Active Directory.

radio del servidor de windows

Confirme el registro del servidor en Active Directory.

configurar el servidor de radio

Además, puede registrar su servidor NPS en Active Directory con un comando:

netsh ras add registeredserver

En este caso, el servidor tendrá permiso para leer las propiedades de las cuentas de usuario de Active Directory para autenticar a los usuarios. Su cuenta de computadora host NPS se agregará al grupo de dominio incorporado Servidores RAS e IAS.

configurar el servidor de radio

Ahora puede agregar el cliente Radius. Radius client es el dispositivo desde el cual su servidor recibirá solicitudes de autenticación. Esto podría ser un enrutador Cisco, un conmutador, un punto de acceso Wi-Fi, etc.

Para agregar el nuevo cliente Radius, expanda el Clientes y servidores RADIUS en el árbol de la consola de NPS y seleccione Nuevo sobre el Clientes RADIUS artículo.

configuración del servidor de radio

En la pestaña Configuración, complete los campos Nombre amigablecliente DIRECCIÓN (puede especificar la dirección IP o el nombre DNS), y Secreto compartido + Confirmar compartido contraseña (utilizará esta contraseña en la configuración del conmutador/enrutador Cisco).

Nota. La contraseña de secreto compartido rara vez se usa en grandes redes corporativas debido a los problemas con la distribución de secretos compartidos. En lugar de contraseñas compartidas, se recomienda utilizar certificados. Si tiene una entidad de certificación (CA) corporativa implementada para implementar la infraestructura PKI, puede solicitar un certificado *.p12 para el servidor Radius/NPS. Simplemente importe el certificado al almacén de certificación personal de la máquina local.

configuración del radio del servidor de Windows

En la pestaña Avanzado, seleccione Nombre del proveedor: Cisco.

configuración del servidor de radio de Windows

Puede usar el comando PowerShell en lugar de la GUI de NPS para agregar un nuevo cliente RADIUS. En este caso, puede usar el cmdlet de PowerShell New-NpsRadiusClient:

New-NpsRadiusClient –Dirección "192.168.31.1" –Nombre "cisco2960" –SharedSecret "Zb+kp^JUy]vePb-hQ*d=weya2AY?hn+npRRp[/J7d"

Note. If you are running Datacenter Edition of Windows Server 2022/2019/2016 on the NPS host, you can configure RADIUS clients on NPS by IP address range. This allows you to quickly add a large number of generic RADIUS clients (such as wireless access points) to the NPS console, rather than adding them individually. Specify the IP address range instead of the IP address of the device, using the format 10.1.0.0/22.

By default, NPS uses the following UDP ports to send and receive RADIUS traffic: 1812, 1813, 1645, and 1646. When you install the NPS role on Windows Server, rules for these ports are automatically created and enabled for Windows Defender Firewall. You can list these Windows Firewall rules using PowerShell:

Get-NetFirewallRule -DisplayGroup "Network Policy Server"

If your RADIUS client is located in a DMZ network or an external security perimeter, you must create the appropriate firewall rules.

Configuring NPS Policies on the RADIUS Server

NPS policies allow you to authenticate remote users and grant them access permissions configured in the NPS role. Using NPS access policies, you link the RADIUS client to the domain security group that determines the user privileges on CISCO devices.

There are two types of policy on a RADIUS server:

  • Connection request policies — these policies define a set of conditions that determine which RADIUS servers should authenticate and authorize connection requests received from RADIUS clients;
  • Network policies — a set of conditions and settings that allow you to specify who is authorized to connect to your network and a list of assigned privileges. These policies are processed sequentially from top to bottom;

In our case, we will use only the NPS Network policies. Expand the Policies > Network Policies branch and select New:

install radius server

Specify the Policy name, the type of network access server should remain unchanged (Unspecified).

radius server setup

In the next step Specify conditions, you need to add the conditions under which this RADIUS policy will be applied. Let’s add two conditions — the authorized user must be a member of a specific domain security group, and the device you want to access has a specific name. Use the Add option to create a new condition by selecting the Windows Group type (add the RemoteCiscoUsers group) and specifying the Client Friendly Name (Cisco_*).

Note. The Client Friendly Name field may differ from the DNS name of your device. We will need it in the further steps to identify a specific network device when creating a Remote Access Policy. For example, you can use this name to specify a mask through which several different RADIUS clients are processed by a single access policy.

windows server radius server

On the next screen, select Access Granted.

radius windows server

Our Cisco switch supports only the Unencrypted authentication method (PAP, SPAP), so that’s why we’ll uncheck all other options.

windows radius

Skip the next configuration Constraints step.

In the Configure Settings section, go to the RADIUS Attributes > Standard section. Delete the existing attributes there and click the Add button.

Select Access type > All, then Service-Type > Add. Specify Others = Login.

how to configure radius server on windows server

Now add a new attribute in the RADIUS Attributes > Vendor Specific section. Under Vendor, select Cisco, and click Add. Here you need to add information about the attribute. Click Add and specify the following value:

shell: priv-lvl = 15

This value means that the user authorized by this policy will be granted a maximum (15) administrative access privileges on the Cisco device.

set up radius server

The last screen displays all selected NPS policy settings. Click Finish.

how to configure radius server

Hint. You can back up the current NPS server configuration to the XML file using the command:

Export-NpsConfiguration -Path c:psbackup_nps.xml

If you need to restore the NPS configuration from a previously created backup file, run:

Import-NpsConfiguration -Path c:psbackup_nps.xml

When creating and planning RADIUS policies, pay attention to what matters in their order. NPS policies are processed from the top to down, and when it turns out that all the conditions in the next policy are met, their further processing is terminated. You can change the priority of policies in the NPS console using the Processing Order value.

how to setup radius server

To enable the user account to be used for Radius authentication, open the Active Directory Users and Computers snap-in (dsa.msc), find the user, open its properties, go to the Dial-In tab and select the Control access through NPS Network Policy option in the Network Access Permission section.

radius server configuration step by step

Also, you can check the current option value using PowerShell:

Get-ADUser richard.doe -Properties msNPAllowDialin -Server dc1.theitbros.com

If the above command did not return any result (empty), this means that the default value “Control access through NPS Network Policy” is used.

If you want to reset this user attribute to the default state, use the command:

Set-ADUser richard.doe -Clear msNPAllowDialin -Server dc1.theitbros.com

Or you can reset this attribute for all users in the specific Active Directory OU using the LDAP filter:

Get-ADUser -SearchBase "ou=Users,ou=Paris,dc=theitbros,dc=com" -LDAPFilter "(msNPAllowDialin=*)" | % {Set-ADUser $_ -Clear msNPAllowDialin}

Configuring RADIUS Authentication on Cisco Devices

Once you have created the NFS policy, you can proceed to configure your Cisco routers or switches for authentication on the newly installed RADUIS server.

Because we use domain accounts for authorization, the user credentials must be transmitted over the network in an encrypted form. To do this, disable the telnet protocol on the switch and enable SSHv2 on Cisco device using the following commands in configuration mode:

configure terminal

crypto key generate rsa modulus 1024

ip ssh version 2

This is how the Authentication, Authorization, and Accounting (AAA) service works in Cisco IOS: if the response from the server is not received, the client assumes that the authentication has failed. Make sure you created a local user to access your Cisco device in case the RADIUS server is unavailable for any reason.

You can create a local user with the following command:

username cisco_local password $UPerrP@ssw0rd

To make the use of SSH mandatory and disable remote access using Telnet, execute the following commands:

line vty 5 15

transport input ssh

Below is an example of the configuration for authorizing a Radius server for the Cisco Catalyst Switch:

aaa new-model

aaa authentication login default group radius local

aaa authorization exec default group radius if-authenticated

radius-server host 192.168.1.16 key Sfs34e#sf

#Specify your RADIUS server IP address and key for encryption (the shared secret that we specified on the RADIUS server)

service password-encryption

# Enable password encryption

If you have several Radius servers, add them to the group:

aaa group server radius radius_srv_group

server 192.168.1.16

server 192.168.101.16

This completes the minimum switch configuration and you can try to check Radius authentication on your Cisco device.

How to Enable Microtik (RouterOS) User Authentication via RADIUS?

In this part, we will show you how to configure RADIUS authentication for VPN user connections via a Mikrotik router (RouterOS based).

Open the Network Policy Server console (nps.msc) and create a new Radius client.

Select New RADIUS Client and configure the following settings:

  • Enable this RADIUS Client;
  • Friendly Name — enter the name of your Mikrotik router here;
  • Address — specific the IP address of the Mikrotik router;
  • Specify your Pre-shared secret key.

setting up radius server

Create a new Network Policy with the following settings:

  • User Groups — specify the name of the domain user group that is allowed to authenticate on your Mikrotik router;
  • Authentication Type — MS-CHAPv2;
  • Tunnel Type — Point-to-Point Tunneling Protocol (PPTP);
  • Access Permissions — Access granted;
  • In the Configure Authentication Methods window, leave only MS-CHAPv2 and allow users to change expired passwords (User can change password after it has expired option);
  • Multilink and Bandwidth Allocation Protocol (BAP) – Do not allow Multilink connections;
  • In the Standard section, remove Service-Type – Framed and leave only Framed-Protocol PPP;
  • Encryptions — leave only the strongest encryption (MPP 128-bit) method.

how to setup a radius server

Once you have created a new policy, open the Network Policy Server settings.

Leave only the following UDP ports for the RADIUS server communications:

  • Authentication — 1812;
  • Accounting — 1813.

radius server windows server

Check if these UDP ports are open in Microsoft Defender Firewall Rules. If not, open them manually.

Now you need to configure the connection settings for Windows Server RADIUS in the Mikrotik configuration (we assume that PPP VPN Server is already configured on RouterOS).

Check in the PPTP server settings that only mschap2 is allowed to use for authentication.

create radius server

Now we need to configure the connection to Radius NPS server. Select New Radius Server and specify the following options:

  • Service: ppp;
  • Address: IP address of the RADIUS server;
  • Secret: pre-shared key that you specified in the network policy settings;
  • Src/ Address: Mikrotik IP address from which traffic will be sent to NPS;
  • Authentication Port: 1812;
  • Accounting Port: 1813.

setting up a radius server

Add appropriate access rules to Mikrotik Firewall.

Then go to Secrets > PPP Authentication and Accounting and enable the Use Radius option.

radius windows microtik

It remains to configure a PPTP VPN connection to your Mikrotik VPN on users’ computers. Users can use their Active Directory account credentials to authenticate against Mikrotik (accounts must be added to the AD group that you have specified when creating the Miktotik Network Policy on NPS).

How to View the NPS/RADIUS Event Logs on Windows?

To enable NPS Server Radius Authentication logging, you need to enable the Network Policy Server audit policy. You can enable this policy via the local Group Policy Editor (gpedit.msc). Go to Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policy Configuration > Audit Policies > Logon/Logoff > Audit Network Policy Server and check the option to audit both success and failure logon attempts.

how to set up radius server

Or you can enable this NPS audit policy with the following commands:

auditpol /get /subcategory:"Network Policy Server"

auditpol /set /subcategory:"Network Policy Server" /success:enable /failure:enable

radius configuration

Now you can open the Event Viewer console (eventvwr.msc), go to the Windows Logs > Security, and filter the event by the Event ID 6272.

Network Policy Server granted access to a user.

radius on windows server

If the user has entered an incorrect password or is not authorized to log on through the RADIUS Client, Event ID 6272 is displayed:

Network Policy Server denied access to a user.

If a user enters an incorrect password multiple times, their account will be locked out in accordance with your Account Lockout Policy in AD.

Event ID: 6279

Network Policy Server locked the user account due to repeated failed authentication attempts.

If you need to find all NPS authorizations events for the specific user (Richard.Doe in this example), use the next PowerShell script:

$Query = @"

<QueryList>

<Query Id="0" Path="Security">

<Select Path="Security">

*[EventData[Data[@Name="SubjectUserName"] y (Datos=theitbrosrichard.doe')]]y *[System[(EventID='6272')]]   "@ $events = Get-WinEvent -FilterXML $Query $ipaddr = @{ label="IP"; Expression={$_.properties[9].valor} } $eventos |  seleccione $ipaddr |  grupo "PI" |  format-table Recuento, Nombre -autosize