08-03-2017 10:44 PM - edited 03-08-2019 11:36 AM
Hi All,
I need help to clarify a doubt. I have searched for any document but couldn't find any.
If I connect a switch with no config to a vlan having DHCP server, will the connected switchport by default send any DHCP broadcast automatically and get an IP address?
Thanks.
08-04-2017 12:27 AM
Hi
switchport wouldn't be like a pc I think you would need to have something like ip address dhcp enabled on the interface so it knows to participate
and see in the doc it says it needs command too for the interface
Cisco routers running Cisco IOS software include DHCP server and relay agent software, which are enabled by default. Your router can act as both the DHCP client and DHCP server. Use the ip address dhcp command to obtain IP address information for the configured interface.
You must configure the ip dhcp client commands before entering the ip address dhcp command on an interface to ensure that the DHCPDISCOVER messages that are generated contain the correct option values. The ip dhcp client commands are checked only when an IP address is acquired from DHCP. If any of the ip dhcp client commands are entered after an IP address has been acquired from DHCP, it will not take effect until the next time the router acquires an IP address from DHCP. This means that the new configuration will take effect only after either the ip address dhcp command or the release dhcp and renew dhcpEXECcommandshave been configured.
1. enable
2. configure terminal
3. interface type number
4. ip dhcp client client-id {interface-name| ascii string| hex string}
5. ip dhcp client class-id {string| hex string}
6. ip dhcp client lease days [hours][minutes]
7. ip dhcp client hostname host-name
8. [no] ip dhcp client request option-name
9. ip address dhcp
08-04-2017 12:32 AM
Hello,
it depends. A switchport by default will be in VLAN 1, if the DHCP server is in that same VLAN, the DHCP broadcasts will reach the server, and the swichports will get an IP address. If the server is in another VLAN, you need to configure an 'ip helper-address' on the SVI, pointing to that server.
So, in the case below, since both switchports by default are in the same VLAN (1), the client PC would get the address:
interface FastEthernet0/0
description Client PC
!
interface FastEthernet0/1
description DHCP Server
In the case below, if your DHCP server is in Vlan 2 (with IP address 192.168.2.100), the config would need to be like this:
interface FastEthernet0/0
description Client PC
!
interface FastEthernet0/1
switchport access vlan 2
description DHCP Server
!
interface Vlan2
ip address 192.168.2.1 255.255.255.0
ip helper-address 192.168.2.100
Does that make sense ?
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide