enable
configure terminal
! Создаём VLAN 10 и 20
vlan 10
name USERS
exit
vlan 20
name SERVERS
exit
! Назначаем порт Gi1/0/3 в VLAN 10 (access)
interface GigabitEthernet1/0/3
switchport mode access
switchport access vlan 10
spanning-tree portfast
exit
! Настраиваем trunk на Gi1/0/48 к соседнему коммутатору
interface GigabitEthernet1/0/48
switchport mode trunk
switchport trunk allowed vlan 10,20
exit
! Сохраняем изменения
end
write memory
! Проверяем результат
show vlan brief
show interfaces trunk enable configure terminal end
write memory copy running-config startup-config Схема режимов Cisco IOS:
User EXEC (>)
↓ enable
Privileged EXEC (#)
↓ configure terminal
Global Config (config)#
↓ interface gi1/0/1
Interface Config (config-if)#
↓ exit / end configure terminal
vlan 10
name USERS
exit
vlan 20
name SERVERS
exit
vlan 2
name MGMT
exit
end show vlan brief configure terminal
vlan 100,102,105-107
exit enable
configure terminal
vlan 2
name MGMT
exit
vlan 10
name USERS
exit
vlan 20
name SERVERS
exit
end
write memory
show vlan brief configure terminal
interface GigabitEthernet1/0/3
switchport mode access
switchport access vlan 10
spanning-tree portfast
exit
end configure terminal
interface GigabitEthernet1/0/3
switchport mode access
switchport access vlan 10
spanning-tree portfast
exit
end configure terminal
interface range GigabitEthernet1/0/1 - 12
switchport mode access
switchport access vlan 10
spanning-tree portfast
exit
end configure terminal
interface GigabitEthernet1/0/5
switchport mode access
switchport access vlan 10
switchport voice vlan 50
spanning-tree portfast
exit
end configure terminal
interface GigabitEthernet1/0/48
switchport mode trunk
switchport trunk allowed vlan 10,20,50
exit
end ! Полная перезапись списка
switchport trunk allowed vlan 10,20,50
! Добавление VLAN к существующему списку
switchport trunk allowed vlan add 100
! Удаление VLAN из списка
switchport trunk allowed vlan remove 50 show interfaces trunk
interface GigabitEthernet1/0/48
switchport trunk native vlan 99
exit show interfaces trunk interface GigabitEthernet1/0/48
switchport mode trunk
switchport trunk allowed vlan 10,20,50
switchport trunk native vlan 99
switchport nonegotiate
exit show vlan brief VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Gi1/0/4, Gi1/0/6-47
10 USERS active Gi1/0/1-3
20 SERVERS active Gi1/0/5
99 MGMT active show interfaces trunk Port Mode Encapsulation Status Native vlan
Gi1/0/48 on 802.1q trunking 99
Port Vlans allowed on trunk
Gi1/0/48 10,20,50
Port Vlans allowed and active in management domain
Gi1/0/48 10,20,50
Port Vlans in spanning tree forwarding state and not pruned
Gi1/0/48 10,20,50 show running-config | section vlan
show running-config interface GigabitEthernet1/0/48 show interfaces GigabitEthernet1/0/3 switchport Name: Gi1/0/3
Switchport: Enabled
Administrative Mode: access
Operational Mode: access
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: native
Access Mode VLAN: 10 (USERS) configure terminal
no vlan 99
exit interface GigabitEthernet1/0/3
no switchport access vlan
exit default interface GigabitEthernet1/0/3 end
write memory copy running-config startup-config show startup-config | include vlan
show startup-config | section interface