Switch – How do devices connected to a switch get their IPs

dhcpipv4switch

It should go without saying, I'm new and still learning about networking. One of the things I'm not clear on and couldn't find a satisfying answer to, although I've done some digging around, is how devices that are connected to a switch get their IP address and what kind of IP address they are?

What I mean is, from what I've found, switches don't operate at the IP address level, but the MAC Address level.


So the question is:

  1. How do the devices connected to a particular switch get their IP? Who hands it out to them? Do you have to assign it manually or does (I assume) the router hand it out automatically?

  2. Do switches automatically create a sub-net? That is, if I have two switches connected to my router, will the devices connected to those 2 switches be on 2 different subnets? If so, is that the default, or do I have to set it up, and can I change that (ie, make it so that they're actually on the same subnet)?

I know it's more questions than one, but they're all in the bracket of how a switch-connected device is assigned an IP. I'd appreciate it if you could maybe throw some light on this.

Best Answer

First when the device boots up, it will try to look for a DHCP server. It will send a broadcast traffic ("Who is the DHCP server?") and the corresponding DHCP server will respond to the request, in your case the Router is your DHCP server.

If no DHCP server in the network, the host for example windows, will automatically assign a unique class B ip address 169.254.0.0 to 169.254.255.255 (APIPA).