02-15-2020 11:46 AM - edited 02-15-2020 11:47 AM
okey so im a bit of an noob with these still so after too many attempts i figured ill come here and ask.
So i have catalyst 3560X and i want it to give me static IP addresses to VLAN20.
At the moment the switch is factory resetted.
02-15-2020 11:57 AM
Hello,
with static IP addresses you mean DHCP reservations ?
Have a look at the example below. You either use the hardware (MAC) address, or the client identifier (which is the MAC address prepended by the Ethernet type, 01:
ip dhcp excluded-address 192.168.10.1 192.168.10.10
!
ip dhcp pool LAN
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
dns-server 8.8.8.8 4.4.4.2
!
ip dhcp pool HOST_192_168_10_2
host 192.168.10.2 255.255.255.0
client-identifier 0100.03b1.0232.c2
or
ip dhcp pool HOST_192_168_10_2
host 192.168.10.2 255.255.255.0
hardware-address 0003.b102.32c2
02-15-2020 12:25 PM
yeah sorry i mixed what i was thinking and typing. so yeah i want it so my ip will be like 192.168.20.x between 10 and 245 (ex.192.168.20.15) on the devices i plug into the switch.
02-15-2020 12:35 PM
as @Georg Pauwen mentioned you can use same way as suggested.
ip dhcp excluded-address 192.168.20.1 192.168.20.10 ( this excludes from 1 to 10)
!
ip dhcp pool LAN
network 192.168.20.0 255.255.255.0
default-router 192.168.20.1 <<- change this IP depends on Gateway
dns-server 8.8.8.8 4.4.4.2 <- some ISP need to mention their ISP DNS here if the requirement
02-15-2020 02:43 PM
Okey so ill do it like this?
ip dhcp excluded-address 192.168.20.1 192.168.20.254
ip dhcp pool LAN
network 192.168.20.0 255.255.255.0
do i have to type anything else to the console? since im beginner with these switches
02-15-2020 03:07 PM
There are at least 2 things to discuss in what you are suggesting:
1) you suggest excluding addresses like this
ip dhcp excluded-address 192.168.20.1 192.168.20.254
But this excludes all the addresses in the subnet and there would be no addresses left for your devices. Remember that excluded addresses are addresses that can not be used by DHCP. You typically want to exclude the address of your router(s) and switch(es) and perhaps addresses of some servers or other type of device that should have static IP. But you need to leave some addresses available for dynamic assignment by DHCP.
2) In addition to configuring the network you need to configure the default router address (which is typically the address of the router/switch in this subnet.
02-16-2020 12:57 AM
oh okey so misunderstood that.
so i want to do this?
ip dhcp excluded-address 192.168.20.1 192.168.20.10 ( this excludes from 1 to 10)
!
ip dhcp pool LAN
network 192.168.20.0 255.255.255.0
what does this do?
what else do i want to do since i dont really have any idea.
Can i even do it like i wanted?
can i set the catalyst switch so i will only get ip.s between 192.168.20.11 - 192.168.20.254
02-16-2020 05:00 AM
You should be able to achieve that. You need to add something like this to your DHCP pool configuration
default-router 192.168.20.1
02-16-2020 06:29 AM
okey so just to be sure that i dont f*ck anything up i guess ill get one of my friends to configure my switch since im still bit lost with everything i have to do and what order so i wont miss anything and just broke the whole internet
02-16-2020 02:04 PM
Sometimes it can be helpful to have a friend work with you on the configuration, especially if they explain as they configure. Looking at the positive side of things, there is very little that you can do in configuring the switch that does real damage to the switch. There are a few serious things you might do (such as attempting to do a code upgrade in which you delete the existing image (without saving a copy) and loading an image file which is not appropriate for that hardware) but these are not likely. Almost any mistake you make in configuration can be corrected by doing a power cycle of the switch. The power cycle eliminates all the config changes you have made and puts you back at square one.
In one of your posts you ask what the various commands are doing. So here is an explanation:
- ip dhcp excluded-address defines addresses which will not be assigned dynamically by DHCP. The excluded addresses are configured manually on devices such as your switch, or your router, or some server (or other devices) which need static addresses. Any address in the DHCP pool that is not excluded can be assigned dynamically to a host on that segment of the network.
- ip dhcp pool LAN creates a pool for use in DHCP and gives it a name which is useful if you want to create more than one pool. With unique names you can have separate pools. The pool will have the addresses that are assigned by DHCP.
- network 192.168.20.0 255.255.255.0 defines the network addresses to be used in this pool. It also defines the mask to be used for this network. In assigning an address to a client DHCP tells the client what IP address to use and what mask to use.
- default-router defines what is the default gateway for clients in this segment. In assigning an address to a client DHCP also tells the client what is its default gateway. This is typically the router or layer 3 switch that is doing the layer 3 routing for this segment of the network.
These are three commands that are essential in configuring DHCP. You must create and name the pool, you must identify the network for the pool, and you must identify the default router. There are other commands that can be used. But with those three commands you can have working DHCP.
02-15-2020 01:10 PM
Hello,
so the config would look like below. You need one pool per host.
ip dhcp excluded-address 192.168.20.10 192.168.20.245
!
ip dhcp pool LAN
network 192.168.20.0 255.255.255.0
default-router 192.168.20.x
dns-server 8.8.8.8 4.4.4.2
!
ip dhcp pool HOST_192_168_20_15
host 192.168.10.2 255.255.255.0
client-identifier 0100.03b1.0232.c2
or
ip dhcp pool HOST_192_168_20_15
host 192.168.10.2 255.255.255.0
hardware-address 0003.b102.32c2
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