A floor went down at midnight; you connect to the console and the switch’s configuration looks nothing like the one in the next building. Someone left telnet open, the other one has no BPDU Guard, and port descriptions reflect three different people’s three different habits. In this situation, every fault is a separate puzzle. A switch configuration standard (golden config) gathers the lines that must be common to all devices, port templates and naming rules in a single document. Below we give a baseline template annotated line by line on Cisco IOS XE and a checklist for auditing compliance with the standard; the same logic can be adapted to other vendors’ command sets.
Why a single configuration standard?
The real benefit of a standard configuration isn’t installation speed but operations:
- Predictable behavior: If an access port has the same BPDU protection, the same storm control threshold and the same QoS policy wherever it is, the question “what’s enabled on this port?” disappears during a fault.
- Auditability: Deviation from the standard is caught by automatically comparing configuration backups. For backup and diff tracking, see the configuration backup with Oxidized article.
- Secure defaults: Risky settings such as telnet, HTTP management and shared local passwords are disabled once in the template and come disabled on every new device.
- Handover: A new team member or external support understands how the whole enterprise network infrastructure is configured by reading a single document.
The standard consists of three parts: device-wide (global) settings, port templates and naming rules. Each part is kept with a version number; changes go through the change management process. A standard without a document isn’t a standard.
Naming and description rules
The hostname should say where the device is and what it does. A sample scheme:
| Field | Example | Meaning |
|---|---|---|
| Location | IST-HQ | City and site code |
| Building/floor | B1-K2 | Building number and floor |
| Role | AS / DS / CS | Access, distribution, core |
| Sequence | 01 | Device number within the same role |
Result: IST-HQ-B1-K2-AS01 (K = floor). No Turkish characters or spaces are used; the DNS record, the monitoring system and the log server use the same name.
Port descriptions are written with the same discipline. The recommended format is TYPE | FAR END | NOTE: UPL | IST-HQ-B1-DS01 Te1/0/5, AP | B1-K2-AP07, SRV | ESX03 vmnic2, USR | Desktop, UNUSED. If the first field is chosen from a fixed code list, quick reports can be produced with filters such as show interfaces description | include ^Te.*UPL. One thing that can waste a lot of time is an uplink whose description is “new” or “test.” For documenting port mappings, the network documentation and port map article complements this rule.
Management plane: SSH, AAA, NTP, syslog, SNMP
The template below is for an L2 access switch. Values in angle brackets are filled in per organization; passwords and keys aren’t written in clear text in the template, they’re taken from the vault.
hostname IST-HQ-B1-K2-AS01
!
! Time and log timestamps
clock timezone TRT 3 0
service timestamps log datetime msec localtime show-timezone
service timestamps debug datetime msec localtime show-timezone
service password-encryption
!
! Unused management services disabled
no ip http server
no ip http secure-server
no ip domain lookup
!
! Local emergency account (if the AAA server is unreachable)
username <emergency-account> privilege 15 algorithm-type scrypt secret <password>
!
! AAA: TACACS+ primary, local account as fallback
aaa new-model
tacacs server TACACS-1
address ipv4 10.0.100.21
key <key>
aaa group server tacacs+ TACACS-GRP
server name TACACS-1
ip tacacs source-interface Vlan100
aaa authentication login default group TACACS-GRP local
aaa authorization exec default group TACACS-GRP local if-authenticated
aaa accounting exec default start-stop group TACACS-GRP
aaa accounting commands 15 default start-stop group TACACS-GRP
!
! SSH
ip domain name corp.example
ip ssh version 2
ip ssh time-out 60
ip ssh authentication-retries 3
! (run once) crypto key generate rsa modulus 3072
!
! Management access list
ip access-list standard ACL-MGMT
permit 10.0.100.0 0.0.0.255
deny any log
line vty 0 15
access-class ACL-MGMT in
transport input ssh
exec-timeout 10 0
line con 0
exec-timeout 10 0
!
! Management VLAN (L2 switch only)
interface Vlan100
description MGMT
ip address 10.0.100.45 255.255.255.0
ip default-gateway 10.0.100.1
!
! NTP
ntp server 10.0.100.1 prefer
ntp server 10.0.100.2
ntp source Vlan100
!
! Syslog
logging buffered 64000 informational
logging trap informational
logging source-interface Vlan100
logging host 10.0.100.30
!
! SNMPv3 (read-only)
ip access-list standard ACL-SNMP
permit 10.0.100.40
snmp-server group NMS-RO v3 priv access ACL-SNMP
snmp-server user <nms-user> NMS-RO v3 auth sha <auth-password> priv aes 128 <priv-password>
snmp-server location IST-HQ B1 Floor2 Cabinet-2A
!
banner login ^
This device is for use by authorized personnel only. All access is logged.
^
The reasoning behind the lines:
- Timestamps and NTP: If you’re going to correlate logs across devices, clocks must be synchronized from the same source, and log lines must include milliseconds and the time zone. Two internal sources are used as NTP servers. You can’t do an incident investigation with logs from two devices whose clocks differ.
- AAA: Login with individual accounts and command logging (accounting) make the question “who made this change?” answerable. The
localkeyword allows login with the emergency account when the TACACS+ server can’t be reached; this account’s password is kept in the vault, and its use raises an alarm. - SSH and VTY ACL: Telnet is disabled; management is done only from the management network.
algorithm-type scryptensures the local password is stored with scrypt (type 9) instead of the weak type 7 or MD5-based type 5. - Syslog: The local buffer keeps short-term records for moments when the central server can’t be reached. For central storage and retention period, see the central syslog server setup article.
- SNMPv3: Instead of community-based v1/v2c, authPriv, which offers authentication and encryption, is used. Detailed configuration is in the SNMPv3 configuration guide article.
Access port template
Keep the access port template limited to two or three variants by end device type. As the number of variants grows, the standard falls apart. A user port example:
interface range GigabitEthernet1/0/1 - 44
description USR | Desktop
switchport mode access
switchport access vlan 20
switchport voice vlan 120
switchport nonegotiate
spanning-tree portfast
spanning-tree bpduguard enable
storm-control broadcast level 1.00
storm-control multicast level 5.00
storm-control action trap
no shutdown
switchport mode accessandnonegotiate: The port doesn’t enter into trunk negotiation with the far end via DTP.portfastandbpduguard: An end device connection comes up without waiting for the STP listening process; if a switch is plugged into the port, the port goes err-disabled. Faults where small switches plugged in under desks create loops can be seen. For the full set of STP protections, see the STP, RSTP and MSTP article.storm-control: Thresholds are in percent of link capacity; the values in this example are illustrative, so set them by measuring your normal traffic profile. Producing only a warning (trap) first, instead of suppressing traffic when a threshold is exceeded, prevents a wrong threshold from turning into an outage.
If authentication (802.1X/MAB) will be used on user ports, the relevant lines are added to this template; the policy and migration plan are covered on the cybersecurity side in the 802.1X and NAC migration plan article.
Uplink and trunk port template
The L2 global lines the port templates rely on are also part of the standard: the STP mode is the same across the whole campus, and the VLAN database is prevented from being accidentally overwritten by VTP. A VTP server with a high revision number being plugged into the network and deleting all VLANs is an old fault that still happens.
spanning-tree mode rapid-pvst
spanning-tree extend system-id
vtp mode transparent
!
interface range TenGigabitEthernet1/1/1 - 2
description UPL | IST-HQ-B1-DS01
switchport mode trunk
switchport trunk native vlan 999
switchport trunk allowed vlan 20,100,120
switchport nonegotiate
channel-group 1 mode active
!
interface Port-channel1
description UPL | IST-HQ-B1-DS01 Po11
switchport mode trunk
switchport trunk native vlan 999
switchport trunk allowed vlan 20,100,120
switchport nonegotiate
The allowed VLAN list on trunks is written explicitly; the “all VLANs” default isn’t used. The native VLAN is a VLAN that carries no user traffic and isn’t assigned to any access port (999 in the example). The two uplinks work as a single logical link with LACP. For member port consistency and hash behavior, see the LACP and EtherChannel configuration article.
Unused ports and the native VLAN
vlan 998
name UNUSED-PARK
vlan 999
name NATIVE-UNUSED
!
interface range GigabitEthernet1/0/45 - 48
description UNUSED
switchport mode access
switchport access vlan 998
switchport nonegotiate
shutdown
Unused ports are kept shut down and assigned to a “parking” VLAN that isn’t routed anywhere. Even if a port is opened by mistake, it doesn’t give access to the user network. VLAN 1 isn’t assigned to any port as an access VLAN or native VLAN; management traffic isn’t carried over VLAN 1 either. Making the native VLAN an unused VLAN eliminates the effect of the VLAN hopping technique using double tagging. An empty port is an open door. For the complete VLAN numbering scheme, the VLAN design in enterprise networks article can be used as a reference.
Standard compliance audit checklist
Writing the standard is the easy part. The real work is regularly verifying that devices comply with it; otherwise within six months every switch goes its own way again. The checks below can be done manually or automatically on each device using the show running-config output:
- Does the hostname follow the naming scheme and match the DNS record?
- Is
transport input sshon all VTY lines, and is telnet disabled? - Is the management ACL applied on the VTY lines?
- Are the
no ip http serverandno ip http secure-serverlines present? - Are AAA configuration and command logging (accounting) enabled?
- Are two NTP servers defined, and does
show ntp associationsshow synchronization? - Is a syslog server defined, and does the server have recent records from this device?
- Is there no SNMP v1/v2c community definition, only SNMPv3 authPriv?
- Do all access ports have
bpduguardandportfast; are the STP mode and VTP mode at the standard values? - Is the allowed VLAN list written explicitly on all trunks, and is the native VLAN 999?
- Are unused ports shut down and in the parking VLAN?
- Are there active ports without a description or with a description that doesn’t fit the standard code list?
These filters are useful for a quick manual check:
show running-config | include ^hostname|^ntp server|^logging host|^snmp-server community
show running-config | section line vty
show interfaces status | include connected
show interfaces description | include UNUSED
As the number of devices grows, automate these checks with a script or a configuration management tool (for example Ansible’s cisco.ios collection or the backup tool’s diff reports). Manual auditing doesn’t scale. As an additional reference for security hardening, the Cisco IOS controls in the CIS Benchmarks can be reviewed. Preparing the standard and applying it to existing switches without drift is part of the switch, router and network device installation service, and reviewing the VLAN and trunk layout is part of VLAN and network segmentation work.
Frequently asked questions
What is the difference between a golden config and a template?
A golden config is the reference form of the approved configuration that must be present on all devices. A template is the form of that reference that can be filled with device-specific variables (hostname, management IP, VLAN numbers). In practice, the golden config is the document and audit criterion; the template is the implementation tool.
Why should the native VLAN be an unused VLAN?
On a trunk, the native VLAN is carried untagged. If the native VLAN is the same as a user VLAN, attempts to send traffic to another VLAN using the double-tagging technique become possible. Making the native VLAN a separate VLAN not assigned to any access port eliminates this risk.
How do you log in to a switch if the TACACS+ server goes down?
If local is added at the end of the AAA method list, local accounts can be used when the TACACS+ server can’t be reached. For this, define a single emergency account with a strong password, keep the password in the vault, and make the monitoring system raise an alarm every time the account is used.
How often should compliance with the standard be audited?
If configuration backups are taken daily, a drift check can be done automatically with each backup. If there’s no automation, at least review the relevant devices with the checklist after every change window, and all devices periodically.