In Figure 1, terminals in a company's visitor area are connected to the company's intranet through the switch. Unauthorized access to the internal network can damage the company's service system and cause leakage of key information. Therefore, the administrator requires that the Switch should control users' network access rights to ensure internal network security.
Because visitors move frequently, Portal authentication is configured and the RADIUS server is used to authenticate user identities.
# Create and configure the RADIUS server template rd1.
[Switch] radius-server template rd1 [Switch-radius-rd1] radius-server authentication 192.168.2.30 1812 [Switch-radius-rd1] radius-server shared-key cipher Huawei@2012 [Switch-radius-rd1] quit
# Create the AAA authentication scheme abc and set the authentication mode to RADIUS.
[Switch] aaa [Switch-aaa] authentication-scheme abc [Switch-aaa-authen-abc] authentication-mode radius [Switch-aaa-authen-abc] quit
# Create the authentication domain huawei.com, and bind the AAA authentication scheme abc and RADIUS server template rd1 to the domain.
[Switch-aaa] domain huawei.com [Switch-aaa-domain-huawei.com] authentication-scheme abc [Switch-aaa-domain-huawei.com] radius-server rd1 [Switch-aaa-domain-huawei.com] quit [Switch-aaa] quit
# Check whether a user can pass RADIUS authentication. The test user test and password Huawei2012 have been configured on the RADIUS server.
[Switch] test-aaa test Huawei2012 radius-template rd1 Info: Account test succeeded.
By default, the unified mode is enabled. After the NAC mode is changed, the device automatically restarts.
[Switch] authentication unified-mode
[Switch] ssl policy abcd [Switch-ssl-policy-abcd] certificate load pem-cert cert_rsa_cert.pem key-pair rsa key-file cert_rsa_key.pem auth-code cipher huawei [Switch-ssl-policy-abcd] ssl minimum version tls1.2 [Switch-ssl-policy-abcd] quit
Before loading a certificate for the SSL policy, ensure that the certificate file and key pair file have been stored on the switch; otherwise, certificate loading will fail. In addition, the certificate file and key pair file must be saved in the subdirectory security under the system root directory. If the subdirectory security does not exist, create it.
[Switch] portal web-authen-server https ssl-policy abcd
[Switch] web-auth-server abc [Switch-web-auth-server-abc] protocol http password-encrypt uam [Switch-web-auth-server-abc] http-method post cmd-key cmd1 [Switch-web-auth-server-abc] url https://192.168.2.30:8445/portal [Switch-web-auth-server-abc] quit
In this example, only the cmd-key parameter in the http-method post command is configured, and other parameters for parsing POST request packets use the default values. However, the parameter values must be the same as those on the Portal server; otherwise, the device fails to communicate with the Portal server.
[Switch] portal-access-profile name web1 [Switch-portal-acces-profile-web1] web-auth-server abc direct [Switch-portal-acces-profile-web1] quit
# Configure the authentication profile p1, bind the Portal access profile web1 to the authentication profile, specify the domain huawei.com as the forcible authentication domain in the authentication profile, set the user access mode to multi-authen, and set the maximum number of access users to 100.
[Switch] authentication-profile name p1 [Switch-authen-profile-p1] portal-access-profile web1 [Switch-authen-profile-p1] access-domain huawei.com force [Switch-authen-profile-p1] authentication mode multi-authen max-user 100 [Switch-authen-profile-p1] quit
In this example, users use static IP addresses. If users obtain IP addresses using DHCP and the DHCP server is on the upstream network of the switch, configure an authentication-free rule to allow packets from the network segment of the DHCP server to pass through. For details on how to configure an authentication-free rule, see (Optional) Configuring Authentication-Free Authorization Information for Users.
# Bind the authentication profile p1 to GE0/0/1 and enable Portal authentication on the interface.
[Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] authentication-profile p1 [Switch-GigabitEthernet0/0/1] quit