Basic Commands for Switch on the interface level

Basic Commands for Switch on the interface level

Today I will be sharing some basic command which we can implement on the switch.

Let's say we have a switch and first we want to change the hostname of the switch from "Switch to TEST", then below is a command which we can use to change the hostname of the switch.

Go into the config mode :

Switch#config t

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#hostname TEST

TEST(config)#

Now we can see that the name of the switch is a TEST.

Let's verify the interfaces of the switch and its status.

TEST#show ip interface brief

Interface             IP-Address     OK? Method Status               Protocol

FastEthernet1         unassigned     YES unset up                   up

TenGigabitEthernet1/1 unassigned     YES unset down                 down

TenGigabitEthernet1/21 unassigned     YES unset down                 down

TenGigabitEthernet1/28 unassigned     YES unset down                 down

TenGigabitEthernet1/29 unassigned     YES unset up                   up

TenGigabitEthernet1/30 unassigned     YES unset down                 down

TenGigabitEthernet1/31 unassigned     YES unset up                   up

TenGigabitEthernet1/32 unassigned     YES unset up                   up

Vlan1                 unassigned     YES unset up                   up

Above we can see the interface as well as vlan along with the status. If we want to check the status of one particular interface then we can use the below-given command 

TEST#show ip interface FastEthernet1 (where FastEthernet is nothing but my interface)

FastEthernet1 is up, line protocol is up

 Internet protocol processing disabled. 

WE CAN SEE THAT THE INTERNET PROTOCOL IS DISABLE, BECAUSE WE HAVE NOT to ASSIGN ANY IP ADDRESS TO THE INTERFACE TILL NOW.

TEST#show running-config interface fastEthernet1

Building configuration...

 Current configuration : 95 bytes

!

interface FastEthernet1

 vrf forwarding mgmtVrf

 no ip address

 speed auto

 duplex auto

End

Now I would like to see whether the interface fastEthernet1 is Layer 2 or Layer 3.

 TEST#show interfaces fastEthernet1 switchport

% Fa1 is not a switchable port

 From the above output, we can see that it is showing "% Fa1 is not a switchable port", it means no switch port. Now let's understand the difference between the switch port and no switchport.

"no switchport" enabled L3 features on the port, you can give it an IP address, perform ip routing etc, which is usually seen on a Layer 3 switch."no switchport" changes the port from being a Layer 2 interface to a layer 3 interface. So a port with "no switchport" is not a member of any vlan, it is as you say a routed port and you can then configure an IP address on it.It changes the port from being a Layer 2 interface to a layer 3 interface.


On the other hand, The switch port is used to set port operation mode for VLAN access or trunking mode. A switch port can be in one of two modes: access and trunk. 

Let's assign the IP address on the inteface fastEthernet1, we have already verified above that this is a layer3 interface.

TEST(config)#interface fastEthernet1

TEST(config-if)#ip address 10.197.218.244 255.255.255.248

I am assigning the IP address along with the subnet mask.

TEST(config-if)#no shutdown (to make the interface up)

TEST(config-if)#do wr mem (saving the config)

Building configuration...

Compressed configuration from 2205 bytes to 1098 bytes[OK]

Now let's verify the interface fastEthernet1 which we have configured just now.

TEST#show ip interface fastEthernet1

FastEthernet1 is up, line protocol is up

 Internet address is 10.197.218.244/29

 Broadcast address is 255.255.255.255

 Address determined by setup command

 MTU is 1500 bytes

 Helper address is not set

 Directed broadcast forwarding is disabled

 Outgoing access list is not set

 Inbound access list is not set

 Proxy ARP is enabled

 Local Proxy ARP is disabled

 Security level is default

 Split horizon is enabled

 ICMP redirects are always sent

 ICMP unreachables are always sent

 ICMP mask replies are never sent

 IP fast switching is enabled

 IP Flow switching is disabled

 IP CEF switching is enabled

 IP CEF switching turbo vector

 IP Null turbo vector

 VPN Routing/Forwarding "mgmtVrf"

 IP multicast fast switching is enabled

 IP multicast distributed fast switching is disabled

 IP route-cache flags are Fast, CEF

 Router Discovery is disabled

 IP output packet accounting is disabled

 IP access violation accounting is disabled

 TCP/IP header compression is disabled

 RTP/IP header compression is disabled

 Probe proxy name replies are disabled

 Policy routing is disabled

 Network address translation is disabled

 BGP Policy Mapping is disabled

 Input features: MCI Check

 IPv4 WCCP Redirect outbound is disabled

 IPv4 WCCP Redirect inbound is disabled

 IPv4 WCCP Redirect exclude is disabled

Now let's check the other interface TenGigabitEthernet1

 TEST#show interfaces TenGigabitEthernet1/31 switchport

Name: Te1/31

Switchport: Enabled

We can see that the switch port is enabled that means this is a layer 2 interface, let's try to assign an IP address to this and see what will be the outcome for it

TEST(config-if)#interface TenGigabitEthernet1/31

TEST(config-if)#ip address ?

% Unrecognized command

We can see from the above output it is showing " % Unrecognized command", beacuse it is layer 2 interface and we can not assign the IP address to it. If you want to assign the IP address to it, then follow the below command:

GO into the config mode, then in the interface :

TEST(config)#interface TenGigabitEthernet1/31

TEST(config-if)#no switchport (I am using this command "no switchport" to convert the interface from layer 2 to layer 3)

TEST(config-if)#ip add

TEST(config-if)#ip address 10.1.1.10 255.255.255.0

TEST(config-if)#do wr mem

Building configuration...

Compressed configuration from 2256 bytes to 1125 bytes[OK]

Now we can see from the above output that after converting the interface into the layer 3 interface we are able to assign the IP address.

In my next article, I would be talking about the other basic command related to the switch.

Happy Weekend!!!!!

Moh'd Khamis

Facilitating excellence| Lifelong learner| Technology enthusiast

1 年

Thank you for sharing, very informative! Priyanka Shyam

回复

要查看或添加评论,请登录

Priyanka Shyam的更多文章

  • Designing a Data Center

    Designing a Data Center

    Happy Friday!! I have seen people asking quite a few times about designing a data center from scratch in interviews, in…

  • Distribute-list and Redistribute in Routing

    Distribute-list and Redistribute in Routing

    Happy Monday!! In the realm of networking and routing, understanding the nuances of commands like distribute-list and…

    2 条评论
  • Routing Table Codes

    Routing Table Codes

    Happy Friday!! Understanding routing table codes is crucial for network engineers to efficiently manage and…

    4 条评论
  • Implicit and Explicit Denial Rule in Firewall

    Implicit and Explicit Denial Rule in Firewall

    Happy Tuesday!! The purpose of this article is to discuss implicit denial and explicit denial within a firewall, and…

  • Spine and Leaf data center design.

    Spine and Leaf data center design.

    The topic of today's post is spine and leaf data center design. I would like to highlight a bit about east-west and…

  • All About Multicast IP Range

    All About Multicast IP Range

    Happy Tuesday!! In this post, we will discuss IP addressing for multicast applications. Multicast applications use an…

    1 条评论
  • ASDM "this app won't run on your computer" - Windows 10

    ASDM "this app won't run on your computer" - Windows 10

    Happy Friday!! As we all know, Cisco Adaptive Security Device Manager (ASDM) is software that enables users to manage…

    3 条评论
  • How Do Internet Bandwidth And Speed Differ?

    How Do Internet Bandwidth And Speed Differ?

    People often confuse bandwidth with speed. Some people believe that there is no difference between internet speed and…

    14 条评论
  • How does HTTP Tunneling work?

    How does HTTP Tunneling work?

    We all know that http method includes GET,POST,PUT,CONNECT,OPTIONS,TRACE,DELETE. We have already discussed the…

    2 条评论
  • A guide to creating self-signed certificates

    A guide to creating self-signed certificates

    During the SD-WAN implementation in my lab, I had to create the Root CA, generate CSRs, and generate self-signed…

    3 条评论

社区洞察

其他会员也浏览了