On the network shown in Figure 1, users in a company's guest area access 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.
For guest users, Portal authentication is used and the RADIUS server authenticates the users.
# Create VLANs 10 and 20.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan batch 10 20 [Switch] ipv6
# Configure the Switch's interface GE0/0/1 connected to users as an access interface, and add the interface to VLAN 10.
[Switch] interface gigabitethernet0/0/1 [Switch-GigabitEthernet0/0/1] port link-type access [Switch-GigabitEthernet0/0/1] port default vlan 10 [Switch-GigabitEthernet0/0/1] quit [Switch] interface vlanif 10 [Switch-Vlanif10] ipv6 enable [Switch-Vlanif10] ipv6 address fc00:2::1 112 [Switch-Vlanif10] undo ipv6 nd ra halt [Switch-Vlanif10] quit
# Configure the Switch's interface GE0/0/2 connected to the RADIUS server as an access interface, and add the interface to VLAN 20.
[Switch] interface gigabitethernet0/0/2 [Switch-GigabitEthernet0/0/2] port link-type access [Switch-GigabitEthernet0/0/2] port default vlan 20 [Switch-GigabitEthernet0/0/2] quit [Switch] interface vlanif 20 [Switch-Vlanif20] ip address 192.168.2.10 24 [Switch-Vlanif20] ipv6 enable [Switch-Vlanif20] ipv6 address fc00:3::1 112 [Switch-Vlanif20] undo ipv6 nd ra halt [Switch-Vlanif20] quit
[Switch] ip route-static 192.168.3.0 255.255.255.0 192.168.2.1 [Switch] ipv6 route-static fc00:1:: 112 fc00:3::2
# Create and configure the RADIUS server template rd1.
[Switch] radius-server template rd1 [Switch-radius-rd1] radius-server authentication fc00:1::1 1812 [Switch-radius-rd1] radius-server accounting fc00:1::1 1813 [Switch-radius-rd1] radius-server shared-key cipher Huawei@2012 [Switch-radius-rd1] quit
# Configure a RADIUS authentication scheme.
[Switch] aaa [Switch-aaa] authentication-scheme abc [Switch-aaa-authen-abc] authentication-mode radius [Switch-aaa-authen-abc] quit
# Configure a RADIUS accounting scheme.
[Switch-aaa] accounting-scheme scheme1 [Switch-aaa-accounting-scheme1] accounting-mode radius [Switch-aaa-accounting-scheme1] accounting realtime 15 [Switch-aaa-accounting-scheme1] quit
# Create the authentication domain huawei.com and bind the AAA authentication scheme, AAA accounting scheme, and RADIUS server template to the authentication domain.
[Switch-aaa] domain huawei.com [Switch-aaa-domain-huawei.com] authentication-scheme abc [Switch-aaa-domain-huawei.com] accounting-scheme scheme1 [Switch-aaa-domain-huawei.com] radius-server rd1 [Switch-aaa-domain-huawei.com] quit [Switch-aaa] quit
# Check whether a user can be authenticated through 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] web-auth-server abc [Switch-web-auth-server-abc] server-ip 192.168.3.30 [Switch-web-auth-server-abc] server-ip ipv6 fc00:1::1 [Switch-web-auth-server-abc] port 50200 [Switch-web-auth-server-abc] url http://[FC00:1::1]:8445/portal [Switch-web-auth-server-abc] shared-key cipher Huawei@123 [Switch-web-auth-server-abc] quit
Ensure that the port number configured on the device is the same as that used by 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 (indicating that the device allows multiples users to go online and authenticates each user), 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 to enable Portal authentication.
[Switch] interface gigabitethernet0/0/1 [Switch-GigabitEthernet0/0/1] authentication-profile p1 [Switch-GigabitEthernet0/0/1] quit