Basic Cisco Intro: Ethernet

rlcisco

Introduction

This is a very basic introduction to configuring ethernet ports on cisco devices, it is not intended to be totally comprehensive and is only a quick and dirty guide.

IOS Modes

Cisco routers run an operating system called IOS, generally all the commands etc I will use in this (and all other) guide(s) will be based on cisco IOS 12+.
When you connect to the router, which could be done through telnet (or ssh), on a terminal or out of band communications you will see a prompt.
password:
Then… router>
In this mode, which is called user/unprivileged you can do some basic things like ping and traceroute, however none of the routers actual configuration can be changed at this point. to get into a mode where you can configure the router you must type the enable command where you will be prompted for another password, once you enter it correctly you will be in system/configuration mode.

Basic Ethernet

Let’s say you have two routers. routera and routerb. You have connected them with cat5 and both have 10meg ports which are connected correctly…
routera#configure terminal
routera#interface ethernet0
{first ethernet port, fast ethernet is called faster ethernet and 10meg ethernet ports are just called ethernet, to see what ports you have type show interface from *WHAT* mode}
routera (config-if)#ip address 192.168.0.1 255.255.255.0
routera (config-if)#no shutdown
Basically this gives the interface an address of 192.168.0.1 with a subnet mask of 255.255.255.0 and no shutdown brings in the interface up. Then hit CTRL Z to get back into the start of *MODE*
You would then do the same in routerb except chaning the ip to 192.168.0.2. To test connectivity type ping 192.168.0.2 from routera or ping 192.168.0.1 from routerb.

Basic Routing (Using RIP)

The above example shows how to setup ethernet devices. How about if there was a second ethernet interface on each on those machines,
Box1 (10.0.0.1) <—-> |(10.0.0.2) routea (192.168.0.1)| <—-> |(192.168.0.2) routerb (10.0.1.1)| <—–> Box2 (10.0.1.2)
Each router has two ips because it has two interfaces. Now routera could contact routerb, Box1 could contact routera and box2 could contact routerb, but Box1 could NOT contact Box2, because no routing is setup.

It should be pointed out that RIP is VERY basic, it is ineffiecent compared with other protocols however it is very easily setup and would suffice in a LAN environment, it would not be recommended to use it over WAN links (due to the frequent timed updates). In short to configure this you would type
routera#configure terminal
routera# route rip routera# network 10.0.0.0
routera# network 10.0.1.0
routera# network 192.168.0.0
Then hit ctrl Z and let the routers share routes. To see your dynamically learned routes type show ip route and a list will come up.

It should however be noted that in a very small environment static routes would be the preferred method of routing, however once more routers are added this becomes very inpractial and dynamic routing protocols like RIP, IGRP etc should be used. However you could add static routes for the preferred links and then run RIP to take over in the event of a link going down. If you intend using RIP for anything more than a handful of routers you should either 1) Look at different protocols or 2) Learn more about how rip works (which is beyond the scope of this tutorial).

Subnetting

In order to use your addresses, you need to understand subnetting. Subnetting allows you to create multiple logical networks that exist within a single Class A, B, or C network. If you don’t subnet, you will only be able to use one network from your Class A, B, or C network. Unless you have been assigned many major networks, you really need to subnet. Each data link on a network must be a unique subnet, with every node on that link being a member of the same subnet. For serial interfaces (standard HDLC), you will need one subnet for the circuit, or “wire” (both ends of the serial connection will be in the same subnet). If you are planning on implementing Frame Relay, SMDS, X.25 etc, read the Router Products Configuration and Reference Guides for assistance in configuring.

Let’s use these two addresses for some examples: 171.68.3.3 and 171.68.2.3. If the subnet mask is 255.255.255.0, the first 24 bits are masked, so the router compares the first 3 octets of the two addresses. Since the masked bits are not the same, the router knows that these addresses belong to different subnets.
If the subnet mask is 255.255.0.0, the first 16 bits are masked, so the router compares the first 2 octets of the two addresses. Since the masked bits are the same, the router knows that these addresses belong to the same subnet.
Nodes and routers use the mask to identify the data link on which an address resides. For instance, imagine that San Francisco proper is a class B network, and think of the streets as subnets. Each street must have a unique name. How would the postal service deliver a letter or find the correct destination if there were two Lombard Streets? Each house number can be thought of as a unique identifier for that street. The house numbers themselves can be duplicated on other streets: 33 Market Street is not the same as 33 Van Ness Avenue.
San Francisco.Lombard.33
171.68. 3. 3
San Francisco.Market.33
171.68. 2. 3
Sometimes you need to perform a logical “AND” operation to find out what subnet your node is in. Performing an “AND” operation means that anytime you “AND” a 0 value to another 0 or a 1 value, the result is 0. Only a 1 ANDed with another 1 value will result in a 1 value. Here’s how it works:
0 AND 0 IS 0
0 AND 1 IS 0
1 AND 1 IS 1
Let’s compare our sample addresses (171.68.3.3 and 171.68.2.3) against the subnet mask 255.255.240.0. We need to compare the binary representation of the third octet of the mask with the binary representation of the third octets of the addresses. In order to do this, we’ll perform a logical “AND” operation on the corresponding bits in each octet.
The masked bits are those that are “turned on,” or 1 in the mask. Since the masked bits in both addresses are the same, the router knows that these addresses belong to the same subnet.

Examples

Example 1: Class B
Let’s use a class B address to illustrate how subnetting works. Let’s say you were assigned the class B address 172.16 from the NIC. First determine how many subnets you need, and how many nodes per subnet you need to define. A typical (and easy to use) class B subnet mask would be 8 bits. Since the 3rd octet is the first “free” octet for Class B, you will start there. So, an 8 bit subnet mask would be 255.255.255.0. This means you have 254* subnets available and 254 addresses for nodes per subnet.
*Why are there only 254 subnets available instead of 256 (0-255)? You should not use subnet 0 or a subnet of all 1s. With an all 1s subnet mask, this is also your broadcast address. You can configure this, but it is neither proper nor recommended to make your subnet the same as your broadcast address. Subnet 0 is also not recommended. Cisco will allow the use of subnet 0 with the IP subnet zero command.

Example 2: Class B
Now let’s take this example: you have just assigned an interface the address 172.16.10.50 with a mask of 255.255.255.0. What subnet is it in? First represent the bits in binary (for class B, you start with the 3rd octet since octets 1 and 2 are fixed).
SUBNET HOST
00001010 00110010 (address representation – 10.50)
11111111 00000000 (subnet mask representation – 255.0)
—————–
00001010 00000000 (results of logical “AND” – subnet 10) 10

This address is in subnet 10 (172.16.10.0). Valid addresses for subnet 10 would be 172.16.10.1 through 172.16.10.254. Address 172.16.10.255 is the broadcast address for this subnet. According to the standard, any host id consisting of all 1s is reserved for broadcast.

Keeping the same subnet mask, you can choose different addresses to be in different subnets. For instance, address 192.1.10.17 255.255.255.240 is in subnet 16 and therefore has another unique subnet address, with valid addresses in the range of 192.1.10.17 through 192.1.10.30. Chart:

Subnetting Chart
Class B Effective Effective
# bits Mask Subnets Hosts
——- ————— ——— ———
2 255.255.192.0 2 16382
3 255.255.224.0 6 8190
4 255.255.240.0 14 4094
5 255.255.248.0 30 2046
6 255.255.252.0 62 1022
7 255.255.254.0 126 510
8 255.255.255.0 254 254
9 255.255.255.128 510 126
10 255.255.255.192 1022 62
11 255.255.255.224 2046 30
12 255.255.255.240 4094 14
13 255.255.255.248 8190 6
14 255.255.255.252 16382 2

Class C Effective Effective
# bits Mask Subnets Hosts
——- ————— ——— ———
2 255.255.255.192 2 62
3 255.255.255.224 6 30
4 255.255.255.240 14 14
5 255.255.255.248 30 6
6 255.255.255.252 62 2
*Subnet all zeroes and all ones excluded.
*Host all zeroes and all ones excluded.