cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1849
Views
0
Helpful
2
Replies

Will switch / router port do DHCP broadcast by default?

CSCO12099251
Level 1
Level 1

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.

2 Replies 2

Mark Malone
VIP Alumni
VIP Alumni

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

DHCP Client Default Behavior

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.

Before You Begin

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.

SUMMARY STEPS

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

Image result for dhcp order

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 ?