07-08-2023 06:41 AM - last edited on 07-27-2023 10:37 AM by rupeshah
hi all , i want to config cisco switch as if the port is trunk some situation is met (what i want), otherwise (port is access) some other sitution is met.
for example if the port is access just config sw por max 1 and if the port is trunk just sw mode trunk encapluation dot.1q...
ane ideas?
i want for group config switches
07-08-2023 06:47 AM
config two template,
config one template under access port
config other template under trunk port
07-08-2023 07:40 AM
I have a lot of switches.And I want to configure all the ports as a group. And I want it to be checked before the configuration, what configuration to use if it was an access port and what configuration to use if it was a trunk port.
07-08-2023 08:15 AM
IOU1#show run
IOU1#show running-config '
^
% Invalid input detected at '^' marker.
IOU1#show running-config
Building configuration...
Current configuration : 1972 bytes
!
! Last configuration change at 15:13:45 UTC Sat Jul 8 2023
!
version 15.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
service compress-config
!
hostname IOU1
!
boot-start-marker
boot-end-marker
!
!
logging discriminator EXCESS severity drops 6 msg-body drops EXCESSCOLL
logging buffered 50000
logging console discriminator EXCESS
!
no aaa new-model
!
!
!
!
!
no ip icmp rate-limit unreachable
!
!
!
no ip domain-lookup
ip cef
no ipv6 cef
!
!
!
spanning-tree mode rapid-pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
ip tcp synwait-time 5
!
!
!
!
!
!
!
!
!
!
!
!
!
template trunk1
switchport trunk allowed vlan 10,20
switchport trunk encapsulation dot1q
switchport mode trunk
!
template trunk2
switchport trunk allowed vlan 30,40
switchport trunk encapsulation dot1q
switchport mode trunk
!
template vlan10
switchport access vlan 10
!
template vlan20
switchport access vlan 20
!
!
interface Ethernet0/0
source template vlan10
!
interface Ethernet0/1
source template vlan10
!
interface Ethernet0/2
source template vlan10
!
interface Ethernet0/3
source template vlan10
!
interface Ethernet1/0
source template vlan20
!
interface Ethernet1/1
source template vlan20
!
interface Ethernet1/2
source template vlan20
!
interface Ethernet1/3
source template vlan20
!
interface Ethernet2/0
source template trunk1
!
interface Ethernet2/1
source template trunk1
!
interface Ethernet2/2
source template trunk1
!
interface Ethernet2/3
source template trunk1
!
interface Ethernet3/0
!
interface Ethernet3/1
!
interface Ethernet3/2
!
interface Ethernet3/3
!
interface Vlan1
no ip address
shutdown
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
!
!
!
!
control-plane
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
line vty 0 4
login
!
07-08-2023 08:21 AM
below simple lab, it easy to use template,
please careful when config trunk template, any misconfig will lead to L2 LOOP.
double check before apply template for trunk
07-08-2023 07:20 AM
Hello @hamideghbalian
depend of your IOS release, you should have this:
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide