05-24-2017 02:55 AM - edited 03-05-2019 08:35 AM
Hello,
With regards to the below config, the int fa0/2 is assigned to interface vlan 2 (191.168.2.1). So if I plug in a computer into int fa0/2, will I get an IP assigned to my computer (in the range of 192.168.2.2 - 254) if my computer is set to obtain IP via DHCP? Or do i have to manually assign the IP myself on the computer? In my previous company this was done automatically which I'm not sure how.
.Define the VLANs
To create a VLAN named Desktop, run the following commands in privileged mode,
conf t
vlan 2
name Desktop
exit
2. Add the switch ports to previusly created VLANs
Exp: Fa0/2 to Desktop VLAN
conf t
int fa0/2
switchport mode access
switchport access vlan 2
exit
3.Create a Layer 3 (SVI) interface for eatch VLAN
conf t
interface vlan 2
ip address 192.168.2.1 255.255.255.0
no shutdown
exit
3. For Internet access, add a default route to the routing table
conf t
ip route 0.0.0.0 0.0.0.0 192.168.xx.xx
Solved! Go to Solution.
05-24-2017 11:25 AM
Assuming a separate physical server for DHCP it is the server that is responsible for assigning the IP, the switch merely forwards the requests and responses between the client and the server.
Only if the DHCP pool was on the switch would it be responsible for assigning the IPs.
Jon
05-24-2017 03:23 AM
It will get an IP automatically if you have a DHCP server.
If you do and it is on vlan 2 as well then you don't need to do anything assuming you have setup the pool for 192.168.2.0/24.
If you do but it is on a different vlan then under the SVI for vlan 2 you need to add "ip helper-address <address of DHCP server>".
If you don't have a DHCP server you can either setup the router to hand out IPs or you can just manually assign the IP.
Jon
05-24-2017 05:20 AM
To expand a bit on Jon's answer, most hosts can work with a statically defined IP or a DHCP provided IP. The host needs to be configured to use DHCP. Many, but not all, hosts default to using DHCP. When a host is configured to use DHCP, Jon describes the critical things that need to be configured for it to work.
PS:
Seeing:
3. For Internet access, add a default route to the routing table
conf t
ip route 0.0.0.0 0.0.0.0 192.168.xx.xx
If you're unfamiliar with setting up a DHCP environment, are you okay on all that's usually needed to provide internal hosts Internet access? Reason I ask, "professional" grade network equipment usually requires much more configuration effort than "consumer" grade network equipment, and there's much that can trip you up setting up Internet access.
05-24-2017 11:22 AM
Hi Jon,
If the DHCP server is on say vlan 100 and I issue the ip helper-address command on SVI for vlan 2, who is making the decision here to assign a 192.168.2.0/24 ip to my computer? The switch or the DHCP server?
05-24-2017 11:25 AM
Assuming a separate physical server for DHCP it is the server that is responsible for assigning the IP, the switch merely forwards the requests and responses between the client and the server.
Only if the DHCP pool was on the switch would it be responsible for assigning the IPs.
Jon
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