Options

can a switch be a dhcp client?

clarsonclarson Member Posts: 903 ■■■■□□□□□□
Can a switch get its ip address and etc. from a dhcp server?
A router can obtain an ip address from a dhcp for an interface using ip address dhcp
But, when I tried that on 2950 switch it didn't work.

Comments

  • Options
    azaghulazaghul Member Posts: 569 ■■■■□□□□□□
    For a L2 only switch, about the only place you could put it is under interface vlan.
    interface vlan 1
     ip address dhcp
    

    For a L3 switch, either under interface vlan, or a physical interface after converting it to routed mode.
    interface fast 1/0/1
     no switchport
     ip address dhcp
    

    But this general rule can also change depending on the hardware platform used, not all Cisco switches are created equal...icon_lol.gif
  • Options
    clarsonclarson Member Posts: 903 ■■■■□□□□□□
    I thought that is how it would work also. I guess just not on a 2950.

    S1(config)#inter vlan 1
    S1(config-if)#ip address dh
    S1(config-if)#ip address dh?
    % Unrecognized command
    S1(config-if)#ip address d?
    % Unrecognized command
    S1(config-if)#ip address dh?
    % Unrecognized command
    S1(config-if)#ip address dhc?
    % Unrecognized command
    S1(config-if)#ip address dhcp
    ^
    % Invalid input detected at '^' marker.
  • Options
    IristheangelIristheangel Mod Posts: 4,133 Mod
    The 2950 is a pretty old switch - it might not be available on either the version of code you are running or the switch. I've gotten it to work on the 2960 model though.
    BS, MS, and CCIE #50931
    Blog: www.network-node.com
  • Options
    bigdogzbigdogz Member Posts: 881 ■■■■■■■■□□
    Yeah it can work....

    I had to do it in a pinch some time ago. You may want to check the code running on the switch.
  • Options
    clarsonclarson Member Posts: 903 ■■■■□□□□□□
    well it is:
    C2950 Software (C2950-I6K2L2Q4-M), Version 12.1(22)EA14,
    which is pretty good for a 2950
Sign In or Register to comment.