Skip navigation
Login   |   Register
Cisco Learning Home > CCNP R&S Study Group > Discussions
211204 Views 11 Replies Latest reply: Apr 23, 2014 4:36 AM by Isaac RSS

Currently Being Moderated

how to assign static IP on a switch

Jan 20, 2015 11:38 AM

rishi 100 posts since
Jan 17, 2010
Powerful, on-demand CCNA and CCNP Resources:
Cisco Learning Network Premium

 

hi

 

can nebdy tell d the commands to assign static IP on a switch

 

guess we do use Mac address here

 

Keith

 

a request plzz create a video on this

 

or if its already created

 

share the link

 

regards

 

Rishi

  • Joseph Nelson 119 posts since
    Sep 23, 2009
    Currently Being Moderated
    1. Jun 17, 2010 11:55 PM (in response to rishi)
    Re: how to assign static IP on a switch

    Hi Rishi,

     

    As you may know there are layer 2 and layer 3 switches. A layer 2 switch only does layer 2 fowarding, as such it doesn't have any additional ip interfaces. On a layer 2 switch the ip address is instead assigned to the vlan interface:

     

    config t

    interface vlan 1

    ip address 192.168.1.1 255.255.255.0

     

    * Note on a L2 switch you can assign an ip to any vlan you want (vlan 1, vlan 2, vlan 4000). You can only assign an ip address to one vlan at a time on a l2 switch. If you configured an ip on a vlan and then try to assign an ip to another vlan...the switch will shut down the first vlan and bring up the second vlan interface)*

     

    On a L3 switch you can have multiple ip interfances. Unlike a L2 switch, an L3 switch can have static ip addresses on multiple vlan interfaces (configuration is the same as the above example). In addtion unlike L2 swithes a L3 switch can have a static ip address assigned to any one of its fastethernet (fa0/1) or gig ethernet ports (gi0/1).

     

    Config t

    int fa0/1

    ip address 192.168.1.1 255.255.255.0

    description *** Assigning an ip address to a physical fast ethernet port on the switch***

     

    int vlan 1

    ip address 192.168.2.1 255.255.255.0

    description *** Assigning an ip address to the virtual (vlan) interface on the switch ***

     

    int vlan 2

    ip address 192.168.3.1 255.255.255.0

    description *** Assigning an ip address to another virtual (vlan) interface on the switch ***

     

    Note that although you can assign multiple ip addresses on a L3 switche's physical (e.g. fa0/1 fa0/2 gi0/1) or virtual (vlan 1, vlan 3, vlan 3000, or a loopback lo1, lo2,lo3), all of the ip address must be in different networks. If subnetting is used, the interfaces belonging to the same switch must have a different subnet mask.

     

    Example

     

    int fa0/1

    ip address 192.168.1.1 255.255.255.252

    description *** This interface is on the 192.168.1.0/30 network ***

     

    int fa0/2

    ip address 192.168.1.5 255.255.255.252

    description *** This interface is on the 192.168.1.4/30 network***

     

    int vlan 1

    ip address 192.168.9 255.255.255.252

    description *** This interface is on the 192.168.1.8/30 network ***

     

    HTH

     

    Joe

    Join this discussion now: Login / Register
  • Angela 746 posts since
    Jan 29, 2010
    Currently Being Moderated
    2. Jun 18, 2010 12:54 AM (in response to rishi)
    Re: how to assign static IP on a switch

      Basically, to assign a static IP address, use 'ip address', you can do this for a VLAN in a L2 or L3 switches. In MLS, you can convert a port to L3 port using 'no switchport' then configure an IP address on that physical port.

     

      On the other hand, if you are talking about static route, you can only configure it on L3 switches as L2 switches can't route.

     

     

    Regards

    Join this discussion now: Login / Register
  • Joseph Nelson 119 posts since
    Sep 23, 2009
    Currently Being Moderated
    3. Jun 18, 2010 12:57 AM (in response to Angela)
    Re: how to assign static IP on a switch

    Ahhhh Angela,

     

    Thanks for pointing that out....before you can assign an ip to a port, you must disable switching on the port with the "no switchport" sub interface command.

     

    Thanks again, it was an oversight on my part.

     

    Joe

    Join this discussion now: Login / Register
  • Angela 746 posts since
    Jan 29, 2010
    Currently Being Moderated
    4. Jun 18, 2010 1:16 AM (in response to Joseph Nelson)
    Re: how to assign static IP on a switch

    You are very welcome, I also have many times when others pointed out something I did think of. It's great to study with everybody, happy learner

     

    Regards

    Join this discussion now: Login / Register
  • Rahul 15 posts since
    Feb 22, 2011
  • cadetalain 2,728 posts since
    Sep 18, 2008
    Currently Being Moderated
    6. Aug 27, 2012 1:26 AM (in response to rishi)
    Re: how to assign static IP on a switch

    Hi,

     

    if you want to create an IP address for management then just simply use a SVI:

    eg

    int vlan 1

    ip address 192.168.1.1 255.255.255.0

     

    Regards.

     

    Alain

    Join this discussion now: Login / Register
  • Rahul 15 posts since
    Feb 22, 2011
    Currently Being Moderated
    7. Aug 27, 2012 7:40 AM (in response to cadetalain)
    Re: how to assign static IP on a switch

    yeah well if he wanna create a management VLAN then its the way,,

    His question was doubtfull so i gave him the way to create routed port on Layer 3

    Join this discussion now: Login / Register
  • cadetalain 2,728 posts since
    Sep 18, 2008
    Currently Being Moderated
    8. Aug 27, 2012 8:45 AM (in response to Rahul)
    Re: how to assign static IP on a switch

    Hi,

     

    yes indeed the question was ambiguous .

     

    Regards.

     

    Alain

    Join this discussion now: Login / Register
  • Joshua Johnson - CCNP R&S 6,067 posts since
    Sep 22, 2009
    Currently Being Moderated
    9. Aug 27, 2012 8:51 AM (in response to Angela)
    Re: how to assign static IP on a switch

    Yeah you may want to say SVI or VLAN interface for the newer people even though we know what you are talking about, Angela

     

    Angela wrote:

     

      Basically, to assign a static IP address, use 'ip address', you can do this for a VLAN in a L2 or L3 switches. In MLS, you can convert a port to L3 port using 'no switchport' then configure an IP address on that physical port.

     

      On the other hand, if you are talking about static route, you can only configure it on L3 switches as L2 switches can't route.

     

     

    Regards

    Join this discussion now: Login / Register
  • Ashish 5 posts since
    Mar 7, 2014
    Currently Being Moderated
    10. Apr 23, 2014 4:29 AM (in response to rishi)
    Re: how to assign static IP on a switch

    Hi

    For assigning  Static ip to a Switch,

    Assign IP to VLAN 1 by command

     

    Switch>enable

    Switch#conf ter

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

    Switch(config)#interfac

    Switch(config)#interface vlan 1

    Switch(config-if)#ip address 192.168.1.1 255.255.255.0

    Switch(config-if)#no shut

     

     

    Switch(config-if)#

    %LINK-5-CHANGED: Interface Vlan1, changed state to up

     

     

    Switch(config-if)#^Z

    Switch#

    %SYS-5-CONFIG_I: Configured from console by console

     

     

    Switch#

    Join this discussion now: Login / Register
  • Isaac 125 posts since
    Dec 20, 2010
    Currently Being Moderated
    11. Apr 23, 2014 4:36 AM (in response to rishi)
    Re: how to assign static IP on a switch

    Hello Rishi

     

    I just would like to add my to cents..

     

    Using vlan 1 is never a good idea. Just create a vlan for managemnt of your network devices - specially if you are talking about a production network.

     

    Best regards

     

    Isaac

    Join this discussion now: Login / Register

Actions

More Like This

  • Retrieving data ...

Bookmarked By (2)