Configure an IP address on switch
Cisco switch forward Ethernet frame without any configurations, By default. Means that we can buy Cisco switch, plug with the right cable to connect various device to the switch, power it on, switch will work properly.
Even so, to perform
switch managements over the network or use protocol such as SNMP, the switch
will need to have IP address. The IP address is assign under a logical
interface, called management domain/VLAN. The default VLAN 1
acts the switch own NIC for connecting into a LAN to send IP packet. Below are the step to configure an IP address under VLAN 1:-
1. enter the VLAN 1
configuration modes with "interface vlan 1" global
configuration commands.
2. assign IP address
with "ip address IP_ADDRESS SUBNET_MASK "command.
3. enable VLAN 1
interface with "no shutdown" command.
4.
Below is a simple
example of network:
We have a simple
network a host and a switch. We assign the switch with IP address to
enable IP communication between two devices:
SW1(config)#int vlan 1
SW1(config-if)#
SW1(config-if)#
SW1(config-if)#ip address 10.0.0.2
255.0.0.0
SW1(config-if)#no shutdown
SW1(config-if)#
%LINK-5-CHANGED: Interface Vlan1,
changed state to up
Verify the IP
address on switch, we can use the below command:
SW1#show int vlan 1
Vlan1 is up, line protocol is up
Hardware is CPU Interface, addresses is
0030.a3e8.6b3c (bia 0030.a3e8.6b3c
Internet address is 10.0.0.2/8
....
Verify that the host can reach switch using it IP address by pinging it from Host A:
C:\>ping 10.0.0.2
Pinging 10.0.0.2 with 32 bytes of data:
Reply from 10.0.0.2: bytes=32
time<1ms TTL=255
Reply from 10.0.0.2: bytes=32
time<1ms TTL=255
...
Interface range command
If you have multiple interface that need to be configure with
the same settings, we can use the interface range command
to specify a range of interface to which the subsequent command will be
applied.
Such that, let’s say interfaces Fa0/4, Fa0/5, Fa0/6, Fa0/7,
and Fa0/8 need to have same description. We don’t need to enter the
sub interface mode of each interface separately to configure the description –
we can use the interface range Fa0/4 – 8 command and then
execute the description command:
SW1(config)#interface range Fa0/4 - 8
SW1(config-if-range)#description END_HOSTS
The description parameter will be applied to all interfaces in the
specified range:
SW1#show running-config
Building configuration...
...
Current configuration : 1157 bytes
interface FastEthernet0/3
!
interface FastEthernet0/4
description END_HOSTS
!
interface FastEthernet0/5
description END_HOSTS
!
interface FastEthernet0/6
description END_HOSTS
!
interface FastEthernet0/7
description END_HOSTS
!
interface FastEthernet0/8
description END_HOSTS
!
interface FastEthernet0/9
!
....
Adding a description to interface on a Cisco device doesn’t provide any extra functionality, but it is useful for administrative purposes, since it will help you to remember the interface function. A description of an interface is locally significant and can be up to 240 characters long. It can be set using the description command from the interface sub mode:
Router(config)#interface g0/0 Router(config-if)#description WAN to London
The descriptions is displayed in the output of the show running-config commands:
! interface GigabitEthernet0/0 description WAN to London no ip address duplex auto speed auto shutdown ! interface GigabitEthernet0/1 no ip address duplex auto speed auto shutdown !
To erase description, use the no description command (or the shortcut no desc):
Router(config)#int g0/0 Router(config-if)#no desc
0 Comments