To configure an IP Address on a switch interface, first, we must change the interface from a layer 2 interface to a layer 3 interface. A point to note is that to provide an IP Address to a switch interface, the switch first must be a Multilayer Switch and all ports of an MLS is layer 2 by default. There are two ways to configure an IP address to a switch interface that is given below:
Static Configuration:
Consider a Multilayer Switch:
First, we need to check whether an interface is a layer 2 port or a layer 3 port.
show interfaces f0/1 switchport
Switch port: Enabled means that the port is currently a layer 2 port. To change the interface from a layer 2 switch to a layer 3 switch:
int f0/1
no switchport exit
Providing IP address to an interface:
int f0/1
ip add 192.168.1.1 255.255.255.1
Checking if an IP address has been provided to the interface
show ip int br | ex unassigned
Dynamic Configuration:
Consider this topology:
First, we again make the fa0/1 port of Switch0 a layer 3 port.
int f0/1
no switchport
Then we provide interface Fa0/0 and configure a DHCP pool for the network 192.168.1.0/24 on router0.
int f0/0
ip add 192.168.1.1 255.255.255.0
no sh
exit
ip dhcp pool deadpool
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
dns-server 8.8.8.8
exit
Checking DHCP pool status:
show ip dhcp pool pool
After that, we go to Switch’s interface fa0/1 and execute the command:
int f0/1
ip add dhcp
Simulation of the DORA Process:
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
13 Nov, 2022
Like Article
Save Article