Skip to main content

Help with IP addresses on switches

More
13 years 1 week ago #36736 by Dingo_Tush
Hi,

New to the site, first post.

I am trying to study and learn Cisco networking using the Cisco Packet Tracer program. So I made a diagram consisting of switches, servers and desktops. I want the servers to issue IP addresses through DHCP. How do I get the switch to get an IP address? I thought I'd be able to view the ports on the switch and see some IP addresses and their corresponding MAC addresses, but I can't get the switch to get an IP address. I really don't know how to do that anyway as I am trying to learn networking.

Also, what is the gateway? Is that the address of the switch? Like if I set an IP range of 192.168.7.xxx for the pc's and servers, the gateway would be 192.168.7.1, but is that the address of the switch or something else.

Please forgive me if this is the wrong forum, and any and all help will be very much appreciated. Thank you.

A young boy puts a feather into his mouth...
More
13 years 1 week ago #36737 by Arani
Replied by Arani on topic Concepts
Hi there, welcome to Firewall.

Firstly no you are not in the wrong forum. I will try to answer in the order of your queries.

1) A switch does not have an IP address. However you can set up an IP address for the switch for managing it. The switch does not need an IP address because it does not use an IP address to send a packet to it's destination. It uses the mac address. This is because a switch is a layer two i.e. Datalink level device.

2) A gateway is a default address through which a packet has to pass through to get into a network, or go out of that network. As the name suggests, it is the gateway to another network. It's like the front door of your house. If you have to go outside the house, you will need to use it. If you are only going to walk from one room to the other then you don't need the front door, you only use the doors of the room you are going out of, and the door of the room you are going into.
Following the above analogy, a gateway will be an address (normally the main router in a network) through which a packet from within the network, will need to pass through to reach another network. For a packet coming from another network, it will have to pass through this gateway to reach anywhere within the network.

Now, this gateway can't be the switch, because as I explained on section 1, switches don't have IP addresses. So this gateway will be the router in your network. And yes, if you want your router can have the x.x.x.1 address, as 9 times out of 10, routers have that address, and we setup the default gateway of a device as x.x.x.1.

Why don't you post a diagram of your network over here. We would love to see your creation!!!

Picking pebbles on the shore of the networking ocean
More
13 years 1 week ago #36739 by Dingo_Tush
Replied by Dingo_Tush on topic Re: Concepts

Hi there, welcome to Firewall.

Firstly no you are not in the wrong forum. I will try to answer in the order of your queries.

1) A switch does not have an IP address. However you can set up an IP address for the switch for managing it. The switch does not need an IP address because it does not use an IP address to send a packet to it's destination. It uses the mac address. This is because a switch is a layer two i.e. Datalink level device.

2) A gateway is a default address through which a packet has to pass through to get into a network, or go out of that network. As the name suggests, it is the gateway to another network. It's like the front door of your house. If you have to go outside the house, you will need to use it. If you are only going to walk from one room to the other then you don't need the front door, you only use the doors of the room you are going out of, and the door of the room you are going into.
Following the above analogy, a gateway will be an address (normally the main router in a network) through which a packet from within the network, will need to pass through to reach another network. For a packet coming from another network, it will have to pass through this gateway to reach anywhere within the network.

Now, this gateway can't be the switch, because as I explained on section 1, switches don't have IP addresses. So this gateway will be the router in your network. And yes, if you want your router can have the x.x.x.1 address, as 9 times out of 10, routers have that address, and we setup the default gateway of a device as x.x.x.1.

Why don't you post a diagram of your network over here. We would love to see your creation!!!



Thanks Arani, I think I get it, or at least I am a little closer to understanding. I have a few more questions about your responses...

I get what you are saying about switches not needing an IP address, but 99% of the time switches do have an IP address for troublshooting and remote management right? If that is the case, then is that entered in the CLI on the switch? Some command that sets its' IP address?

Nice analogy about the front door, that makes alot of sense, but is the gateway a device? Is it a piece of hardware? I don't think so, since I have never configed one. So if it isn't a piece of hardware how does it work? Like if my network is 192.168.7.xxx, why is the gateway 192.168.7.1? I am having a hard time asking what I am asking. Like, what is 192.168.7.1? If it isn't hardware then what controls it and how does the network know to go to 192.168.7.1 when it wants to go out the front door?

I have the network diagram at my home pc, so I will post it later. But I don't have a router on it, just some switches. Do I need a router if I only want to connect local devices? And can't a Layer 3 switch do routing, just the same way as a router? This is where my skill level kind of drops off the face of the Earth....but I'm learning!

A young boy puts a feather into his mouth...
More
13 years 1 week ago #36740 by Bublitz
Managed switches have ip's and unmanaged don't as arani mentioned. Also switches that can do vlans and ip routing also have ips.

So lets say a layer 3 switch has 3 vlans configured. It will have 3 ips address one for each vlan.

Switches can be gateways IF they are routing traffic. Here is an example.

PC -> Switch(routing traffic)->Firewall->router->InternetS!

So in the example above the PCs are using the switch as a gateway for internal traffic. Then the switch uses the firewall as the gateway and will route any external traffic OUT. This is very common these days with vlans.

Infact we use switches as gateways here for our servers and PCs. We even have VRRP configured so if one switch fails the other switch will take over routing for those pc/servers.

Most cisco switches have an ip. You configure this ip by configuring the default/native vlan which is usually vlan 1.

So usually in config mode you type like "int vlan 1"
Then the command "ip adress x.x.x.x mask x.x.x.x"

The Bublitz
Systems Admin
Hospice of the Red River Valley
More
13 years 1 week ago #36743 by Arani
Replied by Arani on topic Routers
Hi,

As I mentioned before, a switch only has an IP address for management purposes. It has no operational use of it. All it needs are the MAC addresses for it's functioning.

Now about a gateway. Essentially a gateway is a device, preferably a router. If you remember whenever you set up a pc or a device to be part of a network, you add an IP address unless you want this to be done by DHCP. Then comes the subnet mask and followed by that is the default gateway.

If a device wants to communicate with another device within the same network, then it won't need the default gateway. If a device wants to communicate with another device which is outside it's own network, that's when a gateway comes into action. The packet from this device is now sent to the default gateway which will route it to the outside network.

Let's get back to our front door analogy. If you want to go to a different room, then you don't need the front door. But if you want to go to your neighbour's house, you will have to go through your front door, cross the street and get into your neighbour's house through his/her front door. So, in this scenario, both your front and your neighbour's front doors act as gateways. You are the packet, your friend's house is the destination, and the street your crossed is the external network.

Now about the IP address of the gateway, there is no hard and fast rule of what it should be. Traditionally it has been the first address of a network. So in this case, it's a 192.168.x.1. But nothing is stopping you from setting anything else, as long as you don't set that same address to another device on the same network. Personally speaking, my own home network's default gateway is 192.168.1.254, the last IP address you can assign to anything. So, in real world, nothing stops you from assigning 192.168.x.254, or 253, or anything else. Once just for fun I assigned 192.168.1.128 as the default gateway.!!!

But what you need to remember is that, this gateway address will be your portal to any external network, for any devices within your own network.

Look at this example. I have a BT home hub as my router which has a BT network address of 86.52.x.x via an ADSL Link. Then it manages my home network which is a 192.168.1.x network. My desktop, and laptop take up x.x.x.5 and 6. My Xbox takes up 7, and my BT Vision box takes up 8. My Iphone takes up 9. When each of these devices needs to talk with one another my BT Home hub sends the packets straight to the other device. But when any of them wants to connect to the internet, then the Home Hub sends the packets out to the 86.52.x.x network using it's ADSL line.

Let me know if this makes any sense. Or else we'll try a different approach.

Cheers

Picking pebbles on the shore of the networking ocean
More
13 years 1 week ago #36747 by Dingo_Tush
Replied by Dingo_Tush on topic Re: Routers

Hi,

As I mentioned before, a switch only has an IP address for management purposes. It has no operational use of it. All it needs are the MAC addresses for it's functioning.

Now about a gateway. Essentially a gateway is a device, preferably a router. If you remember whenever you set up a pc or a device to be part of a network, you add an IP address unless you want this to be done by DHCP. Then comes the subnet mask and followed by that is the default gateway.

If a device wants to communicate with another device within the same network, then it won't need the default gateway. If a device wants to communicate with another device which is outside it's own network, that's when a gateway comes into action. The packet from this device is now sent to the default gateway which will route it to the outside network.

Let's get back to our front door analogy. If you want to go to a different room, then you don't need the front door. But if you want to go to your neighbour's house, you will have to go through your front door, cross the street and get into your neighbour's house through his/her front door. So, in this scenario, both your front and your neighbour's front doors act as gateways. You are the packet, your friend's house is the destination, and the street your crossed is the external network.

Now about the IP address of the gateway, there is no hard and fast rule of what it should be. Traditionally it has been the first address of a network. So in this case, it's a 192.168.x.1. But nothing is stopping you from setting anything else, as long as you don't set that same address to another device on the same network. Personally speaking, my own home network's default gateway is 192.168.1.254, the last IP address you can assign to anything. So, in real world, nothing stops you from assigning 192.168.x.254, or 253, or anything else. Once just for fun I assigned 192.168.1.128 as the default gateway.!!!

But what you need to remember is that, this gateway address will be your portal to any external network, for any devices within your own network.

Look at this example. I have a BT home hub as my router which has a BT network address of 86.52.x.x via an ADSL Link. Then it manages my home network which is a 192.168.1.x network. My desktop, and laptop take up x.x.x.5 and 6. My Xbox takes up 7, and my BT Vision box takes up 8. My Iphone takes up 9. When each of these devices needs to talk with one another my BT Home hub sends the packets straight to the other device. But when any of them wants to connect to the internet, then the Home Hub sends the packets out to the 86.52.x.x network using it's ADSL line.

Let me know if this makes any sense. Or else we'll try a different approach.

Cheers


Wow! Thanks for all the info! So about the gateway, it is a switch or a router right? Cause it routes packets. I would assign the gateway to the switch/router by giving the device an address of whatever (192.168.7.1). Then I would tell DHCP that 192.168.7.1 is the gateway so that would enable all the clients to route outside the network when they need to. I think I got it, is that right?

A young boy puts a feather into his mouth...
Time to create page: 0.149 seconds