creating sub interface on cisco router code example
Example: cisco router command create subinterface as dot1q
!-- Set the privileged mode
!-- and Telnet password on the switch.
switch
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)
3512xl(config)
3512xl(config)
3512xl(config-line)
3512xl(config-line)
3512xl(config-line)
3512xl(config)
3512xl(config)
!-- Set the IP address and default gateway for VLAN1 for management purposes.
3512xl
Enter configuration commands, one per line. End with CNTL/Z.
3512xl(config)
3512xl(config-if)
3512xl(config-if)
3512xl(config)
3512xl(config)
!-- Set the VTP Mode. !-- In our example, we have set the mode to be transparent. !-- Depending on your network, set the VTP Mode accordingly. !-- For details on VTP, !-- refer to !-- Creating and Maintaining VLANs on Catalyst 2900XL and 3500XL Switches.
3512xl
3512xl(vlan)
Setting device to VTP TRANSPARENT mode.
!-- Adding VLAN2. VLAN1 already exists by default.
3512xl(vlan)
VLAN 2 added:
Name: VLAN0002
3512xl(vlan)
APPLY completed.
Exiting....
!-- Enable trunking on the interface fastEthernet 0/1.
3512xl
Enter configuration commands, one per line. End with CNTL/Z.
3512xl(config)
3512xl(config-if)
!-- Enter the trunking encapsulation as either isl
3512xl(config-if)
!-- or as dot1q:
3512xl(config-if)
!-- In case of 2940/2950 series switches, none of the above two commands are used, !-- 2940/2950 series switches only support 802.1q encapsulation which is configured automatically, !-- when trunking is enabled on the interface by using switchport mode trunk command. !-- In case of dot1q, you need to make sure that !-- the native VLAN matches across the link. !-- On 3512XL, by default, the native VLAN is 1. !-- Depending on your network needs, you may change !-- the native VLAN to be other than VLAN1, !-- but it is very important that you change the native VLAN !-- on the router accordingly. !-- You may change the native VLAN, if needed, by using the following command: !-- 3512xl(config-if)
3512xl(config-if)
3512xl(config-if)
!-- The following set of commands will place FastEthernet 0/2 !-- into VLAN2 and enable portfast on the interface.
3512xl(config)
3512xl(config-if)
3512xl(config-if)
3512xl(config-if)
!-- FastEthernet 0/3 is already in VLAN1 by default. !-- Enable portfast on the interface.
3512xl(config)
3512xl(config-if)
3512xl(config-if)
!-- For details on why to enable portfast, !-- refer to: !-- Using PortFast and Other Commands to Fix Workstation Startup Connectivity Delays. !-- Remember to save the configuration.
3512xl
Building configuration...
3512xl
--------------------------------------------------------------------------------
3512xl
Building configuration...
Current configuration:
!
version 12.0
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname 3512xl
!
no logging console
enable password mysecret
!
!
!
!
!
ip subnet-zero
!
!
!
interface FastEthernet0/1
switchport mode trunk
!
!-- If 802.1Q is configured, !-- you will instead see the following output !-- under interface FastEthernet0/1: !-- interface FastEthernet0/1 !-- switchport trunk encapsulation dot1q !-- switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 2
spanning-tree portfast
!
interface FastEthernet0/3
spanning-tree portfast
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface VLAN1
ip address 10.10.10.2 255.255.255.0
no ip directed-broadcast
no ip route-cache
!
ip default-gateway 10.10.10.1
!
line con 0
transport input none
stopbits 1
line vty 0 4
password mysecret
login
line vty 5 15
login
!
end