Computer Networks / Practical class / Practical class 21
Practical class · Computer Networks

Network Authentication and Authorization

Why does the university Wi-Fi ask for a login while the guest network does not? Why does a banking app wait for an SMS code even though it knows your password? In the last practical class of the course we put together the AAA system that controls who is getting into the network (authentication), what they may do (authorization) and what they have done (accounting): RADIUS and TACACS+, 802.1X, salted hashes and one-time codes — and at the end a capstone audit that ties the whole course together.

:ik-kitob: Practical class 21 ⏱ 2 academic hours (80 minutes) 🚇 Packet simulators ⚡ Who? What can they do? What did they do?
21

Lesson goals and plan

By the end of the lesson you will…

  • you can tell the stages of identification, authentication, authorization and accounting (AAA) apart
  • you can explain authentication factors and MFA and compute an HOTP/TOTP code in Python
  • you can prove why passwords must be stored not in plain text but with a salt and a slow hash
  • you can compare RADIUS and TACACS+ by port, encryption and functions
  • you can explain step by step the exchange between the supplicant, the authenticator and the authentication server in 802.1X
  • you can model role-based access control (RBAC), a lockout policy and accounting records in a program
  • you can combine everything learned during the course and automatically audit a campus network

Plan (according to the syllabus)

  1. Network Authentication and Authorization

Compare AAA with an airport: passport control is authentication, which flights the boarding pass lets you board is authorization, the cameras and the logbook are accounting. If one is missing, the others work only by halves.

They found out your password. Can your account still stay safe?

The student Malika used her LMS password on several sites. One of them was hacked, and the password database leaked onto the Internet. The next day someone tried to log in to the university system in Malika’s name — the password was right, but the system asked for the 6-digit code on her phone. The attacker had no phone. The login was denied, Malika received a warning, and the administrator saw in the log which IP the attempt came from. In this small story all three “A”s of AAA worked. Today we learn to build them at the network level — on Wi-Fi, a switch port and a router console.

Key terms

Theory reminder

0 Identification“I am malika” A1 Authenticationpassword + code → “proved” A2 Authorizationrole = teacher → VLAN 10 A3 Accounting09:02–10:47, 312 MB each stop relies on the previous one: a user who has not been proved is not given access
Fig. 21.1. The AAA “line”: identification → authentication → authorization → accounting.
Table 21.1. Authentication factors
FactorExamplesWeakness
Something you know (knowledge)A password, a PIN, a secret questionGuessing, phishing, reusing one password in many places
Something you have (possession)An app on your phone (TOTP), an SMS code, a hardware key (FIDO2), a smart card, an ID cardCan be lost; an SMS can be intercepted through a SIM swap
Something you are (inherence)A fingerprint, a face, a voiceCannot be replaced; often checked locally inside the device

MFA = different kinds of factors. A password + a secret question are both “something you know”, so that is not MFA. A password + a code on your phone is genuine two-factor authentication (2FA). Government service portals also use factors beyond a password for login, such as an SMS code, an electronic digital signature (EDS) or an ID card.

Table 21.2. RADIUS and TACACS+
FeatureRADIUSTACACS+
TransportUDP 1812 (auth), 1813 (accounting); old: 1645/1646TCP 49
EncryptionOnly the password field is hiddenThe whole message body is encrypted
AAA separationAuthentication and authorization in one reply (Access-Accept)All three A’s are separate — each command can be authorized individually
StandardAn open standard (RFC 2865, 2866)Originated at Cisco, described in RFC 8907
Typical useUsers getting onto the network: Wi-Fi, 802.1X, VPNAdministrators managing routers/switches

Network Authentication and Authorization

Three sample tasks: storing a password correctly, configuring AAA through RADIUS on a router, and 802.1X on a switch port. Two simulators: the 802.1X/RADIUS exchange and a password-strength meter. Then you compute one-time codes (HOTP) yourself.

Sample task 1. How should a password be stored?

Condition: suppose the users table of the department website has leaked. What does the attacker get with each of three storage methods?

MethodWhat is in the databaseIf it leaks
Plain textaziz | Andijon#2026Every password is known at once — the worst case
A fast hash without a salt (SHA-256)aziz | 3f1a…Identical passwords give identical hashes; popular passwords are found in an instant from ready-made tables; the rest are guessed on a GPU at billions per second
A salt + a slow hash (bcrypt, scrypt, Argon2, PBKDF2)aziz | $argon2id$…tuz…xeshEach password has to be guessed separately and very slowly — strong passwords are practically never found
  1. At registration

    Generate a random salt for each user (for example, 16 bytes), compute hash = H(salt + password) and write the salt and the hash to the database. The password itself is stored nowhere.

  2. At login

    Take the user’s salt from the database, recompute the hash with the entered password and compare it with the stored one (hmac.compare_digest — a timing-safe comparison).

  3. Why “slow”?

    0.1 seconds is unnoticeable for a user, but if every guess takes the attacker 0.1 seconds, billions of attempts take years. For simplicity the tasks in this lesson use SHA-256, but a real system uses Argon2id or bcrypt.

Simulator 1: a password-strength meter

Type a sample password (do not type your real password! — the page sends it nowhere, but it is a good habit). The meter computes the entropy (in bits) from the character set and the length and shows the approximate time needed to guess it at random in two cases: a fast hash (1010 guesses per second, a powerful GPU) and a slow hash (104 per second). Popular dictionary passwords are found in an instant regardless of their entropy.

:ik-qulf: Password lab

Length—
Character set—
Entropy—
Fast hash (1010/s)—
Slow hash (104/s)—

    Experiment +10 XP: compare “Andijon2026”, “andijon2026!”, “Choynak-Olma-Metro-42” and “xQ7#pL9!”. Which one is easy to remember yet came out the strongest? Which has more effect — the length or the variety of characters?

    Sample task 2. AAA through RADIUS on a router

    Condition: the department has 6 routers and switches. Keeping a separate admin password on each is risky and inconvenient. Control access to all the devices through a central RADIUS server (10.2.0.20), and if the server goes down — a local backup account.

    Cisco IOS: centralised AAAaaa new-model
    ! RADIUS server and the shared secret key
    radius server KAFEDRA-RAD
     address ipv4 10.2.0.20 auth-port 1812 acct-port 1813
     key <uzun-maxfiy-kalit>
    aaa group server radius RAD-GRP
     server name KAFEDRA-RAD
    ! A1: who can log in (RADIUS first, the local database if there is no reply)
    aaa authentication login default group RAD-GRP local
    ! A2: which privilege level after login
    aaa authorization exec default group RAD-GRP local
    ! A3: record the start and the end of the session
    aaa accounting exec default start-stop group RAD-GRP
    ! Backup account (only when RADIUS is not working)
    username zaxira privilege 15 secret <kuchli-parol>
    1. aaa new-model

      Turns on the AAA mechanism — after that, login methods work according to a method list.

    2. The order of the method list

      group RAD-GRP local: RADIUS first. The device falls back to the local database only if the server does not respond. If the server says “Reject”, it does not fall back to the local database — this is important!

    3. Authorization

      The user is given a privilege level based on the attributes in the RADIUS reply: a teacher — view only, an administrator — configure.

    4. Accounting

      Every login and logout is recorded on the server: who, to which device, when. When there are many devices and commands have to be controlled separately, TACACS+ is often chosen.

    Sample task 3. 802.1X on a switch port

    Condition: nobody should be able to plug their laptop into a socket in the computer lab and get into the internal network. The port should open only after the user has authenticated, and a VLAN should be assigned according to the RADIUS reply.

    Cisco IOS: port-based controlaaa authentication dot1x default group RAD-GRP
    aaa authorization network default group RAD-GRP
    dot1x system-auth-control
    interface GigabitEthernet1/0/5
     switchport mode access
     authentication port-control auto      ! the port is closed until authentication
     dot1x pae authenticator

    Supplicant

    The 802.1X client on the user’s device (built into Windows, Android, macOS). It supplies a login/password or a certificate.

    Authenticator

    A switch or a Wi-Fi access point. It “translates” EAP messages from EAPOL to RADIUS and opens/closes the port.

    Authentication server

    A RADIUS server (for example, FreeRADIUS, Microsoft NPS). It checks against the user database and returns attributes such as the VLAN.

    :ik-talaba:eduroamThe Wi-Fi network of the world’s universities is built on 802.1X and a RADIUS federation: a student can connect on a campus in another country with their own university login.
    :ik-bino:Corporate Wi-Fi“WPA2/WPA3-Enterprise” is exactly 802.1X: every employee uses their own login, there is no shared password.
    :ik-telefon:A banking appA password + a key bound to the device + biometrics — three factors in one app.
    :ik-karta:An ID cardA chip ID card and an EDS key are a “something you have” factor; they are used for strong authentication in government services.

    Simulator 2: the 802.1X + RADIUS exchange

    Choose a scenario and press Next step. Watch which message goes from which side to which, and over which protocol. The port state and the assigned VLAN are shown at the top.

    :ik-qalqon: Port Gi1/0/5 unauthorized

    Supplicant
    Switch
    RADIUS server
    Choose a scenario.

    One-time codes: how do HOTP and TOTP work?

    The authenticator app on the phone and the server know the same secret key (shared once through a QR code). Computing a code: HMAC-SHA1(key, counter) → “dynamic truncation” (the low 4 bits of the last byte give an offset, 4 bytes are taken from that place, and the highest bit is dropped) → mod 106. In TOTP the counter = Unix time // 30, so the code changes every 30 seconds and works even without the Internet.

    Test runs: first predict, then check

    // REMEMBER IN 1 MINUTE

    1. AAA: authentication (who are you?), authorization (what is allowed?), accounting (what did you do?).
    2. MFA — factors of different kinds: something you know + something you have + something you are.
    3. Passwords: a salt + a slow hash (Argon2, bcrypt, PBKDF2); never in plain text.
    4. RADIUS: UDP 1812/1813, only the password is hidden. TACACS+: TCP 49, full encryption, the A’s are separate.
    5. 802.1X: supplicant → authenticator (EAPOL) → RADIUS; the VLAN comes in the reply.

    Independent tasks

    7 tasks — from a password policy to accounting. Use input() without a prompt text. All logins and passwords are training samples.

    Common mistakes

    ErrorConsequenceCorrect answer
    Confusing authentication and authorization (“they got in — so they may do everything”)A student can change the gradesThe principle of least privilege, RBAC
    Passwords in plain text or with an unsalted MD5/SHAIf the database leaks — all the accounts go with itA salt + Argon2id / bcrypt / PBKDF2
    One shared admin account on every deviceNobody knows who did what, and the password stays when an employee leavesCentral AAA (RADIUS/TACACS+), personal accounts, accounting
    The local backup account is first in the aaa ... local listCentral control is bypassedgroup RAD-GRP local — the local one last
    The server certificate is not checked in 802.1XA fake access point gets the proof of the passwordMandatory checking of the server certificate and its name on the supplicant
    No lockout policyUnlimited brute-forceLimiting attempts, delays, MFA
    The error message tells apart “No such login” / “Wrong password”The attacker finds out which logins existA general “Wrong login or password” for the outside user

    Boss level

    Boss level: a mini-RADIUS server with MFA

    Write a simplified AAA server for the department Wi-Fi +70 XP. The user database is in the code: a salt, a hash, a role, an HOTP key (or None — no MFA) and a counter.

    Input: n, then n lines login password otp (for a user without MFA put - in place of otp).
    Rules (in this order): no such login → Access-Reject: login (foydalanuvchi yo‘q); the hash does not match → (parol xato); if there is a key, otp must equal one of the HOTP codes from the counter’s current value c to c+2, otherwise (OTP xato); on a match, counter = the found value + 1 (so a code cannot be reused!).
    Success: Access-Accept: login (rol=talaba, VLAN=20). At the end Accept: a, Reject: b.

    End of the course: the capstone project

    You have passed through the “stops” of 21 practical classes: IP addressing and subnetting, DHCP and the default gateway, CIDR, static and dynamic routing, HTTP/HTTPS, FTP/SFTP, SNMP, VPN, security and AAA. Now we combine them in a single task.

    IPv4IPv6SubnettingDHCP GatewayCIDRRouting RIP/OSPF/BGPTable analysisHTTP(S) FTP/SFTPSNMPVPNSecurity AAA — you are here The addressing and routing line The services and security line
    Fig. 21.2. The course “metro map”: the stops of the practical classes and the two lines that connect them.

    Task: an audit program that checks the inventory of devices on a campus network. Each device line: name ip/prefix gateway services (services separated by commas, for example ssh,https). The checks and messages (in this order) +100 XP:

    1. the IP is the network or broadcast address of its own subnet (if the prefix is 30 or smaller) → IP tarmoq/broadcast manzili (subnetting);
    2. the gateway does not belong to the device’s subnet → Shlyuz boshqa subnetda (default gateway, CIDR);
    3. the services contain telnet → Telnet (SSH ishlating); ftp → FTP (SFTP ishlating); http is there and https is not → HTTP (HTTPS qo‘shing); snmp-public → SNMP community public; pptp → PPTP (IKEv2/WireGuard) (services, SNMP, VPN, security).

    For each device print name: OK or name: message1; message2, and at the end Moslik: k/n (the number of devices without problems).

    The capstone report

    • A campus network diagram: at least 3 VLANs/subnets, a router, a switch, a server and Wi-Fi; the address and gateway of each subnet.
    • An address-plan table (subnetting/CIDR): network, prefix, number of hosts, gateway, DHCP range.
    • Routing: static routes or an OSPF configuration (with sample commands).
    • Services: HTTPS, SFTP, SNMPv3 (without a public community), DNS.
    • Security and AAA: firewall rules, VPN (remote access), 802.1X/RADIUS, an MFA policy.
    • The output of the audit program and the fixes of the problems found (before/after).

    A closing word. The “Computer Networks” course ends here, but your network journey is only beginning. In the first lesson you followed the path of a single packet — now you can address it, route it, put it into an encrypted tunnel, pass it through a firewall and check who sent it. Recommended next steps: assemble your whole capstone diagram in Cisco Packet Tracer, analyse your own traffic with Wireshark (only on your own device) and prepare for the CCNA level with the Cisco Networking Academy (netacad.com) courses. Networks are the foundation of every IT field: whether you become a programmer, an administrator, a cybersecurity specialist or a cloud engineer, you will need this knowledge every day. Good luck, engineer!

    Reinforcement

    Review questions

    Explain the difference between identification, authentication and authorization with an example.

    Entering a login when connecting to Wi-Fi is identification; checking the password and the code is authentication; giving a teacher VLAN 10 and the right to access systems is authorization.

    Why is accounting needed?

    To record who used the network, when, from where and for how long: for investigating incidents, audit, traffic billing and detecting violations.

    Explain the three authentication factors and the concept of MFA.

    Something you know (a password), something you have (a phone, a token, a card), something you are (biometrics). MFA is the use of at least two factors of different kinds.

    How should passwords be stored, and why?

    With a random salt for each user and a slow hash function (Argon2id, bcrypt, scrypt, PBKDF2). Even if the database leaks, recovering the passwords is very expensive; identical passwords also look different.

    How do HOTP and TOTP differ?

    HOTP creates a code from a counter (it grows with each use), TOTP from time (usually a 30-second step). Both are based on an HMAC with a shared key.

    Compare RADIUS and TACACS+.

    RADIUS: UDP 1812/1813, only the password field is hidden, authentication and authorization together; for users getting onto the network. TACACS+: TCP 49, the whole message is encrypted, AAA is separate, command-level authorization; for managing devices.

    Name the three roles in 802.1X and the main sequence of messages.

    Supplicant (the client), authenticator (the switch/AP), authentication server (RADIUS). EAP-Request/Identity → EAP-Response/Identity → Access-Request → (Access-Challenge, TLS tunnel) → Access-Accept/Reject → EAP-Success/Failure → Accounting Start.

    What is MAB and why is it considered a weak method?

    MAC Authentication Bypass — connecting devices without an 802.1X client (a printer, a camera) by their MAC address. A MAC is easy to spoof, so such devices are placed in a restricted VLAN.

    How are the principle of least privilege and RBAC related?

    Each user is given only the rights needed for their work. RBAC does this through roles: rights are attached to a role and the user is attached to a role — it is easy to manage and has few errors.

    Independent work

    The independent-study topic in the course syllabus: “Network security: authentication, encryption, SSL/TLS and the main cyberattacks.” (6 hours). This practical class relies on the authentication part of the topic. According to your variant: (1) draw the AAA diagram (who is the supplicant, the authenticator, the server), (2) build a table of roles and permissions, (3) write a password and MFA policy, (4) carry out the variant’s Python task, (5) explain in 1 page the part related to SSL/TLS or encryption.

    Assessment criteria (individual assignment)
    CriterionPoints
    The AAA diagram is correct, the roles are clear1
    The table of roles and permissions follows the principle of least privilege1
    The password and MFA policy is justified1
    The Python program works and has been tested1
    A note on SSL/TLS or encryption, sources1

    Summary

    Three “A”sAuthentication — who are you, authorization — what is allowed, accounting — what did you do.
    MFAFactors of different kinds: a password + a code on the phone. Even if one password is exposed, the account stays protected.
    Storing passwordsA salt + a slow hash. Plain text and an unsalted fast hash are forbidden.
    One-time codesHOTP/TOTP: HMAC + dynamic truncation; the counter or the time prevents reuse.
    RADIUS and TACACS+UDP 1812/1813 — users getting in; TCP 49 — managing devices, command-level control.
    802.1XThe port is closed until authentication; the RADIUS reply sets the VLAN; MAB — only for a restricted VLAN.
    Least privilegeRBAC, personal accounts, a lockout policy and accounting — the foundation of central AAA.
    End of the courseAddressing, routing, services and security — the layers of a single network. The capstone audit ties them together.

    Your lesson results

    Your results are saved in this browser. Read all the sections and complete the exercises and assignments.

    My personal notes