sub netting de diferentes maneras
TRANSCRIPT
http://www.trainsignaltraining.com/simplify-routing-how-to-organize-your-network-into-smaller-subnets/2007-11-08/
Subnetting a Class C Address Using the Binary Method
We will use a Class C address which takes 5 bits from the Host field for subnetting and leaves 3 bits for defining hosts as shown in figure 1 below. Having 5 bits available for defining subnets means that we can have up to 32 (2^5) different subnets.
It should be noted that in the past using subnet zero (00000—) and all-ones subnet (11111—) was not allowed. This is not true nowadays. Since Cisco IOS Software Release 12.0 the entire address space including all possible subnets is explicitly allowed.
Let’s use IP address 192.168.10.44 with subnet mask 255.255.255.248 or /29.
STEP 1: Convert to Binary
STEP 2: Calculate the Subnet Address
To calculate the Subnets IP Address you need to perform a bit-wise AND operation (1+1=1, 1+0 or 0+1 =0, 0+0=0) on the host IP address and subnet mask.
The result is the subnet address in which the host is situated.
Página 1 de 135
STEP 3: Find Host Range
We know already that for subnetting this Class C address we have borrowed 5 bits from the Host field. These 5 bits are used to identify the subnets. The remaining 3 bits are used for defining hosts within a particular subnet.
The Subnet address is identified by all 0 bits in the Host part of the address. The first host within the subnet is identified by all 0s and a 1. The last host is identified by all 1s and a 0. The broadcast address is the all 1s. Now, we move to the next subnet and the process is repeated the same way. The following diagram clearly illustrates this process:
STEP 4: Calculate the Total Number of Subnets and Hosts Per Subnet
Página 2 de 135
Knowing the number of Subnet and Host bits we can now calculate the total number of possible subnets and the total number of hosts per subnet. We assume in our calculations that all-zeros and all-ones subnets can be used. The following diagram illustrated the calculation steps.
Subnetting a Class C Address Using the Fast Way
Now let’s see how we can subnet the same Class C address using a faster method. Let’s again use the IP address 192.168.10.44 with subnet mask 255.255.255.248 (/29). The steps to perform this task are the following:
1. Total number of subnets: Using the subnet mask 255.255.255.248, number value 248 (11111000) indicates that 5 bits are used to identify the subnet. To find the total number of subnets available simply raise 2 to the power of 5 (2^5) and you will find that the result is 32 subnets.
Note that if subnet all-zeros is not used then we are left with 31 subnets and if also all-ones subnet is not used then we finally have 30 subnets.
2. Hosts per subnet: 3 bits are left to identify the host therefore the total number of hosts per subnet is 2 to the power of 3 minus 2 (1 address for subnet address and another one for the broadcast address)(2^3-2) which equals to 6 hosts per subnet.
3. Subnets, hosts and broadcast addresses per subnet: To find the valid subnets for this specific subnet mask you have to subtract 248 from the value 256 (256-248=8) which is the first available subnet address.
Actually the first available one is the subnet-zero which we explicitly note. Next subnet address is 8+8=16, next one is 16+8=24 and this goes on until we reach value 248. The following table provides all the calculated information.
Note that our IP address (192.168.10.44) lies in subnet 192.168.10.40.
Página 3 de 135
Test Your Subnetting Knowledge and Practice, Practice, Practice!
Don’t get discouraged if you didn’t understand every little detail I went over in this article. Subnetting is not really that difficult, but it does require a bit of practice.
Start with testing your knowledge of subnets and make sure you feel confident about this before you move on to designing your own subnets. But remember, if you’re on the Cisco Networking track you will have to deal with subnetting sooner or later, so grab this opportunity and start testing yourself.
Go ahead and subnet the network address 192.168.10.0 address using the subnet mask 255.255.255.192 (/26). Find the valid subnets, host ranges and broadcast addresses per subnet. If you want to double-check your answer, feel free to leave me a comment and I will provide you with the correct solution.
.
Página 4 de 135
Cool Subnetting Tricks with Variable Length Subnet Mask
A few months back, I showed you how to organize your network into smaller subnets. My post covered the details of the concept of subnetting.
So if you missed that article, I would suggest taking a look at it to make sure you understand VLSM and this article in its entirety.
For now, I will assume that you are already familiar with subnetting and know how to divide a network into smaller subnets.
In today’s article, we’ll subnet an already subnetted network into multiple subnets with variable subnet masks and then allocate them within our sample network.
Variable Length Subnet Mask (VLSM) is a key technology on large scalable networks. Mastering the concept of VLSM is not an easy task, but it’s well worth it. The importance of VLSM and its beneficial contribution to networking design is unquestionable.
At the end of this article you will be able to understand the benefits of VLSM and describe the process of calculating VLSMs. I will use a real world example to help you understand the whole process and its beneficial effects.
The Benefits of VLSM
VLSM provides the ability to subnet an already subnetted network address. The benefits that arise from this behavior include:
Efficient use of IP addresses: IP addresses are allocated according to the host space requirement of each subnet.
IP addresses are not wasted; for example, a Class C network of 192.168.10.0 and a mask of 255.255.255.224 (/27) allows you to have eight subnets, each with 32 IP addresses (30 of which could be assigned to devices). What if we had a few WAN links in our network (WAN links need only one IP address on each side, hence a total of two IP addresses per WAN link are needed).
Without VLSM that would be impossible. With VLSM we can subnet one of the subnets, 192.168.10.32, into smaller subnets with a mask of 255.255.255.252 (/30). This way we end up with eight subnets with only two available hosts each that we could use on the WAN links.
The /30 subnets created are: 192.168.10.32/30, 192.168.10.36/30, 192.168.10.40/30, 192.168.10.44/30, 192.168.10.48/30, 192.168.10.52/30, 192.168.10.56/30 192.168.10.60/30.
Support for better route summarization: VLSM supports hierarchical addressing design therefore, it can effectively support route aggregation, also called route summarization.
The latter can successfully reduce the number of routes in a routing table by representing a range of network subnets in a single summary address. For example subnets 192.168.10.0/24, 192.168.11.0/24 and 192.168.12.0/24 could all be summarized into 192.168.8.0/21.
Página 5 de 135
Address Waste Without VLSM
The following diagram shows a sample internetwork which uses a network C address 192.168.10.0 (/24) subnetted into 8 equal size subnets (32 available IP addresses each) to be allocated to the various portions of the network.
This specific network consists of 3 WAN links that are allocated a subnet address range each from the pool of available subnets. Obviously 30 IP address are wasted (28 host addresses) since they are never going to be used on the WAN links.
Implementing VLSM
In order to be able to implement VLSMs in a quick and efficient way, you need to understand and memorize the IP address blocks and available hosts for various subnet masks.
Create a small table with all of this information and use it to create your VLSM network. The following table shows the block sizes used for subnetting a Class C subnet.
Página 6 de 135
Having this table in front of you is very helpful. For example, if you have a subnet with 28 hosts then you can easily see from the table that you will need a block size of 32. For a subnet of 40 hosts you will need a block size of 64.
Example: Create a VLSM Network
Let us use the sample network provided above to implement VLSM. According to the number of hosts in each subnet, identify the addressing blocks required. You should end up with the following VLSM table for this Class C network 192.168.10.0/24.
Take a deep breath … we’re almost done. We have identified the necessary block sizes for our sample network.
The final step is to allocate the actual subnets to our design and construct our VLSM network. We will take into account that subnet-zero can be used in our network design, therefore the following solution will really allow us to save unnecessary addressing waste:
Página 7 de 135
With VLSM we have occupied 140 addresses. Nearly half of the address space of the Class C network is saved. The address space that remains unused is available for any future expansion.
Isn’t that amazing? We have reserved a great amount of addresses for future use. Our sample network diagram is finalized as shown on the following diagram:
Página 8 de 135
Final Thoughts
Variable Length Subnet Mask is an extremely important chapter in Network Design. Honestly, if you want to design and implement scalable and efficient networks, you should definitely learn how to design and implement VLSM.
It’s not that difficult once you understand the process of block sizes and the way to allocate them within your design. Don’t forget that VLSM relates directly to the subnetting process, therefore mastering the subnetting process is a prerequisite for effectively implementing VLSM.
And feel free to go through my subnetting articles a couple of times to get a hang of the whole process.
Página 9 de 135
IP Addressing and Routing Part 1: Invasion of IP Addresses
I wrote this article with the invasion of IP services in our daily life in mind. Think about it — the electronics you use every day: your computer, your TV, your home phone, your mobile phone — all possess an IP address. Our world would not be the same without the Internet Protocol.
But do you know what it is? Why it is needed? How it is structured? If you answered no to at least one of these questions, keep reading — all of this and more will be explained in this article.
And in my next article, Part 2 of this mini-series, I will go even further and explain the process of IP routing by showing you step-by-step what happens when two hosts need to communicate between each other. But first let’s take a look at what’s required before communication can occur — the IP address and the different IP network classes.
The IP Necessity
To get a clear understanding of why we need this thing called IP address, I’ll use an example from daily life. Imagine that you need to send some mail to Train Signal Inc. What you need is Train Signal’s country, street name, and number.
The IP address structure is similar to the mail system architecture. There is a specific part in the IP header that identifies the country part of the address. A separate field identifies the postal code and street name within the country and another one identifies the actual mail box and name of a particular host.
All these fields of course, have special names of their own in the “IP world.” The table below shows the analogy between IP addressing structure and mail system architecture:
Imagine if every router in the Internet had to know the IP addresses of every host around the world — this would be extremely inefficient. That is why the 2 or 3 level hierarchical addressing scheme is efficient, because each router along the path reads and matches only the hierarchical part of the IP address that it needs to know about.
Only the router closest to the destination host will need to match the whole network-subnet-host address and physically identify the host in a subnet (identify the street number). That is where the MAC address takes action. The latter has only local meaning, in the sense that it identifies hosts within a given subnet (street).
The combination of the virtual addressing scheme (IP address) and physical addressing scheme (MAC address) ensures reliable delivery of messages to their destination.
The IP Structure
An IP address consists of 4-bytes of data. A byte consists of 8 bits (a bit is a single digit and it could only be either a 1 or 0), therefore we have a total of 32 bits for each IP address. The IP address is presented in a dotted
Página 10 de 135
decimal formation, where each byte is seen as a separate section with a full-stop dividing each section. The same IP address can be represented using one of these three methods:
Binary: 11000000. 10101000. 00001010.00000010 Hexadecimal: C0.A8.0A.02 Decimal: 192.168.10.2
To simplify things, the decimal representation is usually used.
Network Addressing
Now that we’ve gone over the hierarchical addressing scheme, let’s take a look at the network and host parts and how a network class determines their location in the IP address field.
Class A Network
In a class A network the first byte of the address identifies the network part and the remaining three bytes identify the host part. The format is:
Class A network addresses are one byte long with the first bit of the byte being set permanently to zero. Therefore, the first Class A network that can be created is the 00000000 network. Actually this network cannot be used because it is reserved to designate the default route.
The last Class A network that can be defined is 01111111 (127 decimal). And guess what, this network cannot be used either because it’s reserved for testing purposes. Therefore, we are left with 126 (128-2) available networks.
The remaining three bytes can be used to identify hosts. The actual maximum number of usable hosts is 16777214. When you see an IP address that starts from 1 and goes up to 126, then you will know that it’s a Class A address.
Class B Network
In Class B networks, the first bit of the first byte must always be 1 and the second bit must always be 0. Therefore the range for a Class B network in binary notation is:
10000000 up to 10111111
Class B networks use two bytes for the network part and two for the host part which leads to a total of 16384 Class B networks with a maximum of 65535 hosts per network. The format of a Class B network is:
Página 11 de 135
When you see an IP address that starts from 128 and goes up to 191, then you will know that is a Class B address.
Class C Network
In Class C networks we have the first two bits of the first byte permanently set to 11 and the third bit set to 0. Therefore, the range for a Class B network in binary notation is:
11000000 up to 11011111
Class C networks use three bytes for the network part and one for the host part which leads to a total of 2097152 Class C networks with a maximum of 254 hosts per network. The format of a Class C network is:
When you see an IP address that starts from 192 and goes up to 223, then you will know that is a Class C address.
Classes D and E
Class D addresses start from 224 until 239. These addresses are defined as multicast addresses whereas Class E addresses are used only for scientific purposes. The latter cover the starting range from 240 until 255.
Special Purpose Addresses
Some IP addresses are reserved to serve certain purposes and they cannot be assigned to hosts. These special purpose addresses include:
IP address 127.0.0.1 — reserved for loopback tests. Node address of all 0s — used to identify the network address. Node address of all 1s — used to identify the broadcast address within a network (intended for all the hosts in
the network). IP address 0.0.0.0 — used to designate the default route. IP address 255.255.255.255 — used for broadcast to all hosts
Página 12 de 135
Private IP Addresses
A range of IP addresses has been reserved for use within a LAN for conservation purposes. The ranges of private IP addresses that can be used in the Local network and cannot be routed to the internet are the following:
10.0.0.0 10.255.255.255 172.16.0.0 172.31.255.255 192.168.0.0 192.168.255.255
If you’re interested in this topic, you can find the details about the usage of these private addresses in conjunction with Network Address Translation (NAT) functionality in one of my previous posts: Learn About Scaling IP addresses with NAT and PAT
Summary
I hope this article has been helpful! Now you can identify the different network classes and classify IP addresses within each class. The following table is sort of a cheat sheet, and it will help you remember how to do it all:
Página 13 de 135
http://www.texbuddy.com/network_design1_free.html
Network Design - IP Addressing:In the Cisco CCNA exam, IP addressing and subnetting questions can be difficult and confusing. However, don’t let that dicurrege you from studying this part of the CCNA exam, as it an important piece of knowledge you will need at work. In this article we will illustrate in details how to derive the subnet addres, broadcast address and IP host range for a tipical network design question from the CCNA exam.
Want more examples? For compelet detailed illustration of all CCNA exam topics, visit our CCNA Study Guide home page and check out our complete CCNA Quick Reference Chart.
Question:For a given IP address 172.16.10.22 and mask 255.255.255.240, answer the following:
1. What is the subnet IP address?2. What is the broadcast IP address?3. What is a valid range for a hosts IP addresses?
Answer:Don’t let the given IP addres confuse you, it is simply one of the hosts IP Addresses of this subnet. Later on, we will find the whole range of host IP addresses for this subnet.
Step1: Line up and convert the given IP address and mask to binary, see section A and B,
Note: The first Octet if the given IP address indicate it is a class B address; we know that in class B mask, the first two octets are set to 1. Therefore we conclude that the bits of the third octet and bit number 7, 6, 5 and 4 of the fourth octet are borrowed from the host portion of this class C address to be used for subnetting, see section A.
Step 2: Turn OFF all the host bits (set them to 0) to get the subnet IP address, see section C.
Step 3: Turn ON all the host bits (set them to 1) to get the broadcast IP address, see section D.
Step 4: The valid host IP address range is the list of IP addresses between the subnet address and the broadcast address. See section E.
Note: The given IP address (172.16.10.22) falls within the host range we found in Step 4.
Página 14 de 135
Página 15 de 135
http://www.softsession.com/resource/ref2.htm
IP Subnetting, Variable Subnetting, and CIDR(Supernetting)
1. Who is this for?
People who will be building networks. If you're a manager you can go to sleep now; if you know this stuff already, take a pizza break; if you want to actually build networks some day and are not already comfortable working out appropriate sizes of subnets, please come to the front of the lecture hall - I have a few copies of this lesson but not enough for everyone in the room.
2. Purpose of this lesson
Some day you may be responsible for designing a network that connects several locations together with routers. You'll have been given a certain number of IP addresses you can use, and you have to allocate them in chunks to each site without running out!
The reason we are going to learn subnetting is simple: there are not enough IP addresses free for you to give a whole Class C network to every site you manage. Some upstream providers charge you for each Class C you allocate. Others force you to justify your use of space in detail, showing that each network you allocated was fully populated.
Before we go into details, there are two things you might be able to use which will avoid the need to learn any of this stuff:
1. NAT - network address translationIf it is available to you, NAT often lets you create any size of network you want, without worrying about how much IP space you have been officially allocated. I'm not going to explain what NAT is in detail, because it will be covered in someone else's lesson. In short, it's a way to map large numbers of IPs on to a single IP (or to take a large sparse range such as a Class B and map each address that is actually used on to a small number of Class C's). NAT is worth taking the time to learn, because it can save you a whole lot of effort!
2. Online tools to calculate subnetsThere are many web pages available that will calculate netmasks for given sizes of subnets. These are useful as long as you understand the basics of what you're trying to do. If you don't have 'the big picture', these tools won't help. You can listen to this lecture to get 'the big picture' without getting distracted by the details, then use one of the online tools when you need actual numbers.
3. IP address space in general - inference of Class A/B/C
Before we start - a quick and very basic recap on IP addressing in general.Every machine on the net has an address. Addresses are 32 bits. These 32 bits are split into two parts - a network number followed by a host address. The 'host address' part is for a number of machines on one physical network - say a bunch of machines connected with a hub or on a single thin ether wire. The network number represents this group of hosts as a single unit, and routers need to know these network numbers to send data from one net to another.Just where the network/host split is made is arbitrary. There's no real reason why 10.1.2.3 should be part of a class A network and 220.1.2.3 is part of a class C network - it just is. The address space was split up as shown below, and any addresses in these ranges are deemed to be in the appropriate Class. Why does this matter? Well, some software will ask for an IP address but NOT a netmask - and it will infer a netmask from the address. This is OK as long as you are staying within the class system, but if you are subnetting or supernetting, it can cause you a lot of trouble.
Página 16 de 135
There's actually very little difference between a Class C network, and a Class B network with a 255.255.255.0 netmask applied. (The only time they're different is if the network address is of the form X.X.0.X or X.X.255.X)
Before you start designing your subnets, you should know what it is that you've been given. Here are three ways of finding out what class your allocation is in. Use whichever you find easiest.
o Class A addresses begin with 0xxx, or 1 to 126 decimal. (127 is loopback) o Class B addresses begin with 10xx, or 128 to 191 decimal. o Class C addresses begin with 110x, or 192 to 223 decimal. o Class D addresses begin with 1110, or 224 to 239 decimal. (a.k.a multicast - you'll probably never see
these) o Class E addresses begin with 1111, or 240 to 254 decimal. (or these)
o If the first bit is 0 it is a Class A address o If the first two bits are 10 it is a Class B address o If the first three bits are 110 it is a Class C address o If the first four bits are 1110 it is a Class D multicast address o If the first four bits are 1111 it is a Class E experimental address
First Byte Class Network Mask (explained later)1-126 "A" 255.0.0.0128-191 "B" 255.255.0.0192-223 "C" 255.255.255.0
In all the examples below we will assume we have been allocated a Class C network to work with: 192.168.1.0
192.168.1.0 is actually a special type of Class C address - it's one that is reserved never to be allocated on the real Internet. So we'll use it in our examples because if you do configure a network using these numbers, you won't mess anybody else up. It's amazing the number of people who create internal networks using real IP addresses chosen at random. If you ever connect one of these networks to the internet, you will not be to route because the space belongs to someone else. If you disguise your addresses using NAT, you'll still not be able to access those parts of the net that legitimately use those addresses.
Doing subnet calculations for Class A and Class B networks works just the same way as the Class C examples we are going to cover. If you can do a Class C from first principles, you'll be able to do Class B's in your sleep. Very few people here will get much opportunity to design Class A or Class B subnets, but you are quite likely to be asked to work on existing Class A or B networks, so it's still worth knowing.
What is Broadcast?
I assume you know what a broadcast address is - the necessity to handle broadcasts is actually what makes subnetting anything less than trivial: if you have a Class C network such as 192.168.1.* (with station addresses 192.168.1.1, 192.168.1.2 etc), then a packet addressed to 192.168.1.255 will be sent to *every* station on that network. Later we'll discover that sending to 192.168.1.0 is sort of something similar. Or was once, anyway.
Página 17 de 135
In a Class C, the host part set to 255 means broadcast. In a subnet, the subnet host part set to all ones means broadcast. Eg in a /28, any addresses of the form N.N.N.XXXX1111 are broadcast addresses for their subnets only.
Don't I need to know how to do binary arithmetic?
Forgetaboutit. If you can't do binary math in your head, just use the data in these tables below. (On the other hand, if you can't do binary in your head by now, you probably shouldn't be looking at a career in networking.)
Subnetting Class C - most typical example: /28 "all zeroes, all ones" excluded. Mask is 11110000
This table may be all you ever need to know, for many installations. This is a typical example and possibly the most common one. Because it is such a useful table, this is the only large one we will list in full.
Network part Subnet.host Host addresses Broadcast Address
192.168.1.0 0000xxxx 192.168.1.1 to 192.168.1.14
192.168.1.15 - UNUSABLE - NETMASK ALL 0000's
192.168.1.16 0001xxxx192.168.1.17 to 192.168.1.30
192.168.1.31
192.168.1.32 0010xxxx192.168.1.33 to 192.168.1.46
192.168.1.47
192.168.1.48 0011xxxx192.168.1.49 to 192.168.1.62
192.168.1.63
192.168.1.64 0100xxxx192.168.1.65 to 192.168.1.78
192.168.1.79
192.168.1.80 0101xxxx192.168.1.81 to 192.168.1.94
192.168.1.95
192.168.1.96 0110xxxx192.168.1.97 to 192.168.1.110
192.168.1.111
192.168.1.112 0111xxxx192.168.1.113 to 192.168.1.126
192.168.1.127
192.168.1.128 1000xxxx192.168.1.129 to 192.168.1.142
192.168.1.143
192.168.1.144 1001xxxx192.168.1.145 to 192.168.1.158
192.168.1.159
192.168.1.160 1010xxxx192.168.1.161 to 192.168.1.174
192.168.1.175
192.168.1.176 1011xxxx192.168.1.177 to 192.168.1.190
192.168.1.191
Página 18 de 135
192.168.1.192 1100xxxx192.168.1.193 to 192.168.1.206
192.168.1.207
192.168.1.208 1101xxxx192.168.1.209 to 192.168.1.222
192.168.1.223
192.168.1.224 1110xxxx192.168.1.225 to 192.168.1.238
192.168.1.239
192.168.1.240 1111xxxx192.168.1.241 to 192.168.1.254
192.168.1.255 - UNUSABLE - NETMASK ALL 1111's
0's/1's restriction on host part: let's take one subnet from the table above:
Network part Subnet.host Host addresses Broadcast Address
192.168.1.32 0010xxxx 192.168.1.33 to 192.168.1.46
192.168.1.47
Now, let's look at the individual hosts within that subnet:
Network part Subnet . Host part Host Address192.168.1.32 0010.0000 UNUSABLE - HOST PART IS ALL 0's
192.168.1.33 0010.0001
192.168.1.34 0010.0010
192.168.1.35 0010.0011
192.168.1.36 0010.0100
192.168.1.37 0010.0101
192.168.1.38 0010.0110
192.168.1.39 0010.0111
192.168.1.40 0010.1000
192.168.1.41 0010.1001
192.168.1.42 0010.1010
192.168.1.43 0010.1011
192.168.1.44 0010.1100
192.168.1.45 0010.1101
192.168.1.46 0010.1110
192.168.1.47 0010.1111 UNUSABLE - HOST PART IS ALL 1's
Although you may be familiar with the all ones broadcast addresses (typically x.x.x.255 for a Class C network) you may not realise that at some time in the past x.x.x.0 was also used as a broadcast address. Although this seldom is done nowadays, for historical reasons we still obey this convention. (The last machine I owned that actually used
Página 19 de 135
the .0 address for broadcast was a Sun from the late 1980's)
Note what happens as the room for hosts gets smaller:
This is the host table for a /30:
Network part Subnet . Host part Host Address192.168.1.32 001000.00 UNUSABLE - HOST PART IS ALL 0's
192.168.1.33 001001.01
192.168.1.34 001010.10
192.168.1.35 001011.11 UNUSABLE - HOST PART IS ALL 1's
A /30 is particularly wasteful - 50% of the hosts are unusable. Similarly, a /26 is pretty bad, because 50% of the nets are unusable. a /28 is best because it lets you have (16 - 2) * (16 - 2) = 192 hosts.
This would be the host table if a /31, if it existed:
Network part Subnet . Host part Host Address192.168.1.32 0010000.0 UNUSABLE - HOST PART IS ALL 0's192.168.1.33 0010000.1 UNUSABLE - HOST PART IS ALL 1's
What's wrong with this picture??? Well, you can't have a /31. Here's why...
We can have subnets of /26,/27,/28,/29,/30 - BUT NOT /25 or /31!
This is a /30 (with sections removed for brevity):Mask is 11111100
Network part Subnet.host Host addresses Broadcast Address
192.168.1.0 000000xx192.168.1.1 to 192.168.1.2
192.168.1.3 - UNUSABLE - NETMASK ALL 000000's
192.168.1.4 000001xx 192.168.1.5 to 192.168.1.6
192.168.1.7
192.168.1.8 000010xx 192.168.1.9 to 192.168.1.10
192.168.1.11
192.168.1.12 000011xx 192.168.1.13 to 192.168.1.14
192.168.1.15
192.168.1.16 000100xx 192.168.1.17 to 192.168.1.18
192.168.1.19
192.168.1.20 000101xx 192.168.1.21 to 192.168.1.22
192.168.1.23
192.168.1.24 - 244
... .............................. .............
192.168.1.248 111110xx 192.168.1.249 to 192.168.1.250
192.168.1.251
192.168.1.252 111111xx192.168.1.253 to 192.168.1.254
192.168.1.255 - UNUSABLE - NETMASK ALL 111111's
Página 20 de 135
So why not a /25????
Network part Subnet.host Host addresses Broadcast Address
192.168.1.0 0xxxxxxx192.168.1.1 to 192.168.1.126
192.168.1.127 - UNUSABLE - NETMASK ALL 0's
192.168.1.128 1xxxxxxx192.168.1.129 to 192.168.1.254
192.168.1.255 - UNUSABLE - NETMASK ALL 1's
When the netmask is only one bit, it can't help but being all zeroes or all ones.
And why not a /31?
Network part Subnet.host Host addressesBroadcast Addresses (0's and 1's)
192.168.1.0 0000000x 192.168.1.0? to 192.168.1.1?
192.168.1.0 - UNUSABLE - NETMASK 000000's192.168.1.1 - UNUSABLE - NETMASK 000000's
192.168.1.2 0000001x 192.168.1.2? to 192.168.1.3?
192.168.1.2 - UNUSABLE - Broadcast 0's192.168.1.3 - UNUSABLE - Broadcast 1's
192.168.1.4 - 250
... .............................. ..........................
192.168.1.252 1111110x 192.168.1.252 to 192.168.1.253
192.168.1.252 - UNUSABLE - Broadcast 0's192.168.1.253 - UNUSABLE - Broadcast 1's
192.168.1.254 1111111x 192.168.1.254 to 192.168.1.255
192.168.1.254 UNUSABLE - NETMASK 111111's192.168.1.255 UNUSABLE - NETMASK 111111's
Variable subnetting example 1 (insert /30 into /28 from above)
Well, in the /28 example above, we've shown that the first and last subnets are unusable, because the subnet mask is either all 0's or all 1's. This is unfortunate because each of those subnets is losing 16 (-2) IP addresses each.
Página 21 de 135
Is there any way we can get back some of those addresses? Well, yes - there is. If you look at the example of a /30 subnet, you'll see these entries:
Network part Subnet.host Host addresses Broadcast Address
192.168.1.0 000000xx 192.168.1.1 to 192.168.1.2
192.168.1.3 - UNUSABLE - NETMASK ALL 000000's
192.168.1.4 000001xx 192.168.1.5 to 192.168.1.6
192.168.1.7
192.168.1.8 000010xx 192.168.1.9 to 192.168.1.10
192.168.1.11
192.168.1.12 000011xx 192.168.1.13 to 192.168.1.14
192.168.1.15
192.168.1.16 - 252
... .............................. .............
Apart from the first one, these are all perfectly valid subnets, and if we were to configure machines using them, they will look just like normal addresses in a /30 subnet. We can do exactly the same thing for the 192.168.1.240-255 addresses.
These small subnets - they only have 2 IP addresses that are usable - are actually just what you need when you are setting up a point to point link between different subnets (in different locations). So by using the 'slop' at the end of the range, you can get your point to point links for free.
Variable subnetting example 2 (insert /28 from above into /26)
Here we have a different and possibly more useful example of variable subnetting. Let's say we have a central office with 50 workstations, one remote office with 10, and another remote office with 9 workstations.
The following table tells you how many workstations and how many offices you can have for each size of subnet mask:
Bit Split
Subnet Mask
Block Size
Max Useable Subnets(number of office
# C IPs/Subnet(number of workstations)
2/6 192 (/26) 64 2 62
3/5 224 (/27) 32 6 30
4/4 240 (/28) 16 14 14
5/3 248 (/29) 8 30 6
6/2 252 (/30) 4 62 2
You see, with one office of size 50, we're forced with a simple subnet scheme to use a /26 (2 bits subnet, 6 bits host). However, we have three offices, so this won't work.With offices of size 9 or 10 (which we round up to 16 - 2), we could use a /28 (16 - 2 subnets of 16 - 2 stations) - but then we couldn't fit in our 50 station office.
Página 22 de 135
Well, the solution is simple: Treat it as a /26, allocate the large office, then extract from a table of /28's enough smaller subnets to fit in the one remaining /26 slot. Like this:
Network part Subnet.host Host addresses Broadcast Address
192.168.1.0 00xxxxxx 192.168.1.1 to 192.168.1.62
192.168.1.63 UNUSABLE - NETMASK ALL 00's
192.168.1.64 01xxxxxx192.168.1.65 to 192.168.1.126
192.168.1.127 ALLOCATE THIS TO BE FURTHER SUBNETTED
192.168.1.128 10xxxxxx192.168.1.129 to 192.168.1.190
192.168.1.191 ALLOCATE THIS ONE TO THE 50-STATION OFFICE
192.168.1.192 11xxxxxx 192.168.1.193 to 192.168.1.254
192.168.1.255 UNUSABLE - NETMASK ALL 11's
(note: with a simple /26, you lose HALF of your potential IP addresses to the broadcast network addresses)
And guess what ... if we look at the earlier table for a /28, you'll find exactly the section we need to extract and fit in here:192.168.1.63
Network part Subnet.host Host addresses Broadcast Address
192.168.1.64 0100xxxx 192.168.1.65 to 192.168.1.78
192.168.1.79
192.168.1.80 0101xxxx 192.168.1.81 to 192.168.1.94
192.168.1.95
192.168.1.96 0110xxxx 192.168.1.97 to 192.168.1.110
192.168.1.111
192.168.1.112 0111xxxx 192.168.1.113 to 192.168.1.126
192.168.1.127
Now we simply put the two tables together, and we have a variable subnet solution for our three offices. Plus some spares!
Network part Subnet.host Host addresses Broadcast Address
192.168.1.0 00xxxxxx 192.168.1.1 to 192.168.1.62
192.168.1.63 UNUSABLE - NETMASK ALL 00's
192.168.1.64 0100xxxx 192.168.1.65 to 192.168.1.78
192.168.1.79 ALLOCATE THIS TO THE 10-PC OFFICE
192.168.1.80 0101xxxx 192.168.1.81 to 192.168.1.94
192.168.1.95 ALLOCATE THIS TO THE 9-PC OFFICE
192.168.1.96 0110xxxx 192.168.1.97 to 192.168.1.110
192.168.1.111 SPARE
192.168.1.112 0111xxxx 192.168.1.113 to 192.168.1.126
192.168.1.127 SPARE
Página 23 de 135
192.168.1.128 10xxxxxx192.168.1.129 to 192.168.1.190
192.168.1.191 ALLOCATE THIS ONE TO THE 50-STATION OFFICE
192.168.1.192 11xxxxxx 192.168.1.193 to 192.168.1.254
192.168.1.255 UNUSABLE - NETMASK ALL 11's
and don't forget the trick of grabbing the end IP's for the point to point networks to link these offices together.
Preference to finer resolution routes - don't need to fully enumerate
Let's say you have variably subnetted a network, and of the 30 subnets available, 29 of them are in one office, but the 30th is in the other. To route this properly you would issue 29 routing commands to one address and 1 to the other. This is wasteful of router table space. The thing to do is to issue ONE router command that covers all 30 subnets and send them to the one office, but issue a second router command which is MORE SPECIFIC to extract that one subnet from the block, and route it elsewhere. More specific routes take precedence in most routers. Occasionally you will find some brand of router which does require non-overlapping routes, and if this happens to you, just issue all 30 explicit commands.
"Supernetting", aka CIDR (Classless InterDomain Routing)
The world has a big problem with too many route table entries in the big backbone routers. To solve that problem, people realised they could aggregate network routing commands, eg a network 192.168.2.0/24 and a neighboring network 192.168.3.0/24 could be represented by merging them like this: 192.168.2.0/23
This would be fine, except we know the problems of subnetting and all-zeroes and all-ones masks. The same problems would start showing up here. The solution is simple: someone just issued an edict saying "forget everything you learned, we won't bother with those rules any more". There's even a command to tell the routers themselves that they should ignore the rules - "ip classless"When you break the rules like this, and allow netmasks that end in all 0's or all 1's, it's called "CIDR" - Classless InterDomain Routing.
That's really all you need to know about CIDR. It's trivial, it's easy, and the details work just the same as subnetting but you merge up instead of splitting down.
Calculators
Once you understand subnetting as described above, you'll probably be able to do it in your head. However sometimes you want to check your work, or are in a hurry, and if so, there are many web pages on the net which offer "subnet calculator"s.Just be warned - often they do not check for the special conditions such as all-one's subnets, and will let you do something stupid like ask for a /25 subnet. The one referred to below does appear to make an effort at checking for this sort of thing, so it may be a good one to bookmark.
Final test :-)
You are a sys admin at a small ISP. You asked your upstream vendor for a /19 allocation (equivalent to 32 Class C networks). You were given the following: 167.114.209.0 through 167.114.240.0.
Will these do what you want?
Página 24 de 135
http://www.svrops.com/svrops/documents/subnetshortcut.htmSubnetting Shortcuts
Class C
200.4.5.0 Borrow 3 bits Subnet Mask = 255.255.255.224
Number of networks created 23 = 8Number of useable networks created 23 = 8 – 2 = 6
Number of host per network 25 = 32Number of useable host per network 25 = 32 – 2 = 30
The increment for each network is 32
If you need to determine the network number of subnet 6,multiply 6 X 32 = 192.The subnet 6 network address would be 200.4.5.192
In simple terms, multiply the increment by the number of the subnetyou wish to find.
Class B – borrowing in the 3rd octet
150.4.0.0 Borrow 3 bits Subnet Mask = 255.255.224.0
Number of networks created 23 = 8Number of useable networks created 23 = 8 – 2 = 6
Number of host per network 25 X 256 = 8192
The increment for each network is 32 in the 3rd octet(the number of unmasked bits in the 3rd octet is 5, this isthe octet we borrowed from)
If you need to determine the network number of subnet 6,multiply 6 X 32 = 192.The subnet 6 network address would be 150.4.192.0
If you are borrowing in the 3rd octet, just ignore the 4th
octet to determine your network numbers.
Página 25 de 135
Class B – borrowing all the 3rd octet
150.4.0.0 Borrow 8 bits Subnet Mask = 255.255.255.0
Number of networks created 28 = 256Number of useable networks created 28 = 256 – 2 = 254
Number of host per network 20 X 256 = 256
The increment for each network is 256 in the 3rd octet.(The number of unmasked bits in the 3rd octet is 0, this isthe octet we borrowed from.This means that the value of the 3rd octet increases by one each time.)
If you need to determine the network number of subnet 26, simplyinsert that number into the 3rd octet slot.The subnet 26 network address would be 150.4.26.0
If you need to determine the network number of subnet 100, simplyinsert that number into the 3rd octet slot.The subnet 100 network address would be 150.4.100.0
Class B – borrowing in the 4th octet
150.4.0.0 Borrow 11 bits Subnet Mask = 255.255.255.224
Number of networks created 211 = 2048 (or 23 X 256 = 2048)
Number of useable networks created 211 = 2048 – 2 = 2046
Number of host per network 25 = 32
The increment for each network is 32 in the 4th octet.(The number of masked bits in the 4th octet is 3, the number ofunmasked bits in the 4th octet is 5, this is the last octet we borrowed from.This means that the value of the 4th octet increases by the increment value.)
If you need to determine the network number of subnet 325, do the following:
Divide the desired subnet by 2 raised to the masked bits in the 4th octet
Página 26 de 135
325 / 23 or 325 / 8 = 40 remainder 5
The 40 is the value of the 3rd octet -- 150.4.40.?
To find the value of the 4th octet multiply the remainder (5) times the increment (32)
32 X 5 = 160 This is the value of the 4th octet
The subnet 325 network address would be 150.4.40.160
--------------------------------------------------------------------------------
If you need to determine the network number of subnet 40, do the following:
Divide the desired subnet by 2 raised to the masked bits in the 4th octet
40 / 23 or 40 / 8 = 5 remainder 0
The 5 is the value of the 3rd octet -- 150.4.5.?
To find the value of the 4th octet multiply the remainder (0) times the increment (32)
32 X 0 = 0 This is the value of the 4th octet
The subnet 40 network address would be 150.4.5.0
Another Method
Class B – borrowing in the 4th octet
150.4.0.0 Borrow 11 bits Subnet Mask = 255.255.255.224
Number of networks created 211 = 2048 (or 23 X 256 = 2048)
Number of useable networks created 211 = 2048 – 2 = 2046
Number of host per network 25 = 32
The increment for each network is 32 in the 4th octet. (The number ofmasked bits in the 4th octet is 3, the number of unmasked bits in the4th octet is 5, this is the last octet we borrowed from.This means that the value of the 4th octet increases by the increment value.)
Página 27 de 135
Another way to determine the Network Number of a Subnet:
Página 28 de 135
http://www.itdojo.com/blog/2009/02/let-me-take-a-stab-at-this-ip-subnet-zero-thing/
Let me take a stab at this ‘ip subnet-zero’ thing
Subnetting. A simple thing that fills many with dread. The swirl of numbers flying about when discussing subnetted networks can make your head respond in kind. If subnetting wasn’t challenging enough we have long dealt with this thing, this ’subnet-zero’ thing. Discussion on the topic (this post included) lingers for some unknown reason. It vexes me. I even read a recent post (written about a month ago) that suggested NOT using it was still a viable concept. At the risk of taunting the author I shall refrain from links to that post. I can’t tell you how much I disagree with such a statement. Well, scratch that. I actually can tell you how much I disagree. Please enjoy:
First, a review: What is ‘ip subnet-zero’?
It’s a command you enter into a Cisco router (or L3 switch), actually. From global configuration mode you have two choices: ip subnet-zero or no ip subnet-zero. If you want to use this thing we call subnet zero you enter the former. If you don’t want to use it, enter the latter. And I don’t understand you if you don’t want to use it. Cisco doesn’t either. They have been telling you for a long time that you should be using it. The command has been enabled by default since IOS 12.0 which has been out for the better part of a decade. To stop using it you would have to intentionally go into the router and disable it (e.g. no ip subnet-zero). And who are you to disable a Cisco default? Hmmph. I thought so.
So it’s a command. Cool. But what does it actually do? In simple terms the command controls whether or not the all zeroes and all ones subnets are valid. Easy enough to say but it’s a little more involved to understand. Let me explain by way of example. Here is an example of a simple subnetting problem that uses subnet zero (and yes, I’m assuming you already have a little bit of subnetting skill):
In this example we take the 192.168.44.0/24 network and subnet it by 4 bits, dividing it into 16 networks. If we look at the newly created networks a little more closely we will see something interesting. Using the image below, notice that the first network has all of the subnet bits set to zero. Also notice that the last network has all of the subnets bits set to one. We call the network with the subnet bits set to zero the “all zeroes subnet”. We
Página 29 de 135
call the network with the subnet bits set to one the “all one’s subnet”. Pretty clever names, I know. Collectively we refer to both of them as subnet-zero. Yeah, that makes sense? Deal with the weirdness.
Subnetting with IP Subnet-Zero
Two things you need to notice:
First: To the user, the all zeroes subnet looks alamringly like the original network. The original network was 192.168.44.0/24. The all zeroes subnet is 192.168.44.0/28. Does that creep you out?
Second: The all one’s subnet has a decimal value equal to the subnet mask value in the last octet AND the broadcast address of the all zero’s subnet is 192.168.44.255 which is identical to the broadcast address of the original network (192.168.44.0/24). How about that? Feeling spiders crawling up your legs?
What’s my point?
Página 30 de 135
First: People got confused by the striking similarity between 192.168.44.0/24 and 192.168.44.0/28. Let me restate that in case you didn’t catch it. People got confused by… (never mind the rest, it doesn’t matter). The important word, in case you missed the italics, is PEOPLE. Computers, routers and other network devices were NEVER confused by the apparent similarity. To the computer, a device which thinks only in binary, 192.168.44.0/24 is just as similar to 192.168.44.0/28 as 11.12.0.0/14 is. The difference is plain to see for the computer. The same can’t be said for the fragile mental stability of the network administrator. Because people were confused the decision was made long ago to simply throw out the all zeroes subnet. Just don’t use it. Problem solved! Outta’ sight, outta’ mind! The word lame comes to mind. How, in this world of IP address space exhaustion, can you even begin to condone throwing away a perfectly good network for the sole purpose of preventing confusion with the network administrators? Uh, you can’t. Your network people need to get over it. Suck it up, use the addresses. “Waste is a thief!” (my token Fight Club reference)
But wait! There’s more!
Second: We didn’t just throw out the all zeroes subnet. We threw out the all one’s subnet along with it. The confusion surrounding the decimal value of the last network value being equal to the subnet mask and the hosts having a decimal value greater than the subnet mask combined with the whole, “Hey the broadcast address of the last network is the same as the broadcast address of the original network”, thing caused “they” (whoever they are) to toss out the all one’s subnet, too. What was that word again? Oh yeah! Lame.
The all zeroes subnet and the all ones’ subnet are both perfectly valid networks. They should be used and are used in environments that are movitvated to squeeze all of the usefulness possible out of the IPv4 address space. So, if you haven’t been using it you need to get busy doing so. Have I mentioned that NOT using subnet-zero in IPv6 isn’t going to be an option? When your ISP gives you a prefix of 2001:ABCD:1234::/48 guess what your first usable network is going to be …2001:ABCD:1234::/64. How do you like them apples? Ha!
Página 31 de 135
http://dkerr.home.mindspring.com/IP%20Addresses,%20Subnet%20Masks,%20&%20Subnetting.htm
IP Addresses, Subnet Masks, & Subnetting
An IP address is used for Network Layer identification of hosts and routers on a TCP/IP network. The address consists of a 32-bit binary number of 4 octets and is usually displayed in the decimal format 100.100.100.100, which is called dotted decimal notation.
The class of the Network is determined by the high order bits
Class1st Octet Range
High Order Bits
A 1-126 000.000.000
B 128-191 100.000.000
C 192-223 110.000.000.000
The network I.D. 127.x.y.z is a reserved address used for the local loopback and self-diagnostic A network and host I.D. cannot be all binary 1's (Decimal 255) . If all bits are set to 1's this is interpreted as a
broadcast A network and host I.D. cannot be all binary 0's, If all bits are set to 0's this is interpreted as a the network I.D. The high order bits of 1110 (224.0.0.0 to 239.255.255.255) Class D is used for multicasting technologies and the
high order bits of 11110 (240.0.0.0 to 247. 255.255.255) Class E are reserved for future use
Bitwise ANDing
Hosts and routers use Boolean math to determine the netid and the hostid by the use of ANDing.
Bit 1 Bit 2 Result
1 1 1
1 0 0
0 1 0
0 0 0
ANDing IP Addresses and Subnet Masks
198.53.147.45
11000110
00110101
10010011
00101101
255.255. 1111 1111 1111 0000
Página 32 de 135
255.0 1111 1111 1111 0000
Result11000110
00110101
10010011
00000000
Note: In all calculations and comments the current classful standard is used. Under this standard, the first and last subnets are dropped.
The higher order bits of 198.53.147.45 are 110 thus this is a class C address
The Netid of this Class C address 198.53.147.0 and the Hostid is 45
From the example above it is visible that with this subnet mask the netid and hostid remained unchanged by bitwise ANDing.
Defining a Subnet Mask
Subnetting is a technique that allows the network administrator to divide a network into smaller networks by using the same network number assignment. The advantages of subnetting are below:
Simplified administration- With the help of routers networks can be broken up into smaller subnets that can managed more independently and efficiently.
Restructuring of the internal network without affecting external networks- A organization can continue to use it's allocated IP addresses without having to obtain additional IP blocks.
Improved security - Subnetting will allow an organization to separate internal networks on the internetwork but will not be visible to external networks.
Isolation of network traffic - With the help of routers and subnetting, network traffic can be kept to a minimum.
In the diagram above illustrates how a subnetted IP appears on an internal Intra-Net and the Internet. The Internet only reads the NetId and the routers on the Internet are only concerned with routing the IP packet to the Intra-Net external router. When the IP packet reaches the external router, which has been configured for subnet routing reads the HostId. The router then forwards the packet to appropriate subnet where it is delivered to the host.
Determining the Subnet Mask to Use
The diagram below shows that when subnetting an IP address the Netid remains unchanged but the Hostid is further sectioned or divided up.
The Current Classfull Standard
Página 33 de 135
There a number of different ways to define the available range of IP addresses. The MCSE exams use the existing Classful standard. Some network equipment may follow a more current addressing scheme called CIDR. To date, CIDR has not been adopted as the standard."
Just for reference, MS stacks do not adhere to the Classful standard. They will allow you to use all subnets, including the first and last. For example, look at the KB article, Q139983 "Class C Subnetting Options for RAS Routing"
The Current Classfull Standard rules are as follows.
1. The original Network ID (defined by the default class mask) 2. The Subnet ID (defined by any bits beyond the default class mask) 3. The Host ID
Before defining a subnet mask, you need to determine the number of segments and hosts per segment
Bit Pattern
Masked Bits
Provided Subnets
Subnet Mask
11000000
2 2 192
11100000
3 6 224
11110000
4 14 240
11111000
5 30 248
11111100
6 62 252
11111110
7 126 254
11111111
8 254 255
The above chart represents how a subnet mask is represented in binary format, to determine the values is quite simple
I. Determine the number of Physical segments required in your network and covert to binary format. In the example below 6 segments are required
II. Count the number of bits required to represent the number of physical segments in binary. With 6 required subnets (Binary value is 110). Representing 6 in binary requires 3 bits
III. Convert the required number of bits to decimal format in high order (left to right). IV. Configure the 3 required bits as the first bits of the host id. The decimal value for binary 11100000 is 224.
Representing a subnet mask of 255.255.255.224
Página 34 de 135
Question: What happened to 198.53.147.32 and 198.53.147.63 why can't these be IP addresses ?
198.53.147.32 - Is the subnet's Network Id which is revserved for the physical segment (00100000).198.53.147.63 - Is the subnet's Broadcast Address (00111111)
As stated above every network or subnet has a IP address for the Physical segment and a Broadcast Address.
Calculating Hosts
Bit Pattern
Masked
Bits
Provided
Subnets
Subnet
Mask
Class A
Hosts/Subnet
Class B Hosts/Subnet
Class C
Hosts/Subnet
11000000
2 2192
4,194,301
16,382
62
111
3 6 224
2,097,
8190
30
Página 35 de 135
00000
150
11110000
414
240
1,048,574
4,094
14
11111000
530
248
524,286
2,046
6
11111100
662
252
262,142
1,022
2
11111110
7126
254
131,070
510
0
11111111
8254
255
65,534
254
0
Question: I want to set up a TCP/IP LAN in my organization what IP addresses should I use?
For hosts that need to be connected to the Internet you can get a block of valid IP addresses from a ISP. Larger Organizations or ISP's can get IP blocks from the American Registry for Internet Numbers
The following IP address ranges have been set aside for Internal use. These IP's are will not be routable on the Internet.
Class A: 10.xx.xx.xx Addresses: 10.0.0.1 to 10.255.255.254
Página 36 de 135
Class B: 172.16.xx.xx - 172.32.xx.xx Addresses: 172.16.0.1 to 172.31.255.254
Class C: 192.168.xx.xx Addresses: 192.168.0.1 to 192.168.255.254
http://hubpages.com/hub/ip-tutorial-subnetting
Página 37 de 135
Step-by-Step tutorial by expert to understand IP adressing and subnetting (CCNA context) Part-II(Subnetting)
Topic: Subnetting a network An step-by-step tutorial with examples for IP addressing and sub-netting.
Subnetting:
To divide a large network into smaller sub-networks, we have to simply turn some of the host bits on in the subnet mask, thus increasing the number of sub-networks and decreasing the number of hosts per sub-networks. Here we are dividing a class C network into 2 smaller sub-networks by turning two host bits on in the subnet mask. It means now we are having 26 bits reserved for the network addressing and only 6 bits remaining for the host addressing. The formula to get the number of subnets is:
No. of subnets is equal to 2^n-2, where "n" is the number of bits taken from host. So here in our case we have taken 2 bits from the host, thus we get total of two subnets. In fact we get total of four subnets, but according to RFC which stands for Request For Comment and is the documentation of TCP/IP, we cannot use the first subnet because all the subnet bits are turned "off" in the first subnet and we cannot use the last subnet, because all the subnet bits are turned "on" at the same time, however Cisco routers does allow 1st subnet to be used by issuing an IOS command "ip subnet zero". Here just remember that the subnet bits refer to the number of bits taken from the host. So we have to subtract all subnet bits on and all subnet bits off. Practically we can use all the subnets, but from CCNA exam point of view we cannot use 1st and last subnet.
Página 38 de 135
Now the No. of hosts per subnet is equal to 2^r -2, where "r" is the number of bits remaining for the host. So 2^r-2 is equal to 2^6-2 is equal to 62. So we get total of two subnets with 62 hosts per subnet. ==================================================
After getting the number of subnets and hosts per subnet, we have to find the valid host range in each subnet and network and broadcast address for each subnet. To get all these information, we have to get a block size. We get block size by subtracting decimal value of the subnet bits from the maximum value of the octet, that is 2^8 is equal to 256. So here Block size is equal to 256 - 192 = 64. In this case, 192 is the decimal value of the two subnet bits turned on. Once we get a block size, that block size becomes the network address of the first valid subnet. Add block size to the first valid subnet and it gives you the network address of the second subnet. Keep on adding the block size to next subnet until the value reaches to equal to all subnet bits turned "on", which is 192 in our case. So we cannot use this last subnet. So we got two valid subnets, i.e., subnet 64 and subnet 128. The valid IP range for the subnet 64 is from 192.168.0.65 to 192.168.0.126. The network address for this subnet is 192.168.0.64 and broadcast address is 192.168.0.127. We cannot assign these network and broadcast addresses to the system. The valid IP range for the subnet 128 is from 192.168.0.129 to 192.168.0.190. The network address for this subnet is 192.168.0.128 and the broadcast address is 192.168.0.191. =====================================================
Página 39 de 135
First of all let us write the subnet mask. Since it is class C address, the default subnet mask length is 24 bits. And we have taken 3 bits extra from the host portion. Now we have total of 27 bits for network addressing. If you remember earlier lessons, you will be able to calculate that up-to 24 bits continuous "on" in subnet mask will be represented as 255.255.255.0, but we have taken 3 bits extra from the fourth octet. So the decimal value of the three bits from the left will be 224. Hence new subnet mask for the network 202.10.4.0/27 will be 255.255.255.224. It's important to remember that all the subnets will have the same subnet mask. Now let us calculate the number of subnets. Here the number of subnets =2^n-2 = 2^3-2 = 6. So we got six smaller networks or subnets out of dividing a single class C network. Now let us calculate the number of hosts per subnet. ==================================================
Página 40 de 135
The number of hosts per subnet = 2^r-2 = 2^5-2 = 30. So we divided one big network into six smaller sub networks with 30 hosts each. Next let us calculate the block size. Block size = 256 - 224 =32. Here 224 is the decimal value of the subnet bits i.e., the number of bits we have taken from the host. Now start from the block size and keep on adding itself to next block till it reaches to maximum i.e., 224 which we cannot use. So we got the blocks of 32, 64, 96, 128, 160 and 192. The valid IP address in first subnet starts from 202.10.4.33 to 202.10.4.62, the network address for this subnet 32 is 202.10.4.32 and the broadcast address 202.10.4.63. The valid IP addresses in subnet 64 starts from 202.10.4.65 to 202.10.4.94, the network address for this subnet is 202.10.4.64 and the broadcast address is 202.10.4.95. The valid IP addresses in subnet 96 starts from 202.10.4.97 to 202.10.4.126, the network address for this subnet is 202.10.4.96 and the broadcast address is 202.10.4.127. The valid IP addresses in subnet 128 starts from 202.10.4.129 to 202.10.4.158, the network address for this subnet is 202.10.4.128 and the broadcast address is 202.10.4.159. The valid IP addresses for the subnet 160 are from 202.10.4.161 to 202.10.4.190, the network address is 202.10.4.160 and the broadcast address is 202.10.4.191. The valid IP addresses for the subnet 192 starts from 202.10.4.193 to 202.10.4.222, the network address for this subnet is 202.10.4.192 and the broadcast address is 202.10.4.223. ==================================================
Página 41 de 135
Now you can see that we have divided single class c network into six sub-networks. And we are using five subnets out of six on different interfaces of the router. Every sub net is having the same subnet mask that is /27. If you remember earlier IP address assignment, we were losing almost 1212 IP addresses out of 1270. Now after sub-netting, we are saving almost 4*254=1016+30= 1046 IP addresses. Well that's really a huge saving.
Definitely we are able to save lot of IP addresses in the example but you can observe that we are still losing a lot of IP addresses. We know that on the network-1 and network-2 side, we may use all the IP addresses in the subnet, but what about router to router interfaces..? We are never going to use more than two IP address on the point to point serial link between two routers. So if our sub-networks are having 30 hosts each, we are utilizing only two IP addresses per subnet out of 30. Again we are losing almost 28 IP addresses per router to router interfaces. To save IP addresses which are being wasted this way, we use a concept called VLSM or classless routing. VLSM stands for Variable Length Subnet Mask. In classless routing we assign variable length subnet mask to different interfaces of the routers. The contrary of the classless routing is class full routing where every interface of the routers are having same subnet mask. By using classless routing we use different subnet mask for the router to router interfaces and some other subnet mask for the hosts side. ====================================================
Página 42 de 135
Now you can see that we are using different subnet mask for the router to router interfaces and router to host interfaces. For router to router interfaces we are using slash 30 subnet masks, which provides only two IP addresses per subnet while the router to hosts side we are using slash 27 which is providing 30 hosts per subnet.
Now let us subnet a class B network.
===================================================
We have a requirement of total of 13 subnets with minimum of 4000 hosts per subnet. We are using the class B network 131.100.0.0. How many bits should we take from host portion to fulfill the above requirements? If we take two bits, we will be getting 2^2-2= 2 subnets. But we need 13 subnets. So if we take 5 bits then we will get 2^5-2=30 subnets. Great we are getting more than what we needed. But what about hosts. Just let us calculate.
Página 43 de 135
Since it is a class B network, the total number of host bits is 16, out of which we have taken 5 bits for sub-netting. So the number of hosts per subnet will be 2^11-2=2046. But we require at least 4000 hosts per subnet. So let us try once again. If we take 4 bits from hosts then? Let's calculate. ===================================================
If we take four bits from host portion, then total number of network bits becomes 20. The new subnet mask for each subnet will be 255.255.240.0. Number of subnets = 14 and number of hosts/subnet we get 4094. Exactly what we needed. So four bits extra solves our problem. One more important thing you should know that the representation of network addresses like 131.100.0.0/20 is referred as CIDR notation. CIDR stands for classless inter-domain routing.
Now we are going to discuss another important term related to IP addressing, "Super-netting". You will be wondering what is this new term? Very simple, remember what is sub netting? Division of one large network into multiple smaller sub-networks. And super-netting? Grouping multiple networks into larger super networks. Confused. We discussed that sub-netting is done to save the IP addresses, so super-netting is contrary to that, it will waste IP addresses, if use on client side. So why do we need super-netting? Well it is used by ISP's for route summarization. We do route summarization to bring down the number of routing table entry in the internet routers. As you should know that internet routers must have every network route entry into its routing table, in order to route packets to every possible destination. Routers simply drop packets if they don't find the destination network in the routing table. So internet routers will have to maintain routing table entry of every possible network around the world in order to provide connectivity from any where around the world to any site. This will lead to hundreds of thousands of routing table entry. The result of so many routing table entry will be slowed down routing performance, since routers will have to read through the very long list of routing table to find out the destination network before it can forward the data packets on outbound interface. Hence to reduce the number of routing table entry the ISP's gets assigned a large pool of IP addresses as super-nets. ===================================================
Página 44 de 135
Here you can see in the illustration, a large ISP has got 202.100.100.0/22 super-net assigned. The large ISP is assigning small networks within the super-net to small ISP's. The small ISP's are further dividing the networks into sub-nets and then assigning to the customers. Important thing to notice here is that all the networks including sub-nets under the large ISP is represented as single super-net 202.100.100.0/22 to the internet. When ever any data packets arrive to the internet router for any small ISP's customers, the internet router will simply send to the Large ISP. Internet routers will have to remember only large ISP's network and not every network under the large ISP; hence super-netting effectively solves the problem of large number of routing table entry into the internet routers. Representation of large number of networks as single super-net into the internet routers routing table is referred as route summarization, and the representation of super-nets in the form of 202.100.100.0/22 is referred as CIDR notation. CIDR stands for class less inter domain routing. So we learnt how super-netting brings down the number of routing table entry into the internet routers. Now we will learn how to create super-nets. ===================================================
Página 45 de 135
Remember, for sub-netting, we take bits from host, but for super-netting we give bits to hosts. Just see the figures. We had a class C network 202.100.100.0/24 but we removed two bits from the network portion and added to host. Here removing means turning the network bits off. If you examine the figures closely, you will find that each super-net here is a combination of four class C networks. The first super-net is ranging from 202.100.100.0 - 202.100.103.255, which includes network 202.100.100.0, network 202.100.101.0, network 202.100.102.0, and 202.100.103.0. The same way every super-net out here consists of four class C networks with 1022 hosts per supernet.
Página 46 de 135
http://www.johnpatricklockie.com/rmmylife/?p=163
VLSM Concepts…
VLSM is simple if you think of it this way.
I have this subnet
10.0.0.0 - 10.0.3.255 (255.255.252.0)
I want to tell an application to scan a range of IPs, but this application doesn’t like to get ranges. It only works with netmasks. So if I tell it 10.0.0.0 /22 then it will scan all 1,024 host address (or 1,022 usable hosts).
VLSM is a way of subneting an already subneted address. Suppose I want my machine to scan for IP’s 10.0.3.0 – 10.0.3.100 because I know the host I am looking for should be in that range. Well, instead of scannng /22 I can feed the application this IP subnet:
10.0.3.0 /25 (255.255.255.128)
I just subneted my already subnet address 10.0.0.0 /22 in to a smaller network of 126 usable host address. Now my application will scan for 10.0.3.1 – 10.0.3.126. That’s much better than scanning the entire /22 subnet! This is kind of how route summarization works, only the other direction (taking lots of smaller routes to smaller networks and summarizing them as larger blocks).
Well, we could just as easily segment a network at layer 3 by using VLSM in this way. There is no smoke and mirror and no mystic guide required…
This is how I understand VLSM, and I think if you can come to grasp subnets then VLSM is simply an extension of that. You must look at your IPv4 addresses as blocks of usable IP’s in which you can build layered networks to manage your broadcast domains even better…
Another real world example of this, is if you had to give IP’s to 75 clients. Well, then you are forced to use the /25 subnet which contains 126 host IP’s. That’s a waste of 51 IP’s! So why not use VLSM to pick up these IP’s and use them in other networks which do not have as much an abundance of usable host IP’s?
Well, we will be using these IP:
10.0.0.1 - 10.0.0.75 /25
We will not be using these IP:
10.0.0.76 - 10.0.0.126 /25
Suppose our new network will require 28 hosts. We will want to subnet somewhere in the range of .76 and .126, 28 IP’s. We know from our subnet rules that to get 28 hosts requires we go with a 32 host network which is 255.255.255.224 (/27). We need to determine the start and end ranges, which is pretty easy to do:
10.0.0.1 - 10.0.0.30 <-- contains IP's in our 10.0.0.1 - 10.0.0.75 network10.0.0.33 - 10.0.0.62 <-- contains IP's in our 10.0.0.1 - 10.0.0.75 network10.0.0.65 - 10.0.0.94 <-- contains IP's in our 10.0.0.1 - 10.0.0.75 network10.0.0.97 - 10.0.0.126 <-- first free block outside our already used IP's!
Therefore, we have the following VLSM scheme of contained IP’s within the /25 subnet:
Página 47 de 135
Host Network A
Network: 10.0.0.0 /25Broadcast: 10.0.0.127 /25Host Range: 10.0.0.1 - 10.0.0.126Actual Used IP's: 10.0.0.1 - 10.0.0.75
Host Network B (subnet the remaining host IP’s in the /25 network to get 28 hosts an a new network)
Network: 10.0.0.96 /27Broadcast: 10.0.0.127 /27Host Range: 10.0.0.97 - 10.0.0.126Actual Used IP's: 10.0.0.97 - 10.0.0.125
Let’s Talk About Subnetting…
Subnetting is tricky, but not difficult. What sets the expert apart is the ability to subnet quickly, and then on top of that to do variable length subnetting.
First, I would like to thank some people in teaching me some of the cool tricks of the trade, which guided me to completing this chart.
1. Omar Faytrouni: originator of the chart that I based my chart off of….great guy.2. Richard Haskins: my first CCNA and CCSP instructor, who opened the world of networks and IT up to me! He doesn’t teach anymore, but he is missed!
So a few years ago when I was taking some Microsoft courses (after I had taken a bundle of CCNA and CCSP courses) a professor by the name of Omar Faytrouni presented to us a nifty little chart to aid in subnetting. I placed this chart on the internet, and over the years it has spread on the net. You can Google Omar and find that chart. I currently host the original copy at my old site which is coming down in a couple of months. Here it is in all it’s glory (without explanation).
Página 48 de 135
Omar Faytrouni's TCP Subnetting Chart
What’s wrong with this chart? Nothing really. How the heck do you use it though (it does come with instructions!)? I will say, it’s a cinch to memorize, but if I have to use it on a test I think I would be faster just counting bits on the paper. This chart requires a lot of memorization still, and requires doing math on the side. Omar would probably argue with me on that, but he would be wrong. He’s a brilliant guy, and I learned a ton from him about Microsoft. But I don’t think he realized just how fast his brain was. This chart was like a string around his finger, and not all of us are that quick. I need the answer key, not the string. But I really felt he was on to something all these years, and I watched many students get a lot out of using this chart. Wanting to make something out of it for myself, and something that can carry me through a CCIE written and even a lab environment I took some time to make this:
Página 49 de 135
And now, I can subnet anything in a matter of seconds. I can also find out host, subnet, and range information from an IP address given a CIDR or a subnet mask. Literally, in seconds if that. I was showing this to our Network Admin today and he caught on almost right away (he obviously already understands the concepts of subnetting). I think I am on to something here. I have taken the best aspects of Omar’s chart (primarily, that it’s easy to replicate on test day), and added greater and quicker resources, and made it still extremely easy to remember and replicate. I defy any CCNA candidate to tell me they would have a hard time subnetting off of this chart, or even remembering how to replicate the chart. So let’s break it down a little – because I will probably use this post to point people to directions on how to use this thing (if it’s not obvious).
Oh, one more thing – this chart is not dependent upon the colors. The colors are there for instruction – to make it sort of “obvious” what the numbers represent. Once you learn how to use the chart it should become painfully obvious and easy to use without the kindergarten color scheme!
First, let’s discuss how to discover networks using this chart. For those problems that ask something like: “what is the default gateway for IP address 172.16.26.4 /22“. Now, any student knows this is a CLASS B address and to borrow from the 3rd octet. This CIDR we know is borrowing 6 bits from the /16 default (if you don’t know, /16 is 255.255.0.0 and that is considered CLASS B). If we were going to borrow 4 bits, this would be a CIDR of /20. Some organizations will subnet private IP address without consideration for classful systems (it is common to treat LAN IP’s as “classless”). For example, you will see the “10″ network used as a CLASS C IP address even though from a “standards” perspective it is CLASS A. I can admit in my networks we subnet 10 as a /22. Anyway, since we have a CIDR we can use that as a starting point. Check the charts “CIDR” section:
For us, we will look at the “+6″ column. Why? Because /22 is /16+6…..so let’s see where our bits land when we are on a +6 CIDR….
Página 50 de 135
We immediately see how many NETWORKS we are going to have. That is, 64. This field is in blue. The blue fields represent the last “1″ bit in our subnet mask. In this example we know that CIDR /22 is going to give us 64 networks. Now let’s examine the entire row of bits to determine the subnet mask, host ranges, and total amount of hosts on this network. This chart is both vertical and horizontal, but 80% of the information you get from it will be on the “X” axis. We simply use the “Y” axis to determine our CIDR (or if we only have a CIDR to start with we start there!).
To the left is our subnet mask, 252. Being a CLASS B IP address, we now know our subnet mask for 172.16.26.4 is not only /22, but 255.255.252.0.
The body of the table is a logical representation of the bit masking going on. In the case of a CLASS B subnet scenario we know this will be the structure of our 3rd octet:
1 1 1 1 1 1 0 0 <-- the reality1 1 1 1 1 (64) (4) 0 <-- my representation to show where network ends and hosts start
I have replaced the last “1″ and the first “0″ with the number of networks, and range of hosts!
The 2^2 is just another way of showing that we have 2 bits available for host address in this octet (2 to the power of 2). That means every 4 numbers in this octet (the third octet) we have entered a new “network”. But this does not represent the total amount of host ID’s for this subnet. It just tells us, look at the 3rd octet and count in “4’s” to find out what particular network an address is in….
1,2,3,4 <new network> 5,6,7,8 <new network>, etc.
So if we have IP 172.16.26.4 we know that’s going to fall here:
172.16.0.1 - 172.16.3.254172.16.4.1 - 172.16.9.254172.16.8.1 - 172.16.11.254172.16.12.1 - 172.16.15.254172.16.16.1 - 172.16.19.254172.16.20.1 - 172.16.2.254172.16.24.1 - 172.16.27.254172.16.28.1 - 172.16.31.254....and so on for 64 total lines!
172.16.26.4 /22 will have a default gateway of 172.16.24.1! How easy was that? Too easy. Let’s try 1 more….
What is the network range for the address: 172.16.63.25 /18
Página 51 de 135
/18 = +2+2 = 255.255.192.04 networks with 64 hosts in each network
172.16.0.1 - 172.16.63.254172.16.64.1 - 172.16.127.254172.16.128.1 - 172.16.191.254172.16.192.1 - 172.16.254.254
Easy…..network range is 172.16.0.1 - 172.16.63.254
Okay, what about if we are asked to subnet a CLASS B and provide for “x” number of networks!?!?
This is why I put the network and host ranges down the chart from top left to bottom right. To keep this an “X” axis chart that requires very little “thought”. So if someone asks you to subnet their CLASS B range to provide for 12 networks you go right to the blue “16″ (because 12 is greater than 8, but less than 16) that sits on the last bit of the hostmask….here’s the answer graphically, you can figure the rest out:
Answer below (highlight with your mouse)
172.16.0.0 255.255.240.0 Ranges: 172.16.0.1 – 172.16.15.254 and so on… CIDR: /20
If you would like to know some tips on how to build the chart from memory read on….
Finally, building the chart is easy. All you need to know is this:1 2 4 8 16 32 64 128 256
Subnet masks are incremented, starting at 128....128 + 64 = 192192 + 32 = 224
Página 52 de 135
224 + 16 = 240240 + 8 = 248248 + 4 = 252252 + 2 = 254254 + 1 = 254
Notice that the "+" is simply the binary steps (look at middle column of #'s!), starting with 128 as the mask, and 64 to add....and the result carries over to calculate the next mask...if you stare at it long enough you will catch on
Start by listing the subnet masks. If you know binary, just remember 128! Then go down to 255.....
Now list all the "bits" from top down, starting with 1,0 like this:1 0 0 0 0 0 0 01 1 0 0 0 0 0 01 1 1 0 0 0 0 01 1 1 1 0 0 0 01 1 1 1 1 0 0 01 1 1 1 1 1 0 01 1 1 1 1 1 1 0
On the last 1's of each row replace them with 2 -> 128On the first 0's of each row replace them with 128 -> 2
Now top it off with CIDR numbers 1-8 at the top! DONE!
In a test it will look like this:
+1 +2 +3 +4 +5 +6 +7 +8[128] 2n 128c 0 0 0 0 0 0[192] 1 4n 64c 0 0 0 0 0[224] 1 1 8n 32c 0 0 0 0[240] 1 1 1 16n 16c 0 0 0[248] 1 1 1 1 32n 8c 0 0[252] 1 1 1 1 1 64n 4c 0[254] 1 1 1 1 1 1 128n 2c[255] 1 1 1 1 1 1 1 255n
I used "n" for network bit, and "c" for client bit here....easy!
I built this by starting with the SUBNET MASKS
Give me network range for 192.168.63.177 /26+2 for CIDR4 networks, with 64 clients in each network (remember, drop DOWN to the network bit not client bit)just looking at that IP I can say it falls in the range:
192.168.63.128 ---> 192.168.63.191
Subnet mask: 255.255.255.192
Easy? Well, I hope I don't have any errors in my own article =P (I already had to fix a couple)
Página 53 de 135
http://clarkincnet.wordpress.com/subnetting-%E2%80%93-an-ipv4-primer/
Subnetting – An IPV4 Primer
Subnetting
I’ve spent many hours helping people from the novice networking student to the seasoned technology professional understand IP addresses and subnets. It’s a core skill that is required to understand the basic communication used in networking. Below is a summary of the information that I pass along to would-be networking experts.
Review of Internet Protocol
The Internet Protocol (IP) is used on almost every network in the world, from the largest to the smallest. Most people are familiar with IP addresses, and that they are required in order to communicate on a network. But some are confused as to how they work. An IP address is a unique identification assigned to a device so that it can operate on a network.
An IP address consists of a 32-bit number that ranges from 0 to 4294967295. This means that theoretically, the Internet can contain approximately 4.3 billion unique objects. Because computers read IP addresses in binary (ones and zeros strung together to form a number) and because a 32-bit binary number would prove very difficult for humans to read, IP addresses were divided into four base-256 digits. In other words, the IP address was divided into four 8-bit numbers, or “octets”, which are separated by a period. This form is known as “dotted decimal” notation.
The internet currently uses the IP version four (IPV4) addressing format that is now some 20 years old. Because of the inherent address limitations IPV4 is being slowly replaced by IPV6. This newer version was defined in December 1998 by the Internet Engineering Task Force (IETF) with the publication of an Internet standard specification called RFC 2460. This paper will discuss IPV4, which is still the most widely used addressing format.
Review of Key Points: An IP (Internet Protocol) address is a unique identifier for a device on an IP network. An IP address is a 32 bit binary number usually represented as 4 decimal values, each representing 8 bits, in the range 0 to 255 (known as octets) separated by decimal points. This form of writing IP addresses is known as “dotted decimal” notation (example, 10.68.131.22).
Binary Numbers
Let’s face it – as humans we’re kinda lazy and for most of us that means when it comes to reading and remembering long numbers – we’d rather not. This is why the mathematicians developed the dotted decimal notation for us network administrators. However, computers prefer to process their numbers in formats that we humans find harder to remember, such as hexadecimal or binary.
For example, the dotted decimal notation of 10.68.131.22 is expressed as 00001010.01000100.10000011.00010110 in binary.
Of course the easiest way to convert binary numbers is to use a scientific calculator, which can easily convert binary to decimal and decimal to binary for you; however there is another way to do it.
Let’s take a look at one of the four octets. This octet has 8 bits, with each bit representing a certain value. If a bit has a 1 in it, then the bit is “on”, likewise, if the bit has a 0 in the placeholder position, the bit can be
Página 54 de 135
described as being “off”. In relating this to a light switch, the on position turns on the light and the off position turns the light off.
If you read the bit positions from right to left (backwards from the normal left to right that we use when we read a newspaper), the first position represents 1. The second position represents twice the first position or 2. The third position represents twice the value of the preceding bit or 4. This continues until the eighth and final position represents 128.
To convert the binary number 10110011 to decimal, you simply, line up the 1’s and 0’s according to their position, and then multiple either the 1 or 0 against the numerical value of that position. The sum, or total, of the multiplication equals the decimal number.
Review of Key Points: We’re lazy. Because we are lazy, we like to turn long confusing streams of ones and zeros into an easy to understand (and remember) decimal numbers. IP addresses are made of 4 octets, with each octet comprising 8 bits. Each bit represents a certain value with the lowest value bit residing on the right-most end of the octet. You can line up the 8 ones and zeros in the octet with each of the decimal numbers the octet positions represent and multiply them. By adding each of the products you arrive at the binary number. A scientific calculator does this for you without making you count on your fingers and toes.
Address Classes
OK, so we understand that IP addresses come in dotted decimal notation, and the number ranges for each of the four octets can be 0 thru 255 (for a total of 256 numbers). So, this means that we have the following IP addresses available for use on the Internet – 0.0.0.0.0 thru 255.255.255.255 – right?
Well, not exactly. These IP addresses are actually divided into different classes. And some of these IP addresses are reserved for special uses. For example, 127.0.0.1 is reserved for internal testing and is commonly known as the loopback address.
There are five main classes of IP addresses:
Class A addresses begin with 0xxx (binary) or 1 to 126 (decimal)
Class B addresses begin with 10xx (binary) or 128 to 191 (decimal)
Class C addresses begin with 110x (binary) or 192 to 223 (decimal)
Class D addresses begin with 1110 (binary) or 224 to 239 (decimal)
Class E addresses begin with 1111 (binary) or 240 to 254 (decimal)
Página 55 de 135
Of these classes, only Class A, Class B, and Class C addresses are used for common networking purposes. Class D addresses are used for multicasting, and Class E addresses are reserved for future use (of what possible future use, I cannot say… but they’ve been reserved for at least as long as I’ve been in networking).
How many possible addresses is there in a Class A range? There are 127 network licenses in a Class A network with over 16 million possible addresses. A Class B range affords 16,000 network licenses with 65,000 possible addresses per license. Finally, there are over 2 million network licenses for Class C, and each license allows for 254 possible addresses.
Review of Key Points: Each octet contains a total of 256 addresses. This number is taken by adding the 0 position to the maximum 255 positions available. Not all IP addresses can be used. IP addresses are divided into classes and are broken up into large networks and small networks.
List of Network and Host Ranges
It is important to understand the difference between the network portion of the IP address and the host portion. The network portion, shown above in blue, denotes the portion of the IP address which describes the network. The remaining part of the IP address, shown in green, denotes the possible host addresses. Therefore, on a Class A network of 101.100.100.100, the network ID is 101.xxx.xxx.xxx, and the host ID is xxx.100.100.100.
I used lowercase x’s for a reason. I want you to use your mind to carve out the network ID from the rest of the IP address. When we refer to this network ID, we use 101.0.0.0. So, the IP address 101.100.100.100 has a network ID of 101.0.0.0 and a broadcast address of 101.255.255.255.
Broadcast address? Remember in our discussion above, I stated that some IP addresses were reserved for special reasons. Each network has two special reserved addresses. The first one, is of course, the network ID, where all the bits in the remaining octets not used to distinguish the network ID are set to zeros. By turning all these same bits to ones, you have the second reserved address – the broadcast address.
Broadcast addresses are used to communicate with every device on the network. So, if you have a host device and it needs to utilize a network service, but doesn’t know which host on the network provides that service, it can send out a special message to ask all hosts on the network if they offer the service. This happens by setting the destination address of the packet to the broadcast address. This special packet, known as a broadcast packet, will be seen by all devices (increased network traffic) but only devices that provide that service will respond (potentially less network traffic).
Página 56 de 135
Review of Key Points: The diagram above demonstrates the vast number of possible hosts available to a single Class A network. Broadcasts are used to talk to all hosts on a network.
Private Networks
There are three private networks available. The addresses are 10.0.0.0, Subnet Mask 255.0.0.0, 172.16.0.0, Subnet Mask 255.240.0.0, and 192.168.0.0, Subnet Mask 255.255.0.0. The inclusion of these private networks has really been one of the saving graces of IPV4. These addresses can be used by anyone and are generally not routable, or at least, are not routable out on the Internet.
The real world use of these addresses allow organizations to use relatively few public IP addresses, but have the depth and range of a Class A address if needed.
Introduction of Subnets
Ok, so we know how IP addresses work, but what’s this stuff you’re saying about subnets? The word subnet is actually a shortened phrase for the term “sub networks”, which means a small network within a larger one, or a logically visible sub-section of a single Internet network. The smallest network within a larger network is known as a “broadcast domain”. The broadcast domain is a single local area network, or LAN, segment on a switch.
A broadcast domain, or LAN, is the basic unit of a network. Here, computers can communicate directly with each other by using the physical address, or MAC address. Since physical addresses are not routable, meaning they cannot be accessed directly from one network to another one, all communication done at the MAC level must be done on the same LAN. Communications on the MAC level require ARP broadcasting. Broadcasting requires sending communication packets to every device on the network in order to identify who is on the network. Large amount of broadcast traffic will depredate the network’s performance. This is why the term “broadcast domain” is used to identify the LAN, or basic network unit.
Returning full-circle to the subject of subnetting, the size of the most common subnet is 8 bits, though networks can be larger or smaller than that.
Subnets have both a beginning and an end. The beginning number, known as the “Network ID” is always even and the ending number, known as the “Broadcast ID”, is always odd. When creating subnets, you are not allowed to use these numbers because they are reserved. Why are they reserved? Because they have special meaning in the network. The Network ID is the designation for the network that you are referring to. When
Página 57 de 135
you use the Network ID, you are referring to the network itself. The subnet mask defines the size of the network. The Broadcast ID is the broadcast number that you would refer to if you wanted to communicate with every device on the network.
Review of Key Points: The term subnet refers to a small network within a larger one. A broadcast domain is a single local area network or segment between routers. Subnets begin with the Network ID and end with the Broadcast ID.
Characteristics of “Classful” Subnets
Subnet masks allow you to see where the “endpoints” of the subnet are on any given IP address within the subnet. This is done through a process known as “ANDing”. In order to AND, you must first have two pieces of information – the IP address, and the subnet mask.
Computers perform the ANDing process to determine if the destination computer is on the local network or a different network.
There are only 4 results of ANDing:
0 and 0 = 0
0 and 1 = 0
1 and 0 = 0
1 and 1 = 1
Ok, so let’s assume that you have an IP address of 192.168.62.14 and a subnet mask of 255.255.248.0, and it wants to communicate with a host with the IP address of 192.168.65.1. The process of ANDing provides for the following outcome:
This process shows that the computers are on separate networks. The source computer is on network ID 192.168.56.0 and the destination computer is on network ID 192.168.64.0.
Review of Key Points: Anding is used when a host wishes to know if it can communicate with a destination node. This is done in three steps:
Página 58 de 135
1. The host takes its on IP address and ANDs it with its own subnet mask, producing a result.2. The host takes the destination node IP address and ANDs it with its own subnet mask, producing a second
result.3. The host compares the two results. If the results are the same, the host can communicate directly with the
destination node on the same network. If the results are dissimilar, the host knows that the destination node is not on the same network, and communications to this node will be sent to the hosts default gateway.
Breaking up Networks
Subnetting can be taken a step further in order to break up large networks. This is accomplished by adding more bits to the default subnet mask. In other words, you can take bits away from the host portion of the subnet mask and assign them as part of the subnet mask.
To calculate the number of subnets or nodes, use the formula (2n-2) where n = number of bits in either field, and 2n represents 2 raised to the nth power.
In the example above, a 3-bit subnet mask is applied to the default Class B subnet mask of 255.255.0.0 to create a new subnet mask of 255.255.224.0. There are 6 (23-2) subnets available with this size mask. Remember to subtract out 2 for the network ID and Broadcast ID reserved addresses. Each subnet has 8190 (213-2) nodes. Each subnet can have nodes assigned to any address between the subnet address and the broadcast address. This gives a total of 49,140 nodes for the entire class B address using the new subnet.
Página 59 de 135
One thing that should strike your attention is the total number of addresses available for this network. A default Class B network (not subnetted in this manner) has over 65,000 addresses. The process of subnetting always reduces the total number of possible addresses, or in other words, there is a cost to the convenience of subnetting.
Classless InterDomain Routing (CIDR)
Can you believe the nerve of some people? There are more devices in the world that need IP addresses to communicate than there are IP addresses. And when people know this fact, can you believe they are still going to seedy Internet-based shopping sites and buying even more devices which require IP addresses? Don’t they know there’s not enough IP addresses to go around?
CIDR was invented some years ago to help alleviate the strain on the number of IP addresses available under IPV4. After all, the classful system of assigning IP addresses was very wasteful. If you were a small or medium business, you might be able to use all the IP addresses in a Class C address range. But how many small and medium businesses exist in the world compared to the number of possible Class C addresses ranges? (The Internal Revenue Service estimated there were 29.3 million nonfarm business tax returns filed in 2004, and as we learned above, there are just over 2 million network licenses for all of Class C) Lastly, there but how many Class A addresses do you think are actually assigned to devices? After all, how many organizations can use 1.7 million IP addresses anyway (besides the government)?
In 1992, Supernetting (or “slash” notation, or CIDR) was proposed as a means to handle this issue. CIDR uses a subnet mask to show where the line is drawn between host ID and network ID.
CIDR is sometimes called “slash” notation, or properly CIDR notation, because the subnet mask is expressed as a “/n” behind the network address as a means to describe the subnet mask. The “n” in /n is the number of bits used for the network ID.
Where’s My Class?
Because CIDR was intended to make better use of the IP address space, the classes (Class A, Class B, Class C, etc.) are obsolete. Therefore, since there are no address classes in CIDR, you cannot readily identify the size of the network ID of an IP address by only looking at the IP address.
How it works
CIDR works by “borrowing” bits from the host ID portion of the IP address. Let’s take a look at the address 192.168.12.0/23. Right off, the /23 tells us that we are going to take 23 bits from the binary IP address starting at the left-most portion of the IP address.
Review of Key Points: CIDR was created to allow for better use of IP addresses. CIDR is also known as supernetting or slash notation. There are no classes in CIDR (hence the term classless).
How CIDR is calculated
So, the first octet contains 8 bits. The second octet contains an additional 8 bits, making it a total of 16 bits. Since we want to use a total of 23 bits, we need to “borrow” 7 additional bits from the next octet. This is
Página 60 de 135
illustrated in the drawing above by coloring the 23 bits we are using green. That leaves us 9 bits for the host IDs, meaning the one unused bit in the 3rd octet and the 8 bits in the 4th octet.
So, how do we determine our IP address range for this subnet? We know the starting position – 192.168.12.0. The easiest way to determine the ending position is to count the number of unused bits in the 3rd octet. In this example, there is one unused bit in the “1” position. So, we know that 12 + 1 = 13. The answer is 192.168.12.0 – 192.168.13.255. The 255 is the easiest to figure, because we are going to use all of the available bits in the 4th
octet. The illustration below helps depict this.
Also, notice how the subnet mask of 255.255.254.0 is determined the same way. All the bits in the 3rd octet are used but the last bit, so 255 – 1 = 254.
So, the remaining question is how many possible hosts do you have for the /23 subnet? In calculating how many hosts you have left, you take the number of unused bits and add them to this formula: (2^n)-2
Therefore, if you had a network which was 192.168.12.0/23, you would be using the following bits:
How CIDR is calculated
Página 61 de 135
The first 23 bits (colored in green) are used for the network ID. The remaining bits are used for the host ID. Notice that there are 9 bits not colored in green. This nine becomes the “n” used in the formula (2^n)-2. So the answer to the question of how many hosts are available in 192.168.12.0/23 is
Therefore, you have a possible 510 hosts for a /23 subnet. Now that you know the logic behind CIDR and know how to figure out the math, below is a chart of all the possible combinations of CIDR for easy reference.
Página 62 de 135
This table illustrates some interesting facts. The most obvious one to me at first glance is that every time the number of bits used for the network ID increased by one, the number of available hosts is reduced by slightly more than half. This makes sense when considered against what we have already learned – there is always a cost associated with subnetting.
Review of Key Points: CIDR allows you to take better advantage of limited IP addresses. For practice sake, let’s go over this one more time.
Let’s take the following subnet – 10.100.20.0/18. This tells us that we are going to use the first 18 bits as the network ID and the remaining 14 bits as the host IDs.
Remember how you arrive at the ending subnet range of 10.100.83.255. You have 6 unused bits in the 3rd octet. 00111111 = 63 (You can check this by adding the two used bits, the 8th position (128) and the 7th position (64) to the 63 to equal 255 (128+64+63 = 255). So, 10.100.20 (plus 63) = 10.100.83. You will use all the bits in the 4th octet, so the final number is 10.100.83.255.
To figure out the number of available host IDs, you use the same formula as above.
Página 63 de 135
How does it work?
CIDR works its magic because enterprise routers are designed to support it. CIDR requires the network segments involved to be contiguous (numerically adjacent) in the address space. CIDR cannot, for example, aggregate 10.100.20.0 and 10.100.83.0 into a single route and somehow skip over or not include an intermediate range such as 10.100.30.0 and 10.100.31.0 address ranges (such as 10.100.20.0/18 example above).
It is highly unlikely that consumer routers will be designed to handle CIDR since it is generally an unnecessary cost to add that functionality.
Conclusion
Subnetting might not be something that comes easily to you, but it’s not terribly difficult either. Yes, there is some math involved, but the math is relatively simple and if you practice a few times, the logic will begin to make sense.
Of course, IPV4 will become a thing of the past as IPV6 becomes more commonplace. But that’s a discussion for another day. I hope this has been beneficial for you. You are welcome to contact me at [email protected] for additional help. Check out our tutorials, blog entries, and user comments for additional ideas.
Página 64 de 135
http://learn-networking.com/network-design/how-to-subnet-a-network
Two Important Equations to Remember:
1. Usable Subnets = (2^n) – 2 , where N = power of bits assigned 2. Usable Hosts = (2^n) – 2 , where N = power of bits remaining
Let’s start with usable subnets. Review the diagram below for a visual example.
If you are wondering what the “-2” part of the equation is for, this is how we account for the two addresses in each subnet we can’t use. We will review what these addresses are for more specifically later on. For now, let’s find out what our usable hosts are!
Alright Already! What’s My Subnet Mask?!
Getting your subnet mask at this point is incredibly easy. Simply take all of your network bits, and add them up. Look at the diagram below for a visual guide.
Página 65 de 135
That’s it! You’re done. You have successfully created a subnet mask that can be used on the school’s network. Keep in mind that every computer must have the subnet mask set in order for them to be on the same network. Also note that since we are using a class C network, the first three octets will always be 255. When subnetting other classes, be sure to keep the network portions in mind.
Closing Comments
Subnetting may not be fun, but it is required for students to know on networking exams. That means you should stay away from subnet calculators until you have grasped the full concept of how to do it yourself. These calculators should only be used as a time saving tool, not a learning tool or way to cheat on homework.
With enough practice, subnetting will become much easier. Class A and Class B networks are a bit trickier, but follow the same example as shown above and it should be quite easy to accomplish.
Página 66 de 135
http://consulteach.com.ar/Publicacion.asp?codGrupo=58
Capacitación\RECURSOS\Direccionamiento IP\ IANA
http://www.iana.org
DIRECCIONES IPv4
Dada la enorme cantidad de usuarios y servidores, se requiere de un mecanismo que permita identificar al remitente y al destinatario de las comunicaciones en Internet. Esa clave de localización en la red, son las direcciones IP.
Para que dos hosts ubicados en cualquier parte del mundo, puedan comunicarse, es necesario que se encuentren unívocamente identificados mediante una dirección IP.
Dos computadoras no pueden tener una misma dirección IP. Las computadoras utilizan “1” y “0” para representar letras, números y todo tipo de información (“piensan” en binario).
Con el objetivo de hacer que esa dirección sea más cómodamente legible por los seres humanos, se acostumbra dividirla en 4 grupos de 8 bits (octetos o bytes), separados por puntos.
Entonces, cada octeto podrá tomar valores decimales desde el 0 (correspondiente a la combinación binaria 00000000), hasta el 255 (correspondiente a la combinación binaria 11111111). Es decir, desde el 0.0.0.0 hasta el 255.255.255.255.
Para visualizar un esquema de formación de las direcciones IPv4, ejecutar el siguiente archivo pps:
direccionesIP.pps
CLASES DE DIRECCIONES IP (CLASSFUL)
Las direcciones con clase (Classfull) corresponden al esquema de segmentación original (RFC 791) de las direcciones de 32 bits en clases específicas, en las que quedan identificados la numeración de la red y la numeración del host dentro de esa red.
Los primeros bits (comenzando por la izquierda) de una dirección IP Classfull identifican la clase a la que pertenece dicha dirección, y quedan automáticamente determinados la cantidad de bits que corresponden a la red y al host.
Si el primer bit de una dirección IP es “0”, dicha dirección pertenece a la clase A. En consecuencia, el primer octeto (los 7 bits restantes) identifica a la red (NET ID), y los últimos 3 octetos identifican al host (HOST ID).
Si el primer bit es “1”, y el siguiente “0”, dicha dirección pertenece a la clase B. En consecuencia, los dos primeros octetos (los 15 bits restantes) identifican a la red (NET ID), y los últimos 2 octetos identifican al host (HOST ID).
Página 67 de 135
Si los dos primeros bits son “1”, y el siguiente “0”, dicha dirección pertenece a la clase C. En consecuencia, los tres primeros octetos (los 23 bits restantes) identifican a la red (NET ID), y el últimos octeto identifica al host (HOST ID).
Las direcciones IP cuyos primeros 3 o 4 bits son “1”, están reservadas para usos especiales.
REDES MAYORES
Las direcciones sin clase (Classless) permiten la utilización completa de todo el rango de direcciones, sin ningún tipo de reserva de bits para identificar diferentes categorías o clases.
En la figura se muestra el octeto que corresponde al NETID de cada clase. También es posible entonces, transgredir dichas fronteras para dar lugar a direcciones y direccionamientos que quedan definidos (en sus NETID y HOSTID) exclusivamente por la Máscara de red (o Mascara de Subred).
Cuando se “roban” bits (hacia la derecha), que de acuerdo con la máscara natural de la clase pertenecen al HOSTID para asignarlos a la NETID, se dice que estamos realizando subnetting.
Si por el contrario, mediante un prefijo y una máscara, se “integran” en un bloque una cantidad de direcciones de una o más clases, se realiza supernetting o CIDR (Classless Inter Domain Routing).
Página 68 de 135
Si se trabaja en actividades de subnetting, debe buscarse el “octeto interesante”, moviéndonos hacia la derecha, es decir aquel en el que se “roban” bits a los hosts para asignarlos a la subnet.
Si se trabaja en actividades de supernetting (sumarización y CIDR), el “octeto interesante” seria, moviéndonos hacia la izquierda para agrupar redes.
Subnetting [1 bit y 2 bits]
Las redes IP pueden ser divididas en redes más pequeñas denominadas subredes (Subnetting: RFC950).
Este procedimiento provee al administrador varios beneficios, incluyendo la flexibilidad, el uso eficiente de las direcciones de red y la capacidad de contener el tráfico broadcast (el broadcast no atraviesa al router).
Las subredes se encuentran bajo una administración local, y como tales el resto del mundo ve a la organización como una red única, sin conocer los detalles de la estructura interna. Una dirección de red puede ser dividida en varias subredes. Una dirección de subred se crea "robando" bits del campo de host para asignarlos al campo de subred.
El número de bits "robado" es variable, y se especifican en la máscara.
En la figura se muestra el “octeto interesante” de una dirección (sin importar si la dirección es de clase A, B ó C). En ese octeto, se avanza un bit sobre la parte de la dirección correspondientes a los hosts (la máscara es entonces /9 para la clase A, /17 para la clase B, y /25 para la clase C).
Y se muestra como se generan dos subredes a partir de la original.
De la misma manera, si se avanza dos bits sobre la parte de la dirección correspondientes a los hosts (la máscara es entonces /10 para la clase A, /18 para la clase B, y /26 para la clase C), se generan cuatro
Página 69 de 135
subredes a partir de la original.
Ver la Tabla Generalizada de Direcciones IP
Subnetting [3 bits y 4 bits]
Profundizando la penetración sobre los bits correspondientes a los hosts, se muestra el subnetting con tres y cuatro bits, formándose 8 y 16 subredes, respectivamente.
Asimismo, se muestran los rangos de direcciones de cada una de las subredes generadas.
Desde el punto de vista de la dirección, una subred es una extensión del número de red. Los administradores de red determinarán el tamaño de subred en función de las necesidades. La recomendación de no utilizar la primera (todos “0”) y última (todos “1”) subred es obsoleta. La única restricción vigente es la de no utilizar todos “0” ó todos “1” en la parte de HOST ID.
Todos “0” corresponde a la dirección de la subred. Todos “1” corresponde a la dirección de broadcast de esa subred.
Ver la Tabla Generalizada de Direcciones IP
Página 70 de 135
Subnetting direcciones clase C
Las tablas de la figura facilitan el subnetting de las direcciones de clase C.
La tabla superior muestra la máscara (cuarto octeto), el índice correspondiente, la cantidad de subredes y hosts, y el total de hosts en todas las subredes. Además, la potencia de 2, que indica el factor de multiplicación de las subredes.
Nótese como el número total de hosts en todas las subredes va disminuyendo a medida que se generan mayor cantidad de subredes porque cada subred contiene dos direcciones inválidas para ser asignadas a los hosts (la de la red y la de bc).
En la tabla inferior se indican las direcciones de las subredes generadas a partir de una máscara (se indica el índice) determinado.
Por ejemplo, si tomáramos la red de clase C 192.168.1.0/24, y la subneteáramos con una máscara 255.255.255.224.
Tenemos que corresponde al índice /27, y que las subredes son múltiplos de 32. Que se forman 8 subredes con un máximo de 30 direcciones disponibles, cada una.
Lo que totaliza una disponibilidad de 240 direcciones asignables (todo esto sale de la tabla superior).
Si quisiéramos conocer cuales son las direcciones de cada una de las 8 subredes, lo podemos obtener del cuadro inferior (para /27: 192.168.1.0, 192.168.1.32, 192.168.1.64, 192.168.1.96, 192.168.1.128, 192.168.1.160, 192.168.1.192 y 192.168.1.224).
También puede verse el mismo resultado en la “torta” dividida con una profundidad de 3 bits (8 subredes)
Página 71 de 135
Subnetting direcciones clase B
Las tablas de la figura facilitan el subnetting de las direcciones de clase B.
La tabla superior muestra la máscara (cuarto octeto), el índice correspondiente, la cantidad de subredes y hosts, y el total de hosts en todas las subredes.
Además, la potencia de 2, que indica el factor de multiplicación de las subredes.
Nótese como el número total de hosts en todas las subredes va disminuyendo a medida que se generan mayor cantidad de subredes porque cada subred contiene dos direcciones inválidas para ser asignadas a los hosts (la de la red y la de bc).
En la tabla inferior se indican las direcciones de las subredes generadas a partir de una máscara (se indica el índice) determinado.
En la tabla inferior se indican las direcciones de las subredes generadas a partir de una máscara (se indica el índice) determinado.
Página 72 de 135
Por ejemplo, si tomáramos la red de clase B 130.25.0.0/16, y la subneteáramos con una máscara 255.255.192.0.
Tenemos que corresponde al índice /18, y que las subredes son múltiplos de 64. Que se forman 4 subredes con un máximo de 16382 direcciones disponibles, cada una. Lo que totaliza una disponibilidad de 65528 direcciones asignables (todo esto sale de la tabla superior).
Si quisiéramos conocer cuales son las direcciones de cada una de las 4 subredes, lo podemos obtener del cuadro inferior (para /27: 130.25.0.0, 130.25.64.0, 130.25.128.0 y 130.25.192.0).
También puede verse el mismo resultado en la “torta” dividida con una profundidad de 2 bits (4 subredes)
Tabla Generalizada de Direcciones IP
La Tabla Generalizada de Direcciones IP permite:
a) Encontrar todas las subredes para cualquier esquema de subnetting dado (Subnetting)
b) Trabajar con máscaras de subred o índices de subred.
c) Encontrar las máscaras o índices que satisfagan un determinado conjunto de redes (Supernetting).
d) Encontrar los bits de wilcard de la máscara inversa de Cisco para las ACLs.
Conversiones binario a decimal, y decimal a binario en el rango 0 a 255
Página 73 de 135
http://www.certprepare.com/forum/index.php?showtopic=3
You have a Class C address of 192.168.100.0 /24. Your company requires to use nine subnets. What is the IP plan of network numbers, broadcast numbers, and valid host numbers? What is the subnet mask needed for this plan?
Solution:
First, determine how many H (host) bits you need to borrow to create nine valid subnets, using the formula:
2N>=9 (N are the network bits)
N = 4 so you need to borrow 4 H bits and turn them into N bits and you will have 24=16 networks
Because the network mask is /24 = 11111111.11111111.11111111.00000000 (in binary form) = 255.255.255.0 (in decimal form) so we need to take host bits from the last octet. Let's consider our last octet:Initial state:HHHHHHHH (8 host bits)Borrowed state:NNNNHHHH (4 network bits, 4 host bits)
So our subnetwork mask is 11111111.11111111.11111111.11110000 -> 192.168.100.0 /28
From 11110000, we should take care of the last "1" bit because it will give us information about the increment. See the picture below to understand how:
So we figured out the increment is 16, now we can create our sub-network list:
1st subnet-work: 192.168.100.0/282nd subnet-work: 192.168.100.16/283rd subnet-work: 192.168.100.32/284th subnet-work: 192.168.100.48/285th subnet-work: 192.168.100.64/28
Página 74 de 135
6th subnet-work: 192.168.100.80/287th subnet-work: 192.168.100.96/288th subnet-work: 192.168.100.112/289th subnet-work: 192.168.100.128/2810th subnet-work: 192.168.100.144/2811st subnet-work: 192.168.100.160/2812nd subnet-work: 192.168.100.176/2813rd subnet-work: 192.168.100.192/2814th subnet-work: 192.168.100.208/2815th subnet-work: 192.168.100.224/2816th subnet-work: 192.168.100.240/28
Página 75 de 135
http://xentron.blogspot.com/
Ejercicio Completo de Subnetting
Ejercicio Completo de Subnetting con VLSM.
En este ejercicio se describe los pasos necesarios para aplicar subnetting a un direccion IP de Clase C, asi como las configuraciones respectivas en el escenario de la red realizado con Packet Tracert 5.2.
Enunciado: Dado la siguiente topologia y direccion IP 192.168.1.0/24. Mediante subnetting con VLSM obtengamos direccionamiento IP para los Hosts de TRES subredes (Red 1: 20 hosts, Red 2: 100 hosts y Red 3: 50 hosts), las interfaces Ethernet de los Routers y los Enlaces seriales entre los Routers.
Para acelerar los calculos utilizamos la siguiente tabla (es valida solo para Redes Clases C):
La tabla general es la siguiente:
Informacion: Antes de iniciar con los calculos inicie con la subred que necesite mayor cantidad de Hosts.
Calculo para la Red 2: Se necesitan 100 hosts.
Trabajo con la subred: 192.168.1.0/24.
De la informacion anterior tomamos el valor de n=1 para la Tabla de Subnetting (primera fila "Bits prestados"), ontendremos un valor de 128 (segunda fila "Variacion de subredes") es decir se tendra 128 saltos.
Las nuevas redes son las siguientes:
Página 76 de 135
1. Red valida: 192.168.1.0/25.2. Red valida: 192.168.1.128/25.3. Red invalida: 192.168.1.256/25.
Con la red 192.168.1.0/25 cumplimos el requerimiento de los 100 hosts.
El direccionamiento final seria el siguiente (los .. significan que existen mas direcciones):
Direccion de Red: 192.168.1.0
Primer Hosts de Red: 192.168.1.1
Gateway de la Red: 192.168.1.126
Broadcast de la Red: 192.168.1.127
Calculo para la Red 3: Se necesitan 50 hosts.
Trabajo con la subred: 192.168.1.128/25.
Las nuevas redes son las siguientes:
1. Red valida: 192.168.1.128/26.2. Red valida: 192.168.1.192/26.3. Red invalida: 192.168.1.256/26.
Con la red 192.168.1.128/26 cumplimos el requerimiento de los 50 hosts.
El direccionamiento final seria el siguiente:
Direccion de Red: 192.168.1.128Primer Hosts de Red: 192.168.1.129Gateway de la Red: 192.168.1.190Broadcast de la Red: 192.168.1.191
Calculo para la Red 1: Se necesitan 20 hosts.
Trabajo con la subred: 192.168.192/26
Página 77 de 135
Las nuevas redes son las siguientes:
1. Red valida: 192.168.1.192/27.2. Red valida: 192.168.1.224/27.3. Red invalida: 192.168.1.256/27.
Con la red 192.168.1.192/27 cumplimos el requerimiento de los 20 hosts.
El direccionamiento final seria el siguiente:
Dirección de Red: 192.168.1.192Primer Hosts de Red: 192.168.1.191Gateway de la Red: 192.168.1.222Broadcast de la Red: 192.168.1.223
Calculo para las Interfaces Seriales de los Routers: Se necesitan 2 hosts.
Trabajo con la subred: 192.168.1.224/27
Las nuevas redes son las siguientes:
1. Red valida: 192.168.1.224/30.2. Red valida: 192.168.1.228/30.3. Red valida: 192.168.1.232/30.4. Red valida: 192.168.1.236/30.5. Red valida: 192.168.1.240/30.6. Red valida: 192.168.1.244/30.7. Red valida: 192.168.1.248/30.8. Red valida: 192.168.1.252/30.9. Red invalida: 192.168.1.256/30.
Con la red 192.168.1.224/30 cumplimos el requerimiento de los 2 hosts, con las direcciones sobrantes se cubren para los otros routers.
El direccionamiento final sería el siguiente:
Dirección de Red: 192.168.1.224Página 78 de 135
Direccion para la Interfaz Serial 0 del Router 0: 192.168.1.225Direccion para la Interfaz Serial 0 del Router 1: 192.168.1.227Broadcast de la Red: 192.168.1.228
Resultado final: En la siguiente imagen se puede apreciar el escenario completo con las direcciones IP de algunos Hosts y de los Routers según las Subredes seleccionadas.
Codigos de programacion de los Routers:
Se incorpora la informacion base para la comunicación de los diferentes dispositivos en la red.
Configuraciones Route r0:
Router>enableRouter#configure terminalRouter(config)#hostname Router0Router0(config)#banner motd *Acceso prohibido. Derechos reservados Xentron 2010*Router0(config)#enable secret ciscoRouter0(config)#line console 0Router0(config-line)#password ciscoRouter0(config-line)#loginRouter0(config-line)#exitRouter0(config)#line vty 0 4Router0(config-line)#password cisco
Página 79 de 135
Router0(config-line)#loginRouter0(config-line)#exitRouter0(config)#interface fastEthernet 0/0Router0(config-if)#ip address 192.168.1.222 255.255.255.224Router0(config-if)#description Conexion hacia la Red LocalRouter0(config-if)#no shutdownRouter0(config-if)#exitRouter0(config)#interface serial 2/0Router0(config-if)#ip address 192.168.1.225 255.255.255.252Router0(config-if)#description Conexion hacia el Router1Router0(config-if)#no shutdownRouter0(config-if)#exitRouter0(config)#exitRouter0#show cdp neighborsRouter0#show controllers serial 2/0Router0#show ip interface briefRouter0#show ip routeRouter0#configure terminalRouter0(config)#ip route 192.168.1.126 255.255.255.128 192.168.1.226Router0(config)#ip route 192.168.1.190 255.255.255.192 192.168.1.226Router0(config)#exitRouter0#show running-configRouter0#copy running-config startup-configRouter0#show startup-configRouter0#
Configuraciones Router 1:
Router>enableRouter#configure terminalRouter(config)#hostname Router1Router1(config)#banner motd *Acceso prohibido. Derechos reservados Xentron 2010*Router1(config)#enable secret ciscoRouter1(config)#line console 0Router1(config-line)#password ciscoRouter1(config-line)#loginRouter1(config-line)#exitRouter1(config)#line vty 0 4Router1(config-line)#password ciscoRouter1(config-line)#loginRouter1(config-line)#exitRouter1(config)#interface fastethernet 0/0Router1(config-if)#ip address 192.168.1.126 255.255.255.128Router1(config-if)#description Conexion hacia la Red LocalRouter1(config-if)#no shutdownRouter1(config-if)#exitRouter1(config)#interface serial 2/0Router1(config-if)#ip address 192.168.1.226 255.255.255.252Router1(config-if)#description Conexion hacia el Router0Router1(config-if)#clock rate 56000Router1(config-if)#no shutdownRouter1(config-if)#exitRouter1(config)#interface serial 3/0Router1(config-if)#ip address 192.168.1.229 255.255.255.252
Página 80 de 135
Router1(config-if)#description Conexion hacia el Router2Router1(config-if)#clock rate 56000Router1(config-if)#no shutdownRouter1(config-if)#exitRouter1(config)#ip route 192.168.1.192 255.255.255.224 192.168.1.225Router1(config)#ip route 192.168.1.128 255.255.255.192 192.168.1.230Router1(config)#exitRouter1#show running-configRouter1#copy running-config startup-configRouter1#show startup-configRouter1#
Configuraciones Router 2:
Router>enableRouter#configure terminalRouter(config)#hostname Router2Router2(config)#banner motd *Acceso prohibido. Derechos reservados Xentron 2010*Router2(config)#enable secret ciscoRouter2(config)#line console 0Router2(config-line)#password ciscoRouter2(config-line)#loginRouter2(config-line)#exitRouter2(config)#line vty 0 4Router2(config-line)#password ciscoRouter2(config-line)#loginRouter2(config-line)#exitRouter2(config)#interface fastEthernet 0/0Router2(config-if)#ip address 192.168.1.190 255.255.255.192Router2(config-if)#description Conexion hacia la Red LocalRouter2(config-if)#no shutdownRouter2(config-if)#exitRouter2(config)#interface serial 2/0Router2(config-if)#ip address 192.168.1.230 255.255.255.252Router1(config-if)#description Conexion hacia el Router1Router2(config-if)#no shutdownRouter2(config-if)#exitRouter2(config)#ip route 192.168.1.192 255.255.255.224 192.168.1.229Router2(config)#ip route 192.168.1.0 255.255.255.128 192.168.1.229Router2(config)#exitRouter2#show running-configRouter2#copy running-config startup-configRouter2#show startup-configRouter2#
Página 81 de 135
Buscar la dirección de broadcast de la subsred 173.16.26.0/23
Esta calculadora calculará la dirección de red, la dirección del host y la dirección de difusión de una determinada dirección TCP / IP y la máscara de subred.
Estos cálculos son en realidad bastante sencillo. La forma más sencilla de hacerlo es para representar tanto la dirección IP y la máscara de subred en binario. Tome 173.16.26.0 con máscara de subred 255.255.254.0 enumerados en binario:
Dirección IP: 10101101.00010000.00011010.00000000 máscara de subred: 11111111.11111111.11111110.00000000
Si un binario Y entre estos dos números, se obtiene la dirección de red:
Dirección IP: 10101101.00010000.00011010.00000000 máscara de subred: 11111111.11111111.11111110.00000000 Y ----------------------------------- dirección de red: 10101101.00010000.00011010.00000000
lo que se tradujo de nuevo a la notación decimal con puntos es 173.16.26.0
Para obtener la parte del host, invertir la máscara de subred y otra vez realizar un binario y con la dirección IP:
Dirección IP: 10101101.00010000.00011010.00000000 máscara de subred invertida: 00000000.00000000.00000001.11111111 Y ----------------------------------- porción de host: 00000000.00000000.00000000.00000000
lo que se tradujo de nuevo a la notación decimal con puntos es 0.0.0.0
Para obtener la dirección de difusión, de nuevo es el más simple de verlo en binario. Tome la máscara de subred invertido y hacemos un XOR binario con la dirección de red:
dirección de red: 10101101.00010000.00011010.00000000 máscara de subred invertida: 00000000.00000000.00000001.11111111 ----------------------------------- XOR dirección de difusión: 10101101.00010000.00011011.11111111
lo que se tradujo de nuevo a la notación decimal con puntos es 173.16.27.255
Operaciones Binarias
En lo que sigue se adopta como convención la lógica positiva, lo que implica:verdadero = 1 = activo, ------, falso = 0 = inactivoHay cinco operaciones binarias básicas: AND, OR, NOT, XOR y ADD. La resta, multiplicación y división se derivan de estas cinco anteriores. Cualquiera sea la longitud de la palabra o palabras objeto de la operación, siempre se hace de a un bit por vez de derecha a izquierda (tal como si fuera una suma o resta con números decimales). Esto permite una definición de cada operación que es independiente de la longitud del o de los operando(s). La operación NOT es la única que se realiza sobre un sólo operando (es unaria), y las otras cuatro sobre dos operandos.
La operación AND (Y) tiene resultado 1 si sus dos operandos son ambos 1 La operación OR (O) tiene resultado 1 si cualquiera de sus operandos es 1 La operación XOR tiene resultado 1 si los operandos son distintos (uno en 0 y el otro en 1)
Página 82 de 135
La operación NOT (NO) tiene resultado 1 si el operando es 0 y viceversa La operación ADD (SUMA) se define igual que con los números decimales
AND OR XOR NOT SUMA
0 * 0 = 0 0 + 0 = 0 0 X 0 = 0 NOT 1 = 0 0 + 0 = 0
0 * 1 = 0 0 + 1 = 1 0 X 1 = 1 NOT 0 = 1 0 + 1 = 1
1 * 0 = 0 1 + 0 = 1 1 X 0 = 1 --- 1 + 0 = 1
1 * 1 = 1 1 + 1 = 1 1 X 1 = 0 --- 1 + 1 = 10
Página 83 de 135
Página 84 de 135
Página 85 de 135
http://juanfelipe.net/node/55
VLANs, ejercicio práctico con Swiches y Routers CISCO
::[INTRO]::
Una vez más frente a los routers CISCO. Esta vez la película va de como realizar configuraciones en enrutadores y
swiches CISCO, en especial, lo referente a enlaces WAN, LAN y VLANs.
Este problema me lo encontré en el Politécnico Colombiano Jaime Isaza Cadavid y aquí le doy solución para futura
referencia.
Las herramientas que serán utilizadas para desarrollar este problema incluye el Packet Tracer de CISCO.
::[PROBLEMA]::
La empresa OTEON S.A. ha sido seleccionada para la implementación y configuración de la red LAN y WAN de la
empresa XYZ, la cual tiene como sedes las ciudades de Medellín y Bogotá, para esta implementación se ha dado la
mayor autonomía en la creación del direccionamiento IP bajo ciertos parámetros exigidos por la compañia,
adicionalmente se solicita tener en cuenta las siguientes variables:
1. Configurar el enlace WAN entre las sedes de Bogotá y Medellín, adicionalmente tener en cuenta las siguientes
recomendaciones:
o El enrutamiento debe ser estático.
o El enlace WAN no debe superar mas de 2 host.
2. La ciudad de Medellín debe tener tres VLANs creadas para: Usuarios, Proveedores, y Visitantes, las cuales
deben ser repartidas de la siguiente manera:
o Todo el direccionamiento debe ser entregado por la empresa OTEON S.A.
o La VLAN de usuarios debe tener capacidad para un máximo de 255 hosts.
o La VLAN de proveedores no puede superar más de 16 hosts.
o la VLAN de visitantes no puede superar más de 16 hosts.
o La sede deber tener dos swiches, en el primero deben estar conectados los usuarios, en el segundo los
proveedores y visitantes.
3. La ciudad de Bogotá debe tener dos VLAN creadas para: Usuarios y Servidores, las cuales deben ser
repartidas de la siguiente manera:
o Todo el direccionamiento debe ser entregado por la empresa OTEON S.A.
o La VLAN de usuarios debe tener capacidad para un máximo de 255 hosts.
o La VLAN de servidores no puede superar más de 16 hosts.
o Solo debe existir un swiche.
4. Todos los PC deben comunicarse con cada una de las áreas creadas.
Página 86 de 135
5. La empresa OTEON S.A. debe entregar todo el direccionamiento IP.
::[SOLUCION]::
Elementos de la topología:
Medellín:
o Un router (ROUTER-MED) conectando con Bogotá.
o Dos swiches:
SW-1: Swiche de usuarios (una VLAN).
SW-2: Swiche de proveedores y visitantes (dos VLANs - una para proveedores y otra para visitantes).
Bogotá:
o Un router (ROUTER-BOG) conectando con Medellín.
o Un swiche:
SW-1: Swiche de usuarios y servidores (dos VLANs - una para usuarios y otra para servidores).
Direccionamiento de enlace WAN (entre Medellín y Bogotá):
El numeral 1 nos dice que el direccionamiento en el enlace WAN no debe pasar de 2 hosts, por lo tanto voy a
seleccionar una dirección IP clase C, de la cual me queda el último octeto para direccionar hasta 2 hosts. Veamos:
o Dirección de red: 192.168.0.0.
o Máscara de subred: 255.255.255.0.
Para obtener máximo dos hosts de la dirección de red 192.168.0.0/255.255.255.0 necesito tomar del último octeto,
al menos 2 bits de host, ya que 2^2 - 2 = 2 Host. Veamos ese último octeto en binario:
R R R R R R H H
1 1 1 1 1 1 0 0
Por lo que me quedan 6 bits de subred:
11111100 en decimal equivale a 252. Por lo que la máscara de las subredes será 255.255.255.252. Ahora saquemos
las subredes:
256 - 252 = 4 (primera subred y tamaño del bloque).
Página 87 de 135
4 + 4 = 8 (segunda subred).
8 + 4 = 12 (tercera subred).
...
240 + 8 = 248 (subred número 63).
248 + 8 = 252 (subred numero 64, no válida).
Para simplificar voy a tomar la primera subred (192.168.0.4/255.255.255.252) para direccionar el enlace WAN entre
las dos ciudades.
Subred MáscaraPrimer
Host
Ultimo
HostBroadcast
192.168.0.4 255.255.255.252 192.168.0.5 192.168.0.6 192.168.0.7
Bien. Hasta este punto tenemos listo el númeral 1 del problema:
Router Interface Direccion IP
ROUTER-MED WAN 192.168.0.5/255.255.255.252
ROUTER-BOG WAN 192.168.0.6/255.255.255.252
Y solo nos gastamos 2 direcciones de Host de la subred. Tal cual como lo pedía el enunciado.
Direccionamiento de Medellín:
El númeral 2 nos dice en la primera parte que la VLAN de usuarios debe tener capacidad para 255 hosts, por lo que
aquí basta con elegir cualquier dirección de red clase C a excepción de la subred 192.168.0.0/255.255.255.0 que ya
fue elegida para direccionar el enlace WAN entre las dos ciudades. Así que para no enredarme la vida voy a elegir la
dirección de red 192.168.1.0/255.255.255.0 para direccionar la VLAN de usuarios de la ciudad de Medellín.
Página 88 de 135
Subred MáscaraPrimer
Host Ultimo Host Broadcast
192.168.1.
0
255.255.255.
0192.168.1.1
192.168.1.25
4
192.168.1.25
5
En la segunda parte este mismo numeral nos dice que la VLAN de proveedores no debe superar más de 16 Hosts,
por lo que vuelvo a elegir otra dirección de red clase C y tomo 5 bits de hosts ya que 2^5 - 2 = 30. ¿Y porque no
tomo 4 bits de hosts ya que 2^4 = 16? Recordemos que la operación 2^y incluye restar al resultado el número 2,
por lo que si elijo 2^4 - 2 = 14 host, lo cual no cumple con el requerimiento del enunciado.
Por comodidad voy a elegir el siguiente segmento IP clase C:
Dirección de red: 192.168.2.0.
Máscara de subred: 255.255.255.0
Voy a tomar del último octeto 5 bits de host para obtener 30 host por subred. Veámos este octeto en binario:
R R R H H H H H
1 1 1 0 0 0 0 0
Por lo que me quedan 3 bits para subred.
Ahora, 11100000 en decimal equivale a 224. Por lo que la máscara de subred será 255.255.255.224. Saquemos las
subredes.
256 - 224 = 32 (primera subred y tamaño del bloque).
32 + 32 = 64 (segunda subred).
64 + 32 = 96 (tercera subred).
...
Para simplificar voy a tomar la primera subred (192.168.2.32/255.255.255.224) para direccionar la VLAN de
proveedores:
Página 89 de 135
Subred MáscaraPrimer
Host
Ultimo
Host
Broadcas
t
192.168.2.3
2
255.255.255.22
4
192.168.2.3
3
192.168.2.6
2
192.168.2.6
3
La tercera parte de este numeral nos pide que la VLAN de visitantes no puede superar más de 16 Hosts y para no
reptir el proceso anterior digamos que se tomó el segmento clase C 192.168.3.0 con máscara 255.255.255.0 y se le
hizo el mismo proceso de subnetting. Por lo que la siguiente tabla sumariza el proceso para la VLAN de usuarios.
Subred MáscaraPrimer
Host
Ultimo
Host
Broadcas
t
192.168.3.3
2
255.255.255.22
4
192.168.3.3
3
192.168.3.6
2
192.168.3.6
3
Direccionamiento de Bogotá:
La primera parte del numeral 3 nos dice que la VLAN de usuarios debe tener capacidad para un máximo de 255
hosts. Aquí vuelve y juega, seleccionamos una dirección de red clase C purita que no entre en conflicto con los
segmentos seleccionados para el direccionamiento de Medellín. Propongo entonces: 192.168.100.0/255.255.255.0
Subred MáscaraPrimer
Host
Ultimo
Host Broadcast
192.168.100.
0
255.255.255.
0192.168.100.1 192.168.100.254
192.168.100.25
5
La segunda parte del numeral 3 nos dice que la VLAN de servidores no puede superar más de 16 hosts, por lo que
aquí metemos otro gol diciendo que vamos a seleccionar una dirección de red clase C, digamos
192.168.101.0/255.255.255.0 y que pasando este segmento de red por un proceso de subnetting similar al de la
VLAN de proveedores para la ciudad de Medellín obtenemos:
Subred Máscara Primer Ultimo Broadcast
Página 90 de 135
Host Host
192.168.101.32 255.255.255.224 192.168.101.33 192.168.101.62 192.168.101.63
Tenemos hasta este punto todo el direccionamiento IP de las dos ciudades (Medellín y Bogotá) incluyendo el
direccionamiento del enlace WAN entre ambas ciudades.
Enlace WAN
Router Interface Direccion IP
ROUTER-MED WAN 192.168.0.5/255.255.255.252
ROUTER-BOG WAN 192.168.0.6/255.255.255.252
VLAN: 2 usuarios Medellín
Subred Máscara Primer Host Ultimo Host Broadcast
192.168.1.0 255.255.255.0 192.168.1.1 192.168.1.254 192.168.1.255
VLAN: 3 proveedores Medellín
Subred Máscara Primer Host Ultimo Host Broadcast
192.168.2.3
2
255.255.255.22
4
192.168.2.3
3
192.168.2.6
2
192.168.2.6
3
VLAN: 4 visitantes Medellín
Subred Máscara Primer Host Ultimo Host Broadcast
192.168.3.3 255.255.255.22 192.168.3.3 192.168.3.6 192.168.3.6
Página 91 de 135
2 4 3 2 3
VLAN: 2 usuarios Bogotá
Subred Máscara Primer HostUltimo
HostBroadcast
192.168.100.
0
255.255.255
.0192.168.100.1
192.168.100
.254
192.168.100
.255
VLAN: 3 servidores Bogotá
Subred MáscaraPrimer
Host
Ultimo
HostBroadcast
192.168.101.32 255.255.255.224 192.168.101.33 192.168.101.62 192.168.101.63
Nota: Vamos a seleccionar como puerta de enlace de cada subred (para las VLANs) la última dirección IP de host
disponible de cada subred:
Subred: 192.168.1.0, puerta de enlace: 192.168.1.254.
Subred: 192.168.2.32, puerta de enlace: 192.168.2.62.
Subred: 192.168.3.32, puerta de enlace: 192.168.3.62.
Subred: 192.168.100.0, puerta de enlace: 192.168.100.254.
Subred: 192.168.101.32, puerta de enlace: 192.168.101.62.
Topología
Página 92 de 135
Lista detallada de configuraciones
Aquí incluyo los comandos más importantes hechos sobre los dispositivos más importantes de la topología. Al final de
este artículo se encuentran los archivos de Packet Tracer con la topología totalmente configurada. Usted por analogía
debe extrapolar estos resultados hacia los dispositivos que no se detallan en las siguientes tablas.
ROUTER-MED (Router Medellín)
Comando Descripción
interface serial 0/0
Entro a la configuración de la interface serial 0/0. Esta
interface es la que hace el enlace con el router de la ciudad de
Bogotá.
ip address 192.168.0.5
255.255.255.252
Se le asigna la dirección IP y la máscara de subred a la
interface serial 0/0.
clock rate 64000
Ya que esta interface es el componente DCE de la
comunicación, nos toca establecer el reloj para la
sincronización de la interface serial con su extremo.
Página 93 de 135
interface FastEthernet 1/0.1
Creamos la interface virtual 1/0.1 a partir de la interface 1/0.
Recordemos que la interface 1/0 es la que está de cara a SW-
1.
encapsulation dot1q 2
Definimos la encapsulación que va a manejar la interface.
Como estamos hablando de VLANs definimos la encapsulación
802.1Q y a continuación definimos la VLAN a la que está
asociada esta sub-interface. En este caso la VLAN 2
(Usuarios). Recordemos que esta interface es una "troncal".
ip address 192.168.1.254
255.255.255.0
Definimos la dirección IP y la máscara de subred de cada
subinterface. Esta dirección IP que le asignamos es la que
corresponde con la VLAN 2 (Usuarios) en Medellín.
interface FastEthernet 1/0.2
Definimos la sub-interface para manejar la VLAN 3
(Proveedores) en Medellín y repetimos los mismos pasos
anteriores de acuerdo al direccionamiento seleccionado para
la VLAN 3.
encapsulation dot1q 3
ip address 192.168.2.62
255.255.255.224
interface FastEthernet 1/0.3
Definimos la sub-interface para manejar la VLAN 4 (Visitantes)
en Medellín y repetimos los mismos pasos que se hicieron
para la VLAN 2 de acuerdo con el direccionamiento
seleccionado para la VLAN 4.
encapsulation dot1q 4
Página 94 de 135
ip address 192.168.3.62
255.255.255.224
ip route 192.168.100.0
255.255.255.0 192.168.0.6
Definimos una ruta estática diciendo como alcanzar la subred
192.168.100.0 (VLAN Usuarios Bogotá) que están en la ciudad de
Bogotá. Aquí recordemos la sintaxis:
ip route <red destino> <mascara red destino> <puerta de enlace>
ip route 192.168.101.32
255.255.255.224 192.168.0.6
Definimos otra ruta estática diciendo como alcanzar la subred
192.168.101.32 (VLAN Servidores Bogotá) que está en la
ciudad de Bogotá.
SW-1 (Swiche - 1, Medellín)
Comando Descripción
SW-USUARIOS(config)#
interface fastEthernet 0/1
Ingresamos a la configuración de la interface Fasth Ethernet
0/1. Esta interface es la que está pegada directamente a
ROUTER-MED. Como esta interface va a transportar datos de
todas las VLANs de la ciudad de Medellín, hay que definirla
como una interface de tipo troncal para que agregue la
correspondiente encapsulación 802.1Q a las tramas Ethernet.
SW-USUARIOS(config-if)#
switchport mode trunk
Le decimos a la interface Fast Ethernet 0/1 que estará definida
como una interface de tipo troncal.
SW-USUARIOS(config)# vlan 2 Definimos la VLAN 2.
SW-USUARIOS(config-vlan)#
name USUARIOS
Le asignamos un nombre a la VLAN 2. En este caso le
asignamos el nombre USUARIOS.
SW-USUARIOS(config)#
interface fastEthernet 0/2
Entramos a la configuración del puerto Fast Ethernet 0/2 del
swiche. Es en este puerto en donde tenemos conectado el
equipo 192.168.1.1.
Página 95 de 135
SW-USUARIOS(config-if)#
swicth port mode access
Definimos que el puerto no es un puerto de "troncal" sino un
puerto de acceso.
SW-USUARIOS(config-if)#
switchport access vlan 2
Le decimos a la interface Fast Ethernet 0/2 que pernece a la
VLAN 2 creada previamente.
SW-USUARIOS(config)#
interface fastEthernet 0/3
Entramos a la interface Fast Ethernet 0/3 para decirle que
pertenece a la VLAN 2 como se hizo previamente con la
interface Fast Ethernet 0/2. Esta interface es la que conecta al
equipo 192.168.1.2 de la topología.
SW-USUARIOS(config)# vlan 3 Definimos en este Swiche la VLAN 3.
SW-USUARIOS(config-vlan)#
name PROVEEDORES
Definimos el nombre de la VLAN 3 pero no le asignamos
ninguna interface, solo la definimos.
SW-USUARIOS(config)# vlan 4 Definimos la VLAN 4.
SW-USUARIOS(config-vlan)#
name VISITANTES Definimos el nombre para la VLAN 4.
SW-USUARIOS(config)#
interface fastEthernet 0/4
Entramos a la configuración de la interface Fast Ethernet 0/4.
Esta interface es la que conecta el equipo 192.168.3.34 que
pertenece a la VLAN de visitantes.
SW-USUARIOS(config-if)#
swicth port mode access
SW-USUARIOS(config-if)#
switchport access vlan 4
Le decimos a la interface que pertenece a la VLAN 4 (la de
visitantes).
Página 96 de 135
SW-USUARIOS(config)#
interface fastEthernet 0/24
Esta interface también tiene un propósito especial: es la que
conecta a SW-1 con SW-2. Como esta interface está
interconectando a estos dos swiches, esta interface debe
configurarse de modo troncal para que pueda transportar los
datos de las VLANs entre ambos swiches.
SW-USUARIOS(config-if)#
switchport mode trunk
Definimos la interface de tipo "troncal". El proceso hay que
realizarlo exactamente igual en la interface Fast Ethernet 0/24
en SW-2.
Hasta aquí considero que es suficiente ilustrar el proceso de configuración de un Swiche y un Router. Con estas
explicaciones es suficiente para realizar las configuraciones de los dispositivos que faltan en la topología. Solo ajuste
los parámetros de acuerdo a las VLANs y al direccionamiento seleccionado.
::[ARCHIVOS]::
Archivo de la topología realizado en Packet Tracer 4.1:
o LAB-VLAN-1.rar (md5sum: eeed953ff8d2c6ce46cc387b3503dc5b *LAB-VLAN-1.rar)
Página 97 de 135
http://juanfelipe.net/node/53
5 preguntas para hacer subnetting de una dirección IP Clase C.
::[INTRO]::
Este post va de como hacer subnetting de direcciones IP de manera rápida. Este método me funciona bastante bien y
no tengo que enredarme mucho la vida con las famosas conversiones binario - decimal y visceversa. También me ha
funcionado muy bien para explicar subnetting en un abrir y cerrar de ojos. Eso si, valga la aclaración, este método es
un poco mecánico y vale la pena siempre y cuando usted comprenda bien de que va la pelicula del subnetting. Es más
creo que no es comprensible lo que se va a exponer a continuación si usted antes no ha comprendido por lo menos
que es una dirección IP, una máscara de subred y que es hacer subnetting en si mismo.
Lo expuesto en este post es una abstracción y traducción tomada de LAMMLE, Todd. CCNA Cisco Certified Network
Associate Study Guide. Fourth Edition.SYBEX.
::[A TOCAR]::
La vía rápida: Subnetting de una dirección IP clase C.
Página 98 de 135
Lo único que necesita saber para hacer subnetting de una dirección IP clase C es responder a estas simples 5
preguntas:
¿Cuantas subredes produce la máscara de subred elegida? (¿Cuantas subredes?).
¿Cuantas direcciones IP de hosts válidas por subred quedan disponibles? (¿Cuantos hosts por subred?).
¿Cuales son las subredes válidas?
¿Cual es la dirección broadcast de cada subred?
¿Cuales son las direcciones IP válidas de los hosts de cada subred?
En este punto entonces es necesario que usted esté familiarizado y memorice las siguientes potencias de 2.
Potencias de 2 que se deben memorizar.
2^1 = 2 2^2 = 4 2^3 = 8 2^4 = 16
2^5 = 32 2^6 = 64 2^7 = 128 2^8 = 256
Las respuestas a las cinco preguntas anteriores son las siguientes:
¿Cuantas subredes? 2^x - 2 = numero de subredes. Donde x es el número de bits enmascarados (del último octeto),
es decir, todos los bits que tengan el valor de 1 en la máscara: Por ejemplo: 11000000, el número de 1s en este
ejemplo nos da 2^2 - 2 subredes, lo cual daría como resultado 2 subereds en total.
¿Cuantos hosts por subred? 2^y - 2 = número de hosts por subred. Donde y es el número de bits no enmascarados,
es decir, todos los bits que tengan el valor de cero en la máscara. Por ejemplo: 11000000, el numero de 0s en este
ejemplo nos da 2^6 - 2 hosts, lo cual daría como resultado 62 hosts por subred.
¿Cuales son las subredes válidas? 256 - máscara de subred = tamaño del bloque o número base. Por ejemplo, 256 -
192 = 64. Entonces 64 es la primera subred. La siguiente subred sería el tamaño del bloque más el mismo: 64 + 64
= 128, (la segunda subred). Se continúa sumando el resultado al tamaño del bloque hasta que se alcance el valor de
la máscara de subred, el cual no sería una subred válida ya que tendría todos los bits en 1.
¿Cual es la dirección broadcast de cada subred? La dirección broadcast de cada subred son todos los bits de hosts
(del último octeto) puestos a 1. Lo cual corresponde al número inmediatamente anterior a la siguiente subred.
¿Cuales son las direcciones IP válidas de los hosts de cada subred? Los hosts válidos son los números entre las
subredes, omitiendo todos los 0s y todos los 1s.
Veámos todo este enredo con un simple ejemplo:
Ejemplo de práctica #1: 192.168.10.0/255.255.255.192 (/26)
Página 99 de 135
Dirección de red: 192.168.10.0
Máscara de subred: 255.255.255.0
Ahora respondamos las cinco preguntas anteriores:
¿Cuantas subredes? Ya que 192 incluye solo 2 bits en 1 (11000000), la respuesta debería ser: 2^2 - 2 = 2. (El menos
2 es la subred cuyos bits de máscara se encuentran todos encendidos y la subred cuyos bits de hosts se encuentran
todos apagados, las cuales no son subredes válidas por defecto).
¿Cuantos hosts por subred? Tenemos entonces que para el octeto de la máscara solo cuenta con 6 bits de hosts en
0, por lo cual la respuesta debería ser 2^6 - 2 = 62 Hosts.
¿Cuales son las subredes válidas? 256 - 192 = 64, la cual es la primera subred y también tamaño de bloque.
Seguimos sumando al tamaño del bloque el resultado anterior hasta alcanzar el valor de la máscara: 64 + 64 = 128
(la segunda subred). 128 + 64 = 192 alcanzamos el valor de la máscara pero esta no es una subred válida. Así que
las ubredes válidas son: 64 y 128.
¿Cual es la dirección broadcast de cada subred? Es el número justo antes del valor de la siguiente subred. La
dirección broadcast de la subred 64 es 127 y la dirección broadcast de la subred 128 es 191.
¿Cuales son las direcciones IP válidas de los hosts de cada subred?Son los números entre el valor de la subred y el
valor del broadcast.
Para concluir:
Subred MáscaraPrimer
Host
Ultimo
Host Broadcast
192.168.10.64255.255.255.19
2192.168.10.65 192.168.10.126
192.168.10.12
7
192.168.10.12
8
255.255.255.19
2192.168.10.129 192.168.10.190
192.168.10.19
1
Ejemplo de práctica #2: 192.168.10.0/255.255.255.248 (/29)
Dirección de red: 192.168.10.0
Máscara de subred: 255.255.255.248
¿Subredes? 248 en binario es 11111000. 2^5 - 2 = 30 subredes.
o ¿Host por subred? 11111000. 2^3 - 2 = 6 Hosts por subred.
Página 100 de 135
o ¿Subredes válidas? 256 - 248 = 8 (tamaño de bloque y primera subred). 8 + 8 = 16 (segunda subred). 16 + 8 = 24
(tercera subred). 24 + 8 = 32 (cuarta subred)....232 + 8 = 240 (subred No. 30). 240 + 8 = 248 (valor de la máscara,
subred no válida).
o ¿Broadcast de cada subred? Ver tabla de resultados.
o ¿Hosts válidos? Ver tabla de resultados.
Subred MáscaraPrimer
Host
Ultimo
Host Broadcast
192.168.10.8255.255.255.24
8192.168.10.9 192.168.10.14 192.168.10.15
192.168.10.16255.255.255.24
8192.168.10.17 192.168.10.22 192.168.10.23
192.168.10.24255.255.255.24
8192.168.10.25 192.168.10.30 192.168.10.31
192.168.10.32255.255.255.24
8192.168.10.33 192.168.10.38 192.168.10.39
... ... ... ... ...
192.168.10.23
2
255.255.255.24
8192.168.10.233 192.168.10.238
192.168.10.23
9
192.168.10.24
0
255.255.255.24
8192.168.10.241 192.168.10.246
192.168.10.24
7
Ejemplo de práctica #3: Haciendo subnetting de una clase C "en la cabeza"
Tomemos el siguiente ejemplo:
o Dirección IP: 192.168.10.33.
o Mascara de subred: 255.255.255.224.
Página 101 de 135
Primero que todo determine la subred y la dirección broadcast de la dirección IP anterior. Usted puede hacer esto
respondiendo a la pregunta 3 de las 5 preguntas con las que hemos venido trabajando: 256 - 224 = 32 (primera
subred y tamaño de bloque). 32 + 32 = 64 (segunda subred). Mire con atención y se dará cuenta que la dirección IP
192.168.10.33 se encuentra comprendida entre la subred 192.168.10.32 y la subred 192.168.10.64. Por lo que
concluimos que la dirección IP 192.168.10.33 está en la subred 192.168.10.32 y que la dirección broadcast de la
subred 192.168.10.32 es 192.168.10.63 (recuerde que la dirección broadcast de una subred es siempre el número
anterior al de la siguiente subred). Por lo tanto el rango de direcciones IP válidas para hosts en la subred
192.168.10.32 es desde 192.168.10.33 hasta 192.168.10.62.
Ejemplo de práctica #4: Haciendo subnetting de una clase C "en la cabeza"
o Dirección IP: 192.168.10.33
o Máscara de subred: 255.255.255.240.
¿Cual es la subred? 256 - 240 = 16 (primera subred y tamaño del bloque). 16 + 16 = 32 (segunda subred). 32 + 16 =
48 (tercera subred). Por lo que concluimos que la dirección IP 192.168.10.33 está entre las subredes 192.168.10.32 y
192.168.10.48. También podemos decir que la dirección broadcast de la subred 192.168.10.32 es 192.168.10.47. El
rango de hosts válidos para la subred 192.168.10.32 es desde 192.168.10.33 hasta 192.168.10.46.
En conclusión...
o Dirección IP: 192.168.10.33.
o Máscara de subred: 255.255.255.240.
o Subred a la que pertenece: 192.168.10.32.
o Dirección de broadcast de la subred: 192.168.10.47.
o Rango de hosts válidos: 192.168.10.33 - 192.168.10.45.
::[CONCLUSIONES]::
o Siempre, siempre, siempre, siempre [for ($i = 0; $i < 1000; $i++) print "siempre"] (varias veces para que no se le
olvide) se trabaja (se responde a las preguntas) con el último octeto que nos dan en la mascara de subred.
o El valor de la última subred (la que no es válida) se tiene en cuenta simplemente para saber cual el broadcast de la
subred inmediatamente anterior.
o Sí, yo sé; tenemos que saber convertir de binario a decimal y de decimal a binario para poder responder
correctamente a las cinco preguntas trabajando únicamente con el último octeto de la máscara de subred.
::[CREDITOS]::
Página 102 de 135
o Fuente blibliográfica y método: LAMMLE, Todd. CCNA Cisco Certified Network Associate Study Guide. Fourth
Edition.SYBEX.
http://www.netstorming.com.ar/2009/06/08/guia-de-subnetting/
Guía de subnetting
En este post explicaré cómo realizar una división en subredes, comenzando desde los aspectos básicos y llegando a incluir temas avanzados como VLSM y CIDR.
El mismo se escribe para que sirva como guía para los alumnos de CCNA pero puede aplicarse para cualquiera que desee aprender la estrategia de subnetting e incluso como ayuda memoria para quienes ya conozcan el tema.
Tabla de contenido
1. Prerrequisitos 2. Marco teórico
1. Motivación 2. ¿En qué consiste la división en suredes? 3. Concepto de máscara de subred
3. Mecanismo de subnetting
Página 103 de 135
4. Cálculo de cantidad de subredes y hosts 1. Tabla de potencias de 2 2. Cálculo de máscara de subred sabiendo la cantidad de subredes necesarias 3. Cálculo de máscara de subred sabiendo la cantidad de hosts
5. Calcular la n-ésima subred 6. Ejemplo integrador
1. Decisión de la máscara de subred 2. Cantidad de subredes y de hosts por subred 3. Cálculo de subredes solicitadas 4. Asignación de IPs a los routers
7. CIDR 1. VLSM 2. Resumen de rutas
Prerrequisitos
Se asume para el siguiente tutorial que el lector ya tiene conocimiento acerca del trabajo con números binarios.
Marco teórico
Cuando se crearon las direcciones IPv4 se las dividió en cinco clases, con la intención de asignar redes de cada clase según las necesidades de direccionamiento de cada usuario. Así, se obtuvieron:
Clase Primer octeto
Rango Objetivo Cant. redes
Cant. hosts
A 0xxxxxxx 1.0.0.0 – 127.255.255.255
Organizaciones con grandes cantidades de hosts
2^7 2^24 – 2
B 10xxxxxx 128.0.0.0 – 191.255.255.255
Organizaciones de tamaño mediano y grande
2^14 2^16 – 2
C 110xxxxx 192.0.0.0 – 223.255.255.255
Pequeñas redes 2^21 2^8 – 2
D 1110xxxx 224.0.0.0 – 239.255.255.255
Direcciones de multicast
- -
E 1111xxxx 240.0.0.0 – 255.255.255.255
Direcciones reservadas (para investigacion y otros fines)
- -
El problema que surgió fue que las clases A y B se agotaron muy rápidamente, con lo cuál el número de direcciones IP disponibles se redujo drásticamente. El gran problema de las clases es que la diferencia de hosts que cada una admite es muy grande entre sí. Para entenderlo mejor, servirá un ejemplo:
Se tiene una organización con 1000 hosts en su red. Una red de clase C no satisface sus necesidades, dado que admite como máximo 254 hosts. Entonces, la siguiente opción es una clase B, que tiene una capacidad de direccionamiento de 65534 hosts. Por lo tanto la organización despediciará 64534 direcciones IP, lo que representa el 98,47% de las direcciones!
Motivación
Página 104 de 135
Se hizo evidente que la asignación basada en clases era ineficiente para la asignación de direcciones de red. Por ello se pensó una estrategia para reducir al mínimo el desperdicio de direcciones IP y fue así como se creó el concepto de subnetting.
¿En qué consiste la división en suredes?
Básicamente, la división en subredes plantea que si una red de clase despedicia muchas direcciones IP entonces la misma sea dividida en N subredes más pequeñas que aprovechen mejor el espacio de direccionamiento. La forma más sencilla de entender esto es con un ejemplo.
Suponiendo el caso de la organización anterior para la cuál una red de clase C es muy chica y, a su vez, un red de clase B es demasiado grande, entonces se puede dividir la red de clase B en redes más chicas que se ajusten más a las realidades de la organización. De esta manera se podría, por ejemplo, dividir una red de clase B en 64 subredes de 1024 hosts cada una (en realidad 1022, pues la primer y última dirección no pueden utilizarse para hosts). De esta forma, la organización que antes desperdiciaba el 98,47% de sus direcciones IP ahora despediciará sólo el 2,34% y quedará la posibilidad de tener direcciones para 63 organizaciones más de similar tamaño!
Concepto de máscara de subred
El concepto de máscara indica en una dirección IP qué bits son de red y qué bits son de host. Con el uso de redes con clases, la máscara estaba implícita en la dirección de clase, pues se conocía a priori los bits para red y los bits para host. Cuando se creó el concepto de subredes también se les asoció una máscara de subred, que resultó de utilizar bits de hosts para la máscara y de esta manera obtener varias subredes con menos hosts cada una.
Mecanismo de subnetting
Partiendo de una red dada, para obtener dos subredes será necesario un único bit, ya que con él pueden representarse dos números. Si fueran necesarias tres subredes ya se necesitaría un bit más, que daría como resultado la posibilidad de obtener cuatro subredes. Lógicamente, al utilizar bits de hosts para crear subredes, cuantas más subredes se necesiten menos hosts podrá albergar cada una.
Con la pequeña introducción teórica ya vista se analizará el procedimiento de subnetting utilizando un ejemplo. Para ello, se utilizará una empresa ficticia que está dividida en 4 áreas con 55 hosts cada una y cuenta con la red 192.10.10.0.
En primera instancia lo conveniente es tomar la red asignada y escribirla, junto con su máscara, en números binarios. Así, la red anterior, que según la tabla es una clase C y su máscara es 255.255.255.0 se escribe como:
11000000 00001010 00001010 00000000 - Dirección de red11111111 11111111 11111111 00000000 - Máscararrrrrrrr rrrrrrrr rrrrrrrr hhhhhhhh - r: representa porción de red; h: representa porción de host
Ahora bien, según los requerimientos se necesitan cuatro subredes (una para cada área de la empresa) por lo cuál deberán tomarse dos bits de la parte de host para representarlas. Entonces lo anterior se podría dividir de la siguiente manera:
11000000 00001010 00001010 00000000 - Dirección de red11111111 11111111 11111111 11000000 - Máscararrrrrrrr rrrrrrrr rrrrrrrr sshhhhhh - r: representa porción de red; s: representa porción de subred; h: representa porción de host
Página 105 de 135
Notar que ahora, los dos bits más significativos de la parte de host forman parte de la máscara de subred. Con ello, hay 2 bits para subred lo que hace un total de 4 subredes y 6 bits para hosts, lo que significa un total de 64 hosts (62 en realidad). ¿Qué habría pasado si el requerimiento hubiera sido 4 subredes con 70 hosts cada una y la clase C dada? Simplemente no podría haberse satisfecho porque no hay manera que las direcciones IP sean suficientes.
Cálculo de cantidad de subredes y hosts
Un cálculo muy común al realizar subnetting es el de computar la cantidad de hosts y de subredes que pueden obtenerse cuando se subnetea. Las cuentas son realmente simples y se basan en las siguientes fórmulas:
2^bs - Cantidad de subredes utilizando bs bits para subred.(2^bh - 2) - Cantidad de hosts utilizando bh bits para hosts.
El motivo por el cuál se restan los dos bits en la última fórmula es porque la primer y última IP de una subred no pueden utilizarse, debido a que la primer dirección es la dirección de subred y la última la de broadcast.
Tabla de potencias de 2
A continuación se presenta una tabla con los resultados para cada potencia de 2, abarcando desde el 1 hasta el 12. Será de gran utilidad para los primeros cálculos y con la práctica ya no será necesaria.
Bits (x) Resultado1 22 43 84 165 326 647 1288 2569 51210 102411 204812 4096
Cálculo de máscara de subred sabiendo la cantidad de subredes necesarias
El primer caso simple es dada una cantidad de subredes obtener la cantidad de bits necesarios para la máscara de subred. Por ejemplo, si se tiene la subred 170.25.0.0 y se necesitan crear 27 subredes es necesario calcular cuántos bits se necesitan para representar el número 27. Para ello se puede buscar en la tabla anterior encontrando que con 4 bits es posible representar 16 direcciones (no alcanza) y con 5 bits se obtienen 32 direcciones. Entonces, la máscara se transformará en:
10101010 00011001 00000000 00000000 - 170.25.0.011111111 11111111 00000000 00000000 - Máscara original11111111 11111111 11111000 00000000 - Máscara de subred
La máscara anterior en decimal sería ”255.255.248.0”.
Cálculo de máscara de subred sabiendo la cantidad de hosts
Página 106 de 135
Para calcular la máscara en base a la cantidad de hosts el mecanismo es muy similar al anterior con una consideración más y es que al valor de la tabla es necesario restarle 2 unidades (por las direcciones de subred y de broadcast). Tomando como ejemplo una organización que cuenta con la clase B 181.67.0.0 y está dividida en varias áreas donde la más grande de ellas tiene 500 hosts, se debe calcular cuántos bits destinar a host. Buscando en la tabla se ve que la opción adecuada es utilizar 9 bits que nos da un total de 510 hosts.
Calcular la n-ésima subred
Suponiendo que se cuenta con la red de clase A 20.0.0.0 y se necesitan 4000 subredes. Siguiendo los pasos que se han realizado hasta el momento se necesitarían 12 bits para obtener 4096 subredes, con lo que se obtendría lo siguiente:
00010100 00000000 00000000 00000000 - 20.0.0.011111111 00000000 00000000 00000000 - 255.0.0.0 - Máscara por defecto11111111 11111111 11110000 00000000 - 255.255.240.0 - Máscara de subred
Ahora bien, puede resultar necesario en algún caso obtener una determinada subred. Para ello se realiza una cuenta muy simple que consiste en representar el número de subred que desea obtenerse menos una unidad en la posición de los bits asignados para subred. El motivo por el cuál se resta una unidad es porque debe considerarse la red 0. Se puede ver esto con un ejemplo basados en la subred anterior.
Para obtener la 2000º subred con la división en subredes hechas en el ejemplo anterior se deben realizar los siguientes pasos:
Escribir el número 1999 en binario.
011111010000
Ubicar el número obtenido en la dirección IP ocupando la posición de los bits asignados a subred (se realiza en la segunda línea). Se puede ver que ya se separa el número en dos octetos, utilizando los ocho bits superiores para el segundo octeto y los cuatro inferiores como los cuatro superiores del tercer octeto. El resto de los bits se dejan en cero pues son los que corresponden a host.
00010100 00000000 00000000 00000000 - 20.0.0.0 - Dirección de red00010100 01111101 00000000 00000000 - 20.125.0.0 - Dirección de subred11111111 11111111 11110000 00000000 - 255.255.240.0 - Máscara de subred
Ejemplo integrador
Se tiene la red de clase B 146.201.0.0 y se la desea subnetear para el siguiente esquema. Tener en cuenta que el número de hosts que se especifica ”’incluye”’ la dirección IP de los routers.
Los pasos a seguir son:
1. Decidir la máscara de subred que se va a aplicar a las subredes.Página 107 de 135
2. Especificar la cantidad de subredes que pueden obtenerse y la cantidad de hosts que pueden direccionarse por subred.
3. Calcular las redes que se piden.4. Asignar las redes para adaptarse a lo solicitado.5. Designar una IP para los routers (suelen utilizarse la primera o última IP del rango).
La resolución se haría de la siguiente manera.
Decisión de la máscara de subred
Para decidir la máscara de subred que se va a utilizar pueden escogerse dos criterios:
Tomando la subred con mayor cantidad de hosts y utilizando dicha información para calcular los bits necesarios para hosts. De ahí es trivial obtener los bits para subred y, con ellos, la máscara de subred.
Tomando la cantidad de subredes necesarias y eligiendo la cantidad de bits que se necesitan para representarlas.
En este caso, dado que se provee la información de la red con mayor cantidad de hosts se va a utilizar ese criterio para elegir la máscara de subred. Para ello, se ve que la subred más grande que tiene 126 hosts. Según la tabla, se necesitarían 7 bits para cubrir el espacio de direcciones de dicha subred. Entonces:
10010010 11001001 00000000 00000000 - 146.201.0.0 - Dirección de red11111111 11111111 00000000 00000000 - 255.255.0.0 - Máscara de red11111111 11111111 11111111 10000000 - 255.255.255.128 - Máscara de subred
La máscara anterior surgió de utilizar 7 bits para hosts (los últimos 7 bits de la dirección) y el resto asignarlos a subred.
Cantidad de subredes y de hosts por subred
Según lo visto anteriormente, para obtener la cantidad de subredes es necesario elevar 2 a la cantidad de bits para subred. Se puede ver que se cuenta con 9 bits para subred, por lo tanto:
2^9: 512
Es así que se puede concluir en que se podrán obtener 512 subredes. La cantidad de hosts por subred ya está calculada, dado que fue el criterio que se utilizó para obtener la máscara de subred. No obstante, para seguir los pasos del procedimiento se muestra. Lo que debe hacerse es elevar 2 a la cantidad de bits utilizados para hosts y al resultado restarle dos unidades.
2^7 - 2: 126
Por lo tanto, se concluye que se podrán tener 512 subredes donde cada una de ellas será capaz de tener un máximo de 126 hosts.
NOTA: es importante notar que cuando se escogió utilizar 7 bits para hosts no queda ninguna vacancia de direcciones IP en la subred de mayor tamaño, lo que puede ser un problema si se necesita agregar un nuevo host más tarde a la misma. En ese caso podría tomarse 1 bit más para poder afrontar un crecimiento futuro, aunque desperdiciando muchas direcciones IP. No existe una regla para decidir, dependerá del espacio de direcciones con el que se cuente, de la proyección de crecimiento y otros factores más. De cualquier manera, siempre es recomendable dejar una vacancia de direcciones, aunque sea mínima.
Cálculo de subredes solicitadas
Página 108 de 135
El próximo paso es calcular qué subred corresponde con cada una de las que se pide utilizar. Recordando lo visto, se debe restar una unidad a la subred a obtener, representar ese número en binario (utilizando todos los bits dedicados a subred) y luego colocarlo en la posición de los bits de subred. Entonces:
1º subred: 000000000.
10010010 11001001 00000000 00000000 - 146.201.0.0 - Dirección de 1º subred11111111 11111111 11111111 10000000 - 255.255.255.128 - Máscara de subred
3º subred: 000000010.
10010010 11001001 00000001 00000000 - 146.201.1.0 - Dirección de 3º subred11111111 11111111 11111111 10000000 - 255.255.255.128 - Máscara de subred
21º subred: 000010100.
10010010 11001001 00001010 00000000 - 146.201.10.0 - Dirección de 21º subred11111111 11111111 11111111 10000000 - 255.255.255.128 - Máscara de subred
126º subred: 001111101.
10010010 11001001 00111110 10000000 - 146.201.62.128 - Dirección de 126º subred11111111 11111111 11111111 10000000 - 255.255.255.128 - Máscara de subred
Asignación de IPs a los routers
Para asignar las IPs se utilizará la primera de cada subred, excepto en el caso de las punto a punto. Así las asignaciones serán:
Router A: o 146.201.0.1o 146.201.10.1o 146.210.62.129
Router B: o 146.201.0.2o 146.201.1.1
CIDR
El concepto de CIDR (classless inter-domain routing) se definió en la RFC 1519 como una estrategia para frenar algunos problemas que se habían comenzado a manifestar con el crecimiento de Internet. Los mismos son:
Agotamiento del espacio de direcciones de clase B. Crecimiento de las tablas de enrutamiento más allá de la capacidad del software y hardware disponibles. Eventual agotamiento de las direcciones IP en general.
CIDR consiste básicamente en permitir máscaras de subred de longitud variable VLSM para optimizar la asignación de direcciones IP y utilizar resumen de rutas para disminuir el tamaño de las tablas de enrutamiento.
VLSM
La técnica de VLSM (variable-length subnet masking) consiste en realizar divisiones en subredes con máscaras de longitud variable y es otra de las técnicas surgidas para frenar el agotamiento de direcciones IPv4.
Página 109 de 135
Básicamente, VLSM sugiere hacer varios niveles de división en redes para lograr máscaras más óptimas para cada una de las subredes que se necesiten.
Trabajando con el ejemplo anterior puede verse que hay 512 subredes con la capacidad de contener 126 hosts cada una. Suponiendo que, excepto la única área que tiene 126 hosts, las demás áreas no tienen más de 30 hosts se estarían desperdiciando entonces alrededor de 90 direcciones IP por subred.
También podría darse la situación de, aún teniendo direcciones IP suficientes, no puedan direccionarse todos los hosts. Nuevamente, se va a trabajar con un ejemplo. Dada la siguiente topología de red, se tiene para asignar direcciones la clase C 199.210.66.0.
Si se utilizara el esquema tradicional de división en subredes no sería posible asignar direcciones a todos los hosts, ya que al dividir las subredes para soportar la que requiere 120 hosts quedarían tan sólo dos redes de 126 hosts cada una. Con VLSM es posible asignar direcciones para todos los hosts en el esquema anterior haciendo divisiones sucesivas en subredes más pequeñas.
Los pasos para dividir en subredes utilizando VLSM son:
1. Subnetear para la red con mayor cantidad de hosts.2. De las subredes obtenidas, asignar las que mejor se ajusten a las subredes.3. Si aún quedan segmentos de red sin una subred asignada volver al paso 1.
Con el algoritmo anterior se dividiría entonces de la siguiente manera:
1) Tomar el segmento con 120 hosts y subnetear para él. Se necesitan 7 bits para 126 hosts, lo cuál queda bien para este caso. Entonces:
11000111 11010010 01000010 00000000 - 199.210.66.0 - Dirección de clase11111111 11111111 11111111 00000000 - 255.255.255.0 - Máscara de red11111111 11111111 11111111 10000000 - 255.255.255.128 - Máscara de subred
Se ve que se utilizaron 7 bits para hosts (para direccionar 126 hosts) y quedó tan sólo 1 bit para subred, por lo que se podrán obtener sólo 2 subredes. Lo que se hará en este caso es asignar la primera de las subredes al segmento con 120 hosts y la otra se volverá a dividir. Entonces:
Página 110 de 135
199.210.66.0/255.255.255.128 – Red de 120 hosts. 199.210.66.128/255.255.255.128 – Red a subnetear nuevamente.
2) Tomar el segmento con 60 hosts y subnetear para él. Se necesitan 6 bits para 62 hosts, por lo que se utilizarán 6 bits. Quedaría:
11000111 11010010 01000010 10000000 - 199.210.66.128 - Dirección de subred11111111 11111111 11111111 10000000 - 255.255.255.128 - Máscara de subred11111111 11111111 11111111 11000000 - 255.255.255.192 - Nueva máscara de subred
En este caso se utilizaron 6 bits para hosts y quedó 1 bit para subred, por lo que será posible obtener 2 subredes de 62 hosts cada una. El siguiente paso es asignar una de ellas al segmento con 60 hosts:
199.210.66.128/255.255.255.192 – Red de 60 hosts. 199.210.66.192/255.255.255.192 – Red a subnetear nuevamente.
3) Tomar el segmento con 22 hosts y subnetear para él. Se necesitan 5 bits para 30 hosts. El resultado será:
11000111 11010010 01000010 11000000 - 199.210.66.192 - Dirección de subred11111111 11111111 11111111 11000000 - 255.255.255.192 - Máscara de subred11111111 11111111 11111111 11100000 - 255.255.255.224 - Nueva máscara de subred
En la división anterior se utilizaron 5 bits para hosts y nuevamente quedó 1 bit para subred, por lo que será posible obtener 2 subredes de 30 hosts cada una. Nuevamente se asigna una de ellas al segmento de 22 hosts y la otra se volverá a subnetear:
199.210.66.192/255.255.255.224 – Red de 22 hosts. 199.210.66.224/255.255.255.224 – Red a subnetear nuevamente.
4) Tomar el segmento con 10 hosts y subnetear para él. Se necesitan 4 bits para 14 hosts. Se obtendrá lo siguiente:
11000111 11010010 01000010 11100000 - 199.210.66.224 - Dirección de subred11111111 11111111 11111111 11100000 - 255.255.255.224 - Máscara de subred11111111 11111111 11111111 11110000 - 255.255.255.240 - Nueva máscara de subred
Se ve que se utilizaron 4 bits para hosts y quedó 1 bit para subred, con lo que se tendrán 2 subredes de 14 hosts cada una. Ya casi terminando, se asigna una de las subredes al segmento con 10 hosts y se deja la otra para subnetear nuevamente para los enlaces punto a punto.
199.210.66.224/255.255.255.240 – Red de 10 hosts. 199.210.66.240/255.255.255.240 – Red a subnetear nuevamente.
5) Para terminar se tomarán los dos enlaces entre los routers. Se necesita que cada enlace tenga dos hosts como máximo, con lo cual se utilizarán sólo 2 bits, quedando 2 bits para subred. Así:
11000111 11010010 01000010 11110000 - 199.210.66.240 - Dirección de subred11111111 11111111 11111111 11110000 - 255.255.255.240 - Máscara de subred11111111 11111111 11111111 11111100 - 255.255.255.252 - Nueva máscara de subred
En este caso se utilizaron 2 bits para hosts y quedaron 2 bits para subred, con lo que se tendrán 4 subredes de 2 hosts cada una. En este punto ya no se puede volver a hacer una división de subred, pero sí quedarán 2 redes con 2 hosts cada una libres para una futura asignación.
199.210.66.240/255.255.255.252 – Enlace entre router A y B. 199.210.66.244/255.255.255.252 – Enlace entre router B y C.
Página 111 de 135
199.210.66.248/255.255.255.252 – Red libre. 199.210.66.252/255.255.255.252 – Red libre.
Se puede resumir lo realizado en un esquema que suele resultar útil para utilizar mientras se realiza el proceso:
199.210.66.0/24199.210.66.128/24 => 199.210.66.128/26199.210.66.192/26 => 199.210.66.192/27199.210.66.224/27 => 199.210.66.224/28199.210.66.240/28 => 199.210.66.240/30199.210.66.244/30199.210.66.248/30199.210.66.252/30
Para concluir se ve que partiendo de poder direccionar sólo dos de los segmentos se pasó a direccionar todos y hasta quedando con dos redes punto a punto libres. Esto implica un gran ahorro de direcciones.
Resumen de rutas
El resúmen de rutas se conoce también como agregación de prefijos y consiste básicamente en tomar una cantidad de direcciones de subred y resumirlas en una sola. La principal utilidad del mismo es ”’reducir las tablas de ruteo”’, ya que en lugar de una entrada por cada subred se tiene una sola entrada de superred.
Por ejemplo, para el caso anterior, suponiendo que existe un router de borde que conecta con un ISP, el mismo podría publicar las redes:
199.210.66.0/25 199.210.66.128/26 199.210.66.192/27 199.210.66.224/28 199.210.66.240/30 199.210.66.244/30 199.210.66.248/30 199.210.66.252/30
O simplemente publicar la dirección de red que las resume a todas ellas, que es la red:
199.210.66.0/24
Se ve claramente que se redujeron las rutas publicadas de 8 entradas a sólo 1. Y esto para una muy pequeña red! Si se lleva a gran escala, como es internet, la reducción de las tablas de ruteo con el esquema anterior es realmente drástica.
Las ventajas de una tabla de ruteo más pequeña son claras:
Los routers requieren menos memoria para almacenar la tabla. Se ahorra mucho procesamiento al buscar en una tabla de ruteo reducida. Los retrasos por enrutamiento son menores.
El procedimiento es el siguiente:
Las redes a resumir deben ser consecutivas. Se escriben las direcciones IP y se arma la máscara con unos en todos los lugares donde coincidan los bits de las
direcciones.
Página 112 de 135
Se hace un AND con cualquiera de las direcciones IP y la máscara obtenida y dicha ruta, junto con la máscara, será la ruta de resúmen.
Ejemplo: se tienen las siguientes cuatro subredes consecutivas y se las quiere resumir en una sola.
192.168.0.0/24 192.168.1.0/24 192.168.2.0/24 192.168.3.0/24
11000000 10101000 00000000 00000000 - 192.168.0.011000000 10101000 00000001 00000000 - 192.168.1.011000000 10101000 00000010 00000000 - 192.168.2.011000000 10101000 00000011 00000000 - 192.168.3.0
11111111 11111111 11111100 00000000 - 255.255.248.0
Se ve que las cuatro redes anteriores pueden resumirse con la dirección de superred 192.168.0.0/22.
http://networkeando.blogspot.com/2008/12/ejercicio-de-subnetting.html
EJERCICIO DE SUBNETTING
En este post plantearé un ejercicio sobre subnetting y lo resolveremos. El subnetting es la técnica de dividir a una red en varias subredes.Antes que nada no estaría mal que den una leída a 4 post publicados anteriormente donde se explica referente al direccionamiento IP y subnneting. Aquí les dejo los links:http://networkeando.blogspot.com/2008/11/direccionamiento-ip-sistema-binario.htmlhttp://networkeando.blogspot.com/2008/11/parte-2-clases-de-ip.htmlhttp://networkeando.blogspot.com/2008/11/parte-3-creacin-de-subredes-subnetting.htmlHay otro post que habla de subnetting pero no les puedo dar el enlace exacto pero si siguen este link, los lleva a un post anterior al que deseo que lean.http://networkeando.blogspot.com/2008/11/dynamips-instalacion-y-configuracion.htmlGracias por su comprensión.
El enunciado es el siguiente: Se desea dividir una red con IP 193.7.3.X y con una máscara de 255.255.255.0 en 5 subredes. Cómo lo haremos?, puedes darle respuesta al ejercicio por tu cuenta antes de leer la solución.
Página 113 de 135
Resolviendo el ejercicio:
Analizando los datos podemos deducir lo siguiente:- La red es de clase C, porque el primer octeto está entre 192 y 223.- La máscara asociada es una máscara por defecto.- El número de host de la red es de 254.- Después de dividir la red en 5 subredes, se tendrá una máscara de 255.255.255.X, donde X será un valor que debemos averiguar.- Las 5 subredes tendrán menos de 254 host. Esto porque como disponemos el último octeto (8 bits) para hacer subnetting y utilizaremos algunos bits para identificar las subredes entonces, el número máximo de host posibles será menor a 254. Luego lo precisaremos.
* Calculando el número de bits que se utilizarán para identificar las subredes:De manera práctica para calcular el número de bits se aplica la siguiente inecuación:
2^n >= Número de redes,
donde el superíndice ‘n’ es el menor valor que cumple la condición, el cual nos indicará el número de bits a tomar. Para nuestro caso el número de redes sería :
2^n >= 5
Por lo tanto el valor de ‘n’ sería 3.Esto quiere decir que 3 son los bits que debemos ocupar del último octeto para identificar las subredes.
* Obteniendo la nueva máscara para todas las subredes.
Entonces 3 bits para red y 5 bits para host.El número de redes sería : 2^3 = 8El número de host por red sería : 2^n - 2 = 2^5 – 2 = 30 hosts.Se resta 2 porque no se toma en cuenta para identificar a un host el IP que se utiliza para identificar la red y la otra IP para utilizarlo como broadcast.Por último la nueva máscara sería :
255.255.255.224
El número 224 se calcula transformando el número binario 11100000 que es como quedo el valor del último octeto.
* Determinando las subredes:El intervalo de incremento nos va a permitir construir una tabla con todas las subredes y host principales.Para calcular el intervalo de incremento entre las subredes podemos hacerlo de dos formas:1ra. Forma : Restando al número máximo posible de valores que puede haber en un octeto, o sea 256, el valor del octeto de la máscara que se ha modificado.
Es decir : 256 – 224 = 32
2ra. Forma : Utilizando la expresión 2^n , el cual es la traducción a base decimal del bit menos significativo de la nueva máscara.Es decir : 2^5 = 32,
Página 114 de 135
* Construyendo la tabla de subredes y de host :De acuerdo al método aplicado, utilizando una misma máscara para todas las subredes hemos podido dividir la red dada en un número aproximado al solicitado. El resultado son 8 subredes, que podríamos decir que cumple lo solicitado (5 subredes) con un “margen de error” de 3 subredes. Según sea el caso específico estas tres subredes podrían ser utilizadas posteriormente. Pero bueno en general cada caso podría tener una solución distinta. Otra técnica es utilizando VLSM, la cual nos permite mayor precisión en el número de subredes que necesitemos. En el blog no he encontrado una explicación específica con respecto al tema de VLSM. Espero que haya oportunidad de tratarlo. Espero que este ejercicio les sea útil. Saludos.
http://mundoimd.com/2009/03/16/subnetting-cuantas-subredes-i/
Subnetting: cuantas subredes (I)Publicado: 16 de marzo de 2009 | Categorias: Networking Revisado: 14 de febrero de 2010 | etiquetas: ccna, Cisco, Documentacion, Networking
Primera entrega de una serie de artículos sobre subnetting. En esta entrega vamos a calcular cuantas redes se obtienen cuando se hace subnetting.
Supongamos que tenemos la máscara 255.255.255.224 y lo aplicamos a un red de clase C, cuantas subredes obtenemos al aplicar esta máscara ?
Primero pasamos de decimal a binario: 11111111.11111111.11111111.11100000. Al ser una clase C nos fijamos SOLO en el último octeto (11100000) que tenemos 3 bits a “1” y 5 a “0“, pero para las redes SOLO nos interesa los que están a “1“.
Página 115 de 135
Para calcular cuantas subredes se obtienen debemos usar esta formula: 2n-2, donde n son los bits a “1“, por lo que en este caso obtenemos: 23-2 = 6 subredes. Recordar que si usamos el comando ip subnet-zero podemos usar la primera red de todas, para más información la web de Cisco sobre subnet-zero.
Si cambiamos la red clase C por una clase B, debemos fijarnos en los 2 últimos octetos (11111111.11100000), ahora tenemos 11 bits a “1” por lo que la formula pasa a ser: 211-2 = 2046 subredes.
Comentarios (1)
“Si cambiamos la red clase C por una clase B, debemos fijarnos en los 2 últimos octetos (11111111.11100000), ahora tenemos 11 bits a “1” por lo que la formula pasa a ser: 211-2 = 2046 subredes”hola una cosa q me intriga al hacer el cambio de clase C por B, dices q “debemos fijarnos en los 2 últimos octetos (11111111.11100000)”mi duda es pasando a clase B los dos ultimos octetos no serian (11100000.00000000) y nos daria las mismas subredes no?
Subnetting: cuantos hosts (II)Publicado: 17 de marzo de 2009 | Categorias: Networking Revisado: 14 de febrero de 2010 | etiquetas: ccna, Cisco, Documentacion, Networking
Segunda entrega de una serie de artículos sobre subnetting. En esta entrega vamos a calcular cuantos hosts se obtienen cuando se hace subnetting.
Supongamos que tenemos la máscara 255.255.255.224 y lo aplicamos a un red de clase C, cuantos hosts obtenemos por subred al aplicar esta máscara ?
Primero pasamos de decimal a binario: 11111111.11111111.11111111.11100000. Al ser una clase C nos fijamos SOLO en el último octeto (11100000) que tenemos 3 bits a “1” y 5 a “0“, pero para los hosts SOLO nos interesa los que están a “0“, que son hosts por cada subred.
Para calcular cuantas subredes se obtienen debemos usar esta formula: 2h-2, donde h son los bits a “0“, por lo que en este caso obtenemos: 25-2 = 30 hosts por subred.
Página 116 de 135
Si cambiamos la red clase C por una clase B, debemos fijarnos en los 2 últimos octetos (11111111.11100000), tenemos los mismos bits a “0” por lo que tenemos los mismos hosts por subred (aunque más subredes).
Cambiemos de máscara por 255.255.240.0 de una clase B. Pasamos a binario: 11111111.11111111.11110000.00000000. Nos fijamos en los 2 últimos octetos (Clase B) y tenemos 12 bits a “0” y volvemos a usar la formula: 212-2 = 4094 hosts por subred.
Subnetting: validar subnets, hosts y broadcasts (III)Publicado: 18 de marzo de 2009 | Categorias: Networking Revisado: 14 de febrero de 2010 | etiquetas: ccna, Cisco, Documentacion, Networking
Tercera entrega de subnetting en la que vamos a validar subnets, hosts y broadcasts.
Vamos a partir de un ejemplo, imaginemos que tenemos que crear subredes a partir de la dirección 192.168.78.0 usando la máscara de red 255.255.255.224 (o /27). Empezamos obteniendo el número base con la fórmula: 256 – subnetmask = número base, que en nuestro caso es: 256 -224 = 32. Ahora vamos a calcular las subredes:
subnet 1 → 0+32 = 32subnet 2 → 32+32 = 64subnet 3 → 64+32 = 96subnet 4 → 96+32 = 128subnet 5 → 128+32 = 160subnet 6 → 160+32 = 192
Página 117 de 135
192+32 = 224
No podemos sumar 32 a 192 por que nos da 224 que es nuestra máscara de subred, por lo que no es una subred válida más información en la web de Cisco.
Para calcular el broadcast podemos hacer de 2 formas, sumar 31 (el número base menos 1) a cada subnet (por ejemplo 32 + 31 = 63) o restar 1 a cada subred superior de la siguiente forma:
broadcast subnet 1 → 64-1 = 63broadcast subnet 2 → 96-1 = 95broadcast subnet 3 → 128-1 = 127broadcast subnet 4 → 160-1 = 159broadcast subnet 5 → 192-1 = 191broadcast subnet 6 → 224-1 = 223
Con esto ya tenemos los broadcasts calculados. Para calcular los hosts válidos son los que quedan entre la subred y el broadcast, por ejemplo para la primera subred sería:
subred → 192.168.78.32 hosts → 192.168.78.33 - 192.168.78.62broadcast → 192.168.78.63
Hagamos un par de ejercicios como ejemplos:
1) Usando la máscara 255.255.255.224, cual es al subred a la que pertenece el host 192.168.78.133 y cual es su broadcast ?
Primero la formula: 256 – 224 = 32, que es la primera subred 192.168.78.32. Ahora sumamos 32 hasta alcanzar la IP 133:
subnet 1 → 0+32 = 32subnet 2 → 32+32 = 64subnet 3 → 64+32 = 96subnet 4 → 96+32 = 128subnet 5 → 128+32 = 160
Por lo que podemos concluir que:
subred → 192.168.78.128 hosts → 192.168.78.129 - 192.168.78.158broadcast → 192.168.78.159
2) Con la IP 172.16.68.17 y la máscara de red 255.255.192.0, buscar la subred a la que pertenece y el broadcast.Como antes 256 – 192 = 64.
subnet 1 → 0+64 = 64subnet 2 → 64+64 = 128 128+64 = 192
Por lo que tenemos solo 2 subredes: 172.16.64.0 y 172.16.128.0 (al ser clase B miramos el tercer octeto). por lo que las 2 subredes completas son:
subred → 172.16.64.0 - subred → 172.16.128.0 hosts → 172.16.64.1 - hosts → 172.16.128.1 172.16.127.254 - 172.18.191.254broadcast → 172.16.127.255 - broadcast → 172.16.191.255
Página 118 de 135
Con esto podemos decir que la IP 172.16.68.17 está en la primera subred 172.16.64.0 y que su broadcast es 172.16.127.255.
Subnetting: calcular número de subredes y hosts (y IV)Publicado: 19 de marzo de 2009 | Categorias: Networking Revisado: 14 de febrero de 2010 | etiquetas: ccna, Cisco, Documentacion, Networking
Cuarta y última entrega de subnetting, donde vamos a aplicar todo lo que hemos aprendido. Recordemos las 2 formulas:
número de subredes = 2n-2, donde n es el número de bits a “1“.
número de hosts = 2h-2, donde h es el número de bits a “0“.
Vamos a realizar un ejemplo, tenemos la red 130.175.0.0 y queremos al menos 70 subredes y 500 hosts por subred. ¿ Qué máscara de subred debemos usar ?
Empezamos por detectar que es una red de la clase B por lo que debemos mirar los 2 últimos octetos (00000000.00000000). Ahora vamos a calcular cuantos bits para las subredes son necesarios para ello usamos
Página 119 de 135
la formula 2n-2, vamos probando valores de n hasta que nos dé suficiente para todas las subredes que nos hacen falta. Vemos que con 7 bits obtenemos 28-2 = 126 (ya que con 6 obtenemos 62 y necesitamos 70), con lo que los 2 octetos se nos queda de la siguiente forma:
11111110.00000000
Tenemos 7 bits a “1” para subredes y 9 bits a “0” para los hosts, por lo que vamos a comprobar que con 9 bits tenemos hosts suficientes para los que necesitamos usando la otra formula 2h-2, 29-2 = 510 hosts así que nos dá demás.Ya solo nos queda calcula la máscara que nos dá: 255.255.254.0.
Comparativa de máscaras, subnetmask contra wildcardPublicado: 19 de septiembre de 2008 | Categorias: Cisco, Networking Revisado: 19 de septiembre de 2008 | etiquetas: Cisco, Networking
Algunos pueden tener confusiones entre subnetmask y wildcard ya que se tiene la creencia de que simplemente uno es la inversa del otro, pero no es simplemente eso, aunque casi el 100% de los casos sea lo correcto. Wildcard es bastante más que la inversa de subnetmask de hecho tiene mucha más potencia y versatilidad
Subnetmask
Aparece de la adaptación de clases (classful) a las subredes (sin clase o classless) hace ya bastante tiempo para poder aprovechar correctamente el direccionamiento IPv4. Lo que indica la máscara de red es la cantidad de bit dedicados a la red expezando de izquierda a derecha. Cada clase tiene una longitud fija de bits. Classless Interdomain Routing (CIDR) se desarrolló para proporcionar una longitud variable de bits de red a partir de
Página 120 de 135
cada clase, por decirlo de una forma sencilla robar bits a la parte de hosts para dárselos a la parte de red dentro de cada clase. Sólo hay 33 posibles máscaras de subred IPv4, de 0.0.0.0 a 255.255.255.255, o desde / 0 a / 32.
Wildcard
Wildcards define un host o un número de hosts en una subred u octeto y son mucho más flexibles que las máscaras de subred, ya que no hay requisito de que los bits a 1 estén continuos. Otro punto que se diferencia es que los bits a tener en cuenta son al contrario que subnetmask, es decir, que el que tiene peso es el 0 y no el 1. Es muy típico en las listas de acceso (ACLs) que las wildcards aparezcan como la inversa de subnetmak, por ejemplo, 0.0.0.255 coincide con cualquier valor para el último octeto de una dirección IP en una subnetmask 255.255.255.0. Pero esto no es estrictamente necesario. Se puede conseguir todo tipo de extrañas coincidencias con una wildcard; algunos ejemplos de ACLs:
Permitir todas las direcciones 192.168.x.1: permit 192.168.0.1 0.0.255.0
0.0.255.0 -> 00000000.00000000.11111111.00000000
Permitir todas las direcciones PARES 192.168.x.0/24: permit 192.168.0.0 0.0.254.255
0.0.254.255 -> 00000000.00000000.11111110.11111111
Hay que tener en cuenta que ninguna de las wildcard de arriba son contiguas sino que se compara un lado (IP) con el otro (wildcard), cada bit es mantenido (si es 0) o ignorado (si es 1) independiente.
Un pequeño truco para determinar la wildcard correspondiente a una subred es restando 255 a cada octeto de la máscara de subred. Dos ejemplos con sub redes de /25 y /18:
255 255 255 255 255 255 255 255 - 255 . 255 . 255 . 128 (/25) - 255 . 255 . 192 . 0 (/18) ----------------------- ----------------------- 0 . 0 . 0 . 127 0 . 0 . 63 . 255
http://www.taringa.net/posts/ebooks-tutoriales/3840923/Que-es-el-subneteo-y-como-hacerlo.html
Subneteo:
Es dividir una red primaria en una serie de subredes, de tal forma que
cada una de ellas va a funcionar luego, a nivel de envío y
Página 121 de 135
recepción de paquetes, como una red individual, aunque todas pertenezcan
a la misma red principal y por lo tanto, al mismo dominio.
Porque Subnetear? >>
Cuando trabajamos con una red pequeña NO encontramos muchos
problemas para
configurar el rango de direcciones IP para conseguir un rendimiento optimo.
Pero a medida que se van agregando host a la red, el desempeño empieza
a verse afectado. Esto puede ser corregido, en parte, segmentando la red
con switches, reduciendo los Dominios de Colisión (host que Página 122 de 135
comparten el
mismo medio) enviando las tramas solo al segmento correcto. Pero
aunque se reducen las colisiones con tomar estas medidas, si se continúa
aumentando el número de host, aumentan también los envíos de broadcast
(Envío de paquetes a todos los dispositivos de la red). Lo que
afecta considerablemente el desempeño de la red. Esto se debe a que los
Switches solo segmentan a nivel de MAC Address y los envíos de broadcast
son a nivel de red 255.255.255.255 . Es aquí donde el Subneteo nos ayuda..!
Subneteando la red tendremos, en su conjunto, una sola IP address divida en varias subredes mas pequeñas bien diferenciadas, consiguiendo un mayor control y reduciendo el congestionamiento por los broadcast.
¿Como rayos se hace?>>
Okz es bien fácil , vamos a tomar de ejemplo una dirección clase C.
Wait ......
Página 123 de 135
1 al 126 Clase A el primer octeto empieza con 0. 128 al 191 Clase B el primer octeto empieza con 10 192 al 223 Clase C el primer octeto empieza con 110 224 al 239 Clase D el primer octeto empieza con 1110 240 al 255 Clase E el primer octeto empieza con 11110
La 127 está reservada para loopback, usada para pruebas en la maquina local.
(Esto es historia patria): Una IP se divide en dos partes "Identificador de red" y "Identificador de host", en la mayoría de los casos es fácil identificar la porción de host y de red con conocer la clase de la IP. Con el rápido crecimiento de internet y en redes privadas es necesario la creación de mas direcciones, la estructura actual de clases se ha extendido prestando bits de la parte de host para tener más redes. Este proceso es el que conocemos como "Subnetear".
El estándar por defecto de las mascaras de red es el siguiente:
===================================================== Dirección | Mascara ----------------------------------------------------- Clase A | 255.0.0.0 Clase B | 255.255.0.0 Clase C | 255.255.255.0 ----------------------------------------------------- Para conocer a la red que pertenece una IP se le aplica la técnica
del "AND" con la algebra booleana :
1 and 1 = 1 1 and 0 = 0 0 and 1 = 0 0 and 0 = 0
Vamos a hacer una ejemplo : Tenemos la ip "206.175.162.21" sabemos que es una clase C y en binario seria :
11001110.10101111.10100010.00010101
Decimal : 206. 175. 162. 21 Binario : 11001110.10101111.10100010.00010101
También sabemos que la máscara por defecto de una clase C es 255.255.255.0 que en binario seria : 11111111.11111111.11111111.00000000
Si le aplicamos el "AND" resultaría en :
11001110.10101111.10100010.00010101 AND 11111111.11111111.11111111.00000000 -----------------------------------
Página 124 de 135
11001110.10101111.10100010.00000000 *Nota :recordemos que solamente dará "1" cuando los DOS bits sean "1".
El resultado es: 11001110.10101111.10100010.00000000 que en decimal seria 206.175.162.0 la red a la que pertenece.
Entendiendo esto vamos a empezar a "Subnetear" propiamente.
La clave del Subneteo reside en el hecho de cojer prestado de la parte de host para la parte de red para crear una subred. Para cada clase de ip's solo ciertos bits pueden cogerse prestado para utilizarse en la subred.
Clase Bits de Host Bits utilizables A 24 22 B 16 14 C 8 6
En una red clase C :
MS = Mascara de Subred
#BM = # de Bits en la Mascara
#S = # de Subredes
#HxS = # Host por Subred
MSB = Mascara Subred en Binario (Parte de Red con 1's para abreviar)
MS #BM #S #HxS MSB 255.255.255.0 24 0 254 1.1.1.00000000 255.255.255.192 26 2 62 1.1.1.11000000 255.255.255.224 27 6 30 1.1.1.11100000 255.255.255.240 28 14 14 1.1.1.11110000 255.255.255.248 29 30 6 1.1.1.11111000 255.255.255.252 30 62 2 1.1.1.11111100
Como vemos a medida que se usan mas bits de host se crean mas subredes pero disminuye la cantidad de host por subred.
Para determinar el número de subredes y host por subred, para cada una de las mascaras de subred, tenemos las siguientes formulas :
Página 125 de 135
Numero de Host x Subred = (2 elevado al número de bits usados de hots)-2 Numero de Subredes = (2 elevado al número de bits usados para subnetear)-2
*Nota ~ame* : Se le resta 2, debido a que se reservan para las direcciones de red y broadcast respectivamente.
Eje: Queremos calcular la cantidad de host x cada subred en una clase C Subneteada con 2 bits prestados.
Numero de Host x Subred = (2^6)-2 = (64)-2 = 62 Host x Cada Subred Numero de Subredes = (2^2)-2 = (4)-2 = 2 Subredes
Para saber la máscara le sumamos 24 bits (11111111.11111111.11111111.) al numero de bits prestados que son dos.
Resultado:
11111111.11111111.11111111.110000: 255.255.255.192
Solo nos queda por saber la dirección de red y broadcast de cada subred:
Restamos la máscara de subred a 255.
255-192 = 63 de manera que la Dirección de red de la 1ra subred es 64
Numero de red: 206.175.162.64 Host validos que son "62”: 206.175.162.65-126 Dirección de Broadcast : 206.175.162.127 Mascara de Subred : 255.255.255.192
Sumamos 64 a la 1ra subred dando como resultado = 128 Dir de red de la 2da subred.
2da subred
Numero de red: 206.175.162.128 Host validos que son "62”: 206.175.162.129-190 Dirección de Broadcast : 206.175.162.191 Mascara de Subred : 255.255.255.192
Con los que hemos subneteado nuestra red.
* Comprobemos el "AND" de la dirección "206.175.162.120" para ver a que red pertenece, haciendo un paneo rápido vemos que está en el rango 65-126 de la red .64 pero comprobémoslo.
En decimal: 206.175.162.120 En Binario: 11001110.10101111.10100010.01111000 Mascara: 255.255.255.192 En Binario: 11111111.11111111.11111111.11000000
Aplicando el algebra booleana tenemos:
11001110.10101111.10100010.01111000
Página 126 de 135
AND 11111111.11111111.11111111.11000000
11001110.10101111.10100010.01000000 = .64
Comprobado ...!!!
----------------Bonus----------------
Voy a tratar de explicar un poco el tema del uso de la subnet zero y la subnet de broadcast y cuando es recomendable usarla o no.
No Subnet Zero y No Subred de Broadcast
Originalmente cuando se realizaba el subneteo de una red la fórmula para obtener la cantidad de subredes era 2N - 2, donde "N" es el número de bits robados a la porción de host y "- 2" porque la primer subred y la última subred no eran utilizables ya que contenían la dirección de la red y de broadcast respectivamente. Este procedimiento, que se lo puede llamar No Subnet Zero, está explicado en la RFC950 y se generó con el fin evitar conflictos entre implementaciones, protocolos y tecnologías propietarias.
Se puede usar: Siempre (sin importar dispositivos, protocolos, etc.).
Subnet Zero y Subred de Broadcast
El uso de la Subnet Zero y de la Subred de Broadcast permite asignar la primera y última subred para su uso. En vez de usar la fórmula 2N - 2, para obtener las subredes utiliza la fórmula 2N para que no se desperdicien esas dos subredes. Este cambio se debe principalmente a la evolución de los protocolos, todos los protocolos modernos soportan su uso, que hizo que los principales fabricantes de dispositivos consideraran la Subnet Zero por default en sus equipos. En el caso de Cisco a partir de la versión 12.0 de su IOS lo trae por defecto y para sus certificaciones toman como única opción su uso. Pueden leer más en la RFC1878 y en el documento de Cisco Subnet Zero and the All-Ones Subnet.
Se puede usar: Si estamos seguros que los dispositivos lo soportan. Si no se denegó su uso con el comando “no ip subnet zero”. Si el protocolo de enrutamiento es sin clase (RIP v.2, EIGRP, OSPF).
No se puede usar: Si no estamos seguros o los dispositivos no lo soportan. Si el protocolo de enrutamiento es con clase (RIP v.1, IGRP). Si aparecen conflictos con su uso.
Bueno, espero que se haya entendido el tema y no me hagan más preguntas sobre este tema en los tutoriales de subneteo. En verdad eluso de una u otra es casi indiferente, yo por mi parte las pocas veces que subneteo lo hago sin utilizar la subnet zero, pero para los tutoriales y explicaciones que van a encontrar en el blog utilizo la subnet zero, que es el método más moderno y que se enseña en el CCNA 4.0 y en otras certificaciones.
Página 127 de 135
Página 128 de 135
Obtener la ciudad y el país de una dirección IP
Muchos habrán notado que al ingresar en algunos sitios web éstos modifican su contenido, incluyendo idioma, publicidad, textos, etc., dependiendo del país desde el que estamos ingresando, por ejemplo, al ingresar en www.linksys.com desde Argentina éste nos redirecciona a www-ar.linksys.com, o al ingresar a www.google.com nos reenvía a www.google.com.ar. Para poder hacer esto la aplicación web busca la IP con la que estamos ingresando en una base de datos donde previamente se cargaron rangos de IP con su respectivo país.
Hasta acá todo parece muy obvio, el problema surge cuando nos preguntamos: ¿Dónde conseguimos estas bases de datos? La respuesta es sencilla: en internet.
En internet hay varios sitios que ofrecen, gratuitamente o como servicio pago, archivos con rangos de IP con su respectivo país. Muchos de estos sitios ofrecen además web services para poder consultar contra su base de datos la ubicación correspondiente a una dirección IP sin necesidad de tener los datos alojados en nuestro sitio. En este artículo voy a mostrar cómo obtener la ubicación consultando los datos en una base de datos local.
Uno de los sitios desde donde se pueden bajar estos datos es WebHosting.Info (www.webhosting.info), un sitio dedicado a dar servicios y estadísticas sobre ISP, WHOIS, Reverse IP Lookup, etc. Los datos que estos sitios ofrecen casi siempre están en archivos CSV, donde el país está codificado en ISO 3166 y la dirección IP está como un entero sin signo de 4 bytes llamado “número IP”.
Para obtener la lista de códigos de países según la ISO 3166 pueden ver en el sitio mismo de ISO, http://www.iso.org/iso/country_codes, o en Wikipedia, http://es.wikipedia.org/wiki/ISO_3166-1.Para convertir la dirección IP en un número IP (un entero de 4 bytes) es una simple fórmula matemática donde lo que tenemos que hacer es un “shift left” de cada número para “posicionarlo” en el octeto correspondiente o, en español, moverlo hasta el byte correspondiente. Como cada byte representa 256 números (de 0 a 255), lo que debemos hacer es multiplicar cada octeto de la dirección por 256 elevado a la posición de ese byte. Supongamos que nuestra dirección a convertir es A.B.C.D, entonces lo que debemos hacer es:
(A * 256^3) + (B * 256^2) + (C * 256^1) + (D * 256^0)
Si reemplazamos las constantes por su resultado nos quedaría lo siguiente:
(A * 16777216) + (B * 65536) + (C * 256) + D
Ahora supongamos que la IP de mi cliente es la 190.2.8.88, entonces deberíamos hacer:
(190 * 16777216) + (2 * 65536) + (8 * 256) + 88 =3187671040 + 131072 + 2048 + 88 = 3187804248
Cabe mencionar que para obtener la dirección IP del usuario que se está conectando a nuestro sitio se debería leer el encabezado de la petición http. Para los desarrolladores de .NET esto se puede hacer simplemente utilizando la propiedad UserHostAddress del objeto Request del Page, por ejemplo, en C# sería:
string strIP = Page.Request.UserHostAddress;
o, para los usuarios de Visual Basic.NET:
Dim strIP as string = Page.Request.UserHostAddress
Página 130 de 135
Obviamente la IP está en un string, con lo cual debería dividir cada octeto de la dirección, convertirlo a un tipo de dato numérico y hacer la fórmula. A continuación les dejo un ejemplo en C#:
1 //Convierto la IP a un entero de 32 bits2 string[] strBytes = Page.Request.UserHostAddress.Split('.');3 uint intNumeroIP=4 (uint.Parse(strBytes[0]) * 16777216) +5 (uint.Parse(strBytes[1]) * 65536) +6 (uint.Parse(strBytes[2]) * 256) +7 uint.Parse(strBytes[3]);
y, para los usuarios de Visual Basic.NET:
1 'Convierto la IP a un entero de 32 bits2 Dim strBytes As String() = Page.Request.UserHostAddress.Split('.')3 Dim intNumeroIP As UInteger = _4 (UInteger.Parse(strBytes(0)) * 16777216) + _5 (UInteger.Parse(strBytes(1)) * 65536) + _6 (UInteger.Parse(strBytes(2)) * 256) + _7 UInteger.Parse(strBytes(3))
Nótese que en el ejemplo utilicé un entero sin signo, esto es porque el número IP no lleva signo. También cabe notar que, aunque cada octeto se puede representar con un byte, yo lo convierto a un entero sin signo para evitar la conversión del tipo de dato al almacenarlo en la variable final.
Ahora con este número en mente lo podemos buscar en el archivo con la información de la localización de las IPs. Obviamente lo mejor es guardar previamente la información de este archivo en una base de datos. Como mínimo deberíamos guardar la dirección IP y el país. Muchos de estos archivos de IP nos traen una “dirección desde” y una “dirección hasta” por cada línea del archivos, pero con almacenar la “dirección desde” ya nos alcanza.Para los usuarios de motores de bases de datos como Oracle o MySql no tendrán problema con guardar los números IP en campos enteros de 4 bytes sin signo, pero para los usuarios de SQL Server se nos complica, ya que este motor no permite utilizar este tipo de datos. Para solucionar este inconveniente podemos hacer dos cosas: guardar el número en un campo del tipo entero de 8 bytes o a cada número IP restarle 2147483648.
Ahora sólo nos quedaría buscar la IP del usuario en la base, con un script sencillo como el siguiente para SQL Server:
1 SELECT TOP 1 Pais2 FROM ListaIPs3 WHERE IP >= 31878042484 ORDER BY IP DESC
Si en SQL Server elegimos utilizar un entero de 4 bytes (int) y restarle la mitad para no utilizar un entero de 8 bytes (bigint) habría que utilizar el valor 1040320600 en lugar de 3187804248.
Si quisiéramos hacer esta misma consulta pero utilizando MySql como motor de base de datos deberíamos utilizar un script como el siguiente:
1 SELECT Pais2 FROM ListaIPs3 WHERE IP >= 3187804248
Página 131 de 135
4 ORDER BY IP DESC5 LIMIT 1
Bien, hasta acá ya sabemos cómo obtener el país correspondiente a una dirección IP pero, como el título bien dice, también podemos obtener la ciudad correspondiente a esta dirección. Para esto la solución vuelve a ser sencilla, solamente tenemos que buscar en internet donde se puede conseguir una lista de IPs correspondiente a cada ciudad. Un lugar donde se puede obtener esta lista es en IP Location Tools (http://iplocationtools.com), donde se puede conseguir la lista de país por IP y ciudad por IP, en formato CSV y en SQL. La única diferencia con el proceso anterior es que en la base de datos, además o en lugar de guardar el país, se debería guardar la ciudad.
http://krow.net/dict/subnet.html
Página 132 de 135
Subnet Cheat Sheet
Hosts Netmask Amount of a Class C
/30 4 255.255.255.252 1/64
/29 8 255.255.255.248 1/32
/28 16 255.255.255.240 1/16
/27 32 255.255.255.224 1/8
/26 64 255.255.255.192 1/4
/24 256 255.255.255.0 1
/23 512 255.255.254.0 2
/22 1024 255.255.252.0 4
/21 2048 255.255.248.0 8
/20 4096 255.255.240.0 16
/19 8192 255.255.224.0 32
/18 16384 255.255.192.0 64
/17 32768 255.255.128.0 128
/16 65536 255.255.0.0 256
Guide to sub-class C blocks/25 -- 2 Subnets -- 126 Hosts/SubnetNetwork # IP Range Broadcast.0 .1-.126 .127
.128 .129-.254
.255
/30 -- 64 Subnets -- 2 Hosts/SubnetNetwork
#IP
RangeBroadcast
.0 .1-.2 .3
.4 .5-.6 .7
.8 .9-.10 .11
.12 .13-.14 .15
.16 .17-.18 .19
.20 .21-.22 .23
.24 .25-.26 .27
.28 .29-.30 .31
.32 .33-.34 .35
.36 .37-.38 .39
.40 .41-.42 .43
.44 .45-.46 .47
.48 .49-.50 .51
.52 .53-.54 .55
.56 .57-.58 .59
.60 .61-.62 .63
.64 .65-.66 .67
.68 .69-.70 .71
.72 .73-.74 .75
.76 .77-.78 .79
.80 .81-.82 .83
/26 -- 4 Subnets -- 62 Hosts/SubnetNetwork # IP Range Broadcast.0 .1-.62 .63.64 .65-.126 .127
.128 .129-.190
.191
.192 .193-.254
.255
/27 -- 8 Subnets -- 30 Hosts/SubnetNetwork # IP Range Broadcast.0 .1-.30 .31.32 .33-.62 .63.64 .65-.94 .95.96 .97-.126 .127
.128 .129-.158
.159
.160 .161-.190
.191
.192 .193-.222
.223
Página 133 de 135
.224 .225-.254
.255 .84 .85-.86 .87.88 .89-.90 .91.92 .93-.94 .95.96 .97-.98 .99
.100 .101-.102
.103
.104 .105-.106
.107
.108 .109-.110
.111
.112 .113-.114
.115
.116 .117-.118
.119
.120 .121-.122
.123
.124 .125-.126
.127
.128 .129-.130
.131
.132 .133-.134
.135
.136 .137-.138
.139
.140 .141-.142
.143
.144 .145-.146
.147
.148 .149-.150
.151
.152 .153-.154
.155
.156 .157-.158
.159
.160 .161-.162
.163
.164 .165-.166
.167
.168 .169-.170
.171
.172 .173-.174
.175
.176 .177-.178
.179
.180 .181-.182
.183
.184 .185-.186
.187
.188 .189-.19 .191
/28 -- 16 Subnets -- 14 Hosts/SubnetNetwork # IP Range Broadcast.0 .1-.14 .15.16 .17-.30 .31.32 .33-.46 .47.48 .49-.62 .63.64 .65-.78 .79.80 .81-.94 .95.96 .97-.110 .111
.112 .113-.126
.127
.128 .129-.142
.143
.144 .145-.158
.159
.160 .161-.174
.175
.176 .177-.190
.191
.192 .193-.206
.207
.208 .209-.222
.223
.224 .225-.238
.239
.240 .241-.254
.255
/29 -- 32 Subnets -- 6 Hosts/SubnetNetwork # IP Range Broadcast.0 .1-.6 .7.8 .9-.14 .15.16 .17-.22 .23.24 .25-.30 .31.32 .33-.38 .39.40 .41-.46 .47.48 .49-.54 .55.56 .57-.62 .63.64 .65-.70 .71.72 .73-.78 .79.80 .81-.86 .87.88 .89-.94 .95.96 .97-.102 .103
.104 .105-.110
.111
.112 .113-.11 .119
Página 134 de 135
8
.120 .121-.126
.127
.128 .129-.134
.135
.136 .137-.142
.143
.144 .145-.150
.151
.152 .153-.158
.159
.160 .161-.166
.167
.168 .169-.174
.175
.176 .177-.182
.183
.184 .185-.190
.191
.192 .193-.198
.199
.200 .201-.206
.207
.208 .209-.214
.215
.216 .217-.222
.223
.224 .225-.230
.231
.232 .233-.238
.239
.240 .241-.246
.247
.248 .249-.254
.255
0
.192 .193-.194
.195
.196 .197-.198
.199
.200 .201-.202
.203
.204 .205-.206
.207
.208 .209-.210
.211
.212 .213-.214
.215
.216 .217-.218
.219
.220 .221-.222
.223
.225-.22
Página 135 de 135