Configuring IP Addresses

Before you configure IP address, you first must decide what IP addresses to configure. Figure 13-1 not only outlined the network diagram, but it also listed the IP addresses chosen for the network. In this case, network 10.0.0.0 hs been subnetted with six subnets and a mask of 255.255.255.0.

After you have chosen the IP addresses and masks, configuration is simple. Examples 13-2, 13-3, and 13-4 show the IP configuration details for the three routers in Figure 13-1. The full configuration for Albuquerque is shown in Example 13-2, with a briefer version of the configs of the other two routers in Examples 13-3 and 13-4.

Example 13-2 Albuquerque Router Configuration and Exec Commands Albuquerque#configure terminal

Enter configuration commands, one per line. End with CNTL/Z. Albuquerque(config)#interface serial 0

Albuquerque(config-if)#ip address 10.1.128.251 255.255.255.0

Albuquerque(config)#interface serial 1

Albuquerque(config-if)#ip address 10.1.130.251 255.255.255.0 Albuquerque(config)#interface ethernet 0

Albuquerque(config-if)#ip address 10.1.1.251 255.255.255.0

Example 13-2 Albuquerque Router Configuration and Exec Commands (Continued)

Albuquerque#show running-config Building configuration...

Current configuration : 872 bytes !

version 12.2

service timestamps debug uptime service timestamps log uptime no service password-encryption !

hostname Albuquerque !

enable secret 5 $1$J3Fz$QaEYNIiI2aMu.3Ar.q0Xm. !

ip name-server 10.1.1.100

ip name-server 10.1.2.100 !

no ip http server banner motd "C

Should've taken a left turn here! This is Albuquerque... "C

line con 0 password cisco login line aux 0 line vty 0 4 password cisco login

Albuquerque#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

Example 13-2 Albuquerque Router Configuration and Exec Commands (Continued)

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/24 is subnetted, 3 subnets directly connected, Ethernet0 is directly connected, Serial1 is directly connected, Serial0

Albuquerque#terminal ip netmask-format decimal

Albuquerque#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0 255.255.255.0 is subnetted, 3 subnets C 10.1.1.0 is directly connected, Ethernet0

C 10.1.130.0 is directly connected, Serial1

C 10.1.128.0 is directly connected, Serial0

Example 13-3 Yosemite Router Configuration and Exec Commands

Yosemite#show running-config

Building configuration...

! Lines ommitted for brevity

interface Serial0 ip address 10.1.128.252 255.255.255.0

interface Serial1 ip address 10.1.129.252 255.255.255.0

interface Ethernet0 ip address 10.1.2.252 255.255.255.0

! lines ommitted for brevity

C

10

.1

1.0 i

C

10

.1

130.0

C

10

.1

128.0

Example 13-4 Seville Router Configuration and Exec Commands

Seville#show running

-config

! Lines ommitted for

brevity

interface Serial0

ip address 10.1.130

253 255.255.255.0

!

interface Serial1

ip address 10.1.129

253 255.255.255.0

!

Ethernet0

ip address 10.1.3.253 255.255.255.0

! Lines ommitted for

brevity

The ip address interface subcommand configures the IP address for each interface, as seen in the highlighted portions of the examples. Because each interface has an IP address, the interface configuration command precedes each ip address command, identifying to IOS the interface to which the IP address should be assigned. It's that simple!

Prefix Notation

At the end of Example 13-2 (Albuquerque), you also see the results of the show ip route command. The output of the command lists the network (10.0.0.0), followed by the notation of /24. This notation, called prefix notation, denotes the subnet mask in terms of the number of 1 bits in the subnet mask. The number of bits of value binary 1 in the mask is considered to be the prefix. For instance, mask 255.255.255.0, used in the examples, translates to a prefix of /24 because 255.255.255.0 has 24 binary 1s. Prefix notation is simply a shorter way to write the mask.

If you prefer to see the subnet masks instead of the prefix, simply use the terminal ip netmaskformat decimal exec command, as shown at the end of Example 13-2. Note that the show ip route command issued after the terminal command shows the subnet mask instead of the prefix.

Seeding the Routing Table with Connected IP Routes

The Cisco IOS routes IP packets by default—in other words, you do not need to type any commands to tell the router to enable IP routing. Before the router will route packets in or out an interface, the interface must have an IP address, as shown in the earlier examples. So, as configured, each of the three routers can route packets on three different interfaces.

The problem with the configurations shown so far is that the routers do not know routes to all the subnets in the network. The ultimate solution to this problem is to configure a dynamic routing protocol. However, in this chapter, you will learn about how the router learns some routes by virtue of the configuration of IP addresses on the interface. Chapter 14 introduces the different IP routing protocols, and the CCNA ICND Exam Certification Guide covers the detailed concepts and configuration for several IP routing protocols.

Routers add routes to their routing tables for the subnets associated with their own physical interfaces. To get a better appreciation of this fact, examine Example 13-5, which shows several commands from the Seville router.

Example 13-5 Seville Router Routing Table and Interface Status Commands

Seville#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set

10.0.0.0/24 is subnetted, 3 subnets C 10.1.3.0 is directly connected, Ethernet0

C 10.1.130.0 is directly connected, Serial0

C 10.1.129.0 is directly connected, Serial1

Seville#show ip

interface

brief

Interface

IP

Address

OK?

Method

Status

Protocol

Serial0

10

1.130.253

YES

manual

up

up

Seriall

10

1.129.253

YES

manual

up

up

Ethernet0

10

1.3.253

YES

manual

up

up

Seville#show interface serial 0

Serial0 is up, line protocol is up Hardware is HD64570 Internet address is 10.1.130.253/24 MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usee, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation HDLC, loopback not set Keepalive set (10 sec)

Last input never, output never, output hang never Last clearing of "show interface" counters never

Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: weighted fair

Output queue: 0/1000/64/0 (size/max total/threshold/drops) Conversations 0/0/256 (active/max active/max total)

Example 13-5 Seville Router Routing Table and Interface Status Commands (Continued)

Reserved Conversations 0/0 (allocated/max allocated) Available Bandwidth 1158 kilobits/sec 5 minute input rate 0 bits/sec, 0 packets/sec 5 minute output rate 0 bits/sec, 0 packets/sec 0 packets input, 0 bytes, 0 no buffer Received 0 broadcasts, 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort 0 packets output, 0 bytes, 0 underruns 0 output errors, 0 collisions, 1 interface resets 0 output buffer failures, 0 output buffers swapped out

0 carrier transitions

DCD=up DSR=up DTR=up RTS=up CTS=up

Seville#show ip interface serial 1

Serial1 is up, line protocol is up

Internet address is 10.1.129.253/24

Broadcast address is 255.255.255.255

Address determined by non-volatile memory

MTU is 1500 bytes

Helper address is not set

Directed broadcast forwarding is disabled

Outgoing access list is not set

Inbound access list is not set

Proxy ARP is enabled

Security level is default

Split horizon is disabled

ICMP redirects are always sent

ICMP unreachables are always sent

ICMP mask replies are never sent

IP fast switching is enabled

IP fast switching on the same interface is

enabled

IP Flow switching is disabled

IP Feature Fast switching turbo vector

IP multicast fast switching is disabled

IP multicast distributed fast switching is

disabled

IP route-cache flags are Fast

Router Discovery is disabled

IP output packet accounting is disabled

IP access violation accounting is disabled

TCP/IP header compression is disabled

RTP/IP header compression is disabled

Probe proxy name replies are disabled

Policy routing is disabled

Network address translation is disabled

WCCP Redirect outbound is disabled

WCCP Redirect inbound is disabled

WCCP Redirect exclude is disabled

BGP Policy Mapping is disabled

First, here is a quick introduction to the four commands in the example. The show ip route command lists routes to the three subnets connected to the Seville router, namely 10.1.130.0, 10.1.129.0, and 10.1.3.0, all with mask 255.255.255.0 (prefix /24). The output from the command lists a C in the first column, which, according to the notes at the beginning of the command output, means "connected." In other words, this router is connected directly to these subnets.

Following the show ip route command, the example contains three commands that list information about the interfaces in the router. The show ip interfaces brief command lists one line per interface, with IP address information and interface status. Next, the show interfaces serial 0 command lists more details about a single interface, with most of those details about the interface itself. Finally, the show ip interfaces serial 1 command shows detailed information about the IP protocol running over interface serial 1.

IOS adds connected routes to the routing table that meet the following requirements:

■ The interface has been configured with a valid IP address.

■ The interface is in an up and up status according to the various interface-oriented show commands.

All three of the show commands in Example 13-5 that list interface status information use two designations of up and up. The first status keyword (the first of the two ups in this case) generally refers to OSI Layer 1 status. For instance, if there is no cable plugged in, the first status word would be down instead of up. The second status word generally refers to the status of OSI Layer 2. For instance, if Seville defaulted to use HDLC on serial 0, but Albuquerque configured PPP as the data-link protocol on its serial 1 interface on the other end of the link, the interface status on each end would show up and down.

Another instance in which a router might put an interface in status up and down is when the router does not receive keepalive messages on a regular basis. Cisco routers send, and expect to receive, proprietary keepalive messages on each interface. The purpose of the keepalives is to know whether the interface is usable. For instance, on a point-to-point link between Albuquerque and Yosemite, each router sends a keepalive every 10 seconds. As long as they each receive a keepalive every 10 seconds, they think the link is up and up. If Yosemite did not hear a keepalive for three times the keepalive interval (default 10-second interval, for a total of 30 seconds), Yosemite would put the interface into an up and down status. You can disable keepalives with the no keepalive interface subcommand, or you can change the timer with the keepalive interval interface subcommand.

Those comments aside, as long as an interface status is up and up, the router believes that the interface is usable, so the router can add the associated connected IP route to the routing table.

In some cases, you want an interface to be down for administrative reasons, but you do not want to have to unconfigure it or pull out the cable to keep the interface from being up and up. To bring down an interface for administrative reasons and, as a side effect, remove the connected route from the routing table, you can use the shutdown interface subcommand, as shown in Example 13-6.

Example 13-6 Using the shutdown Command

Seville#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Seville(config)#interface serial 1

Seville(config-if)#shutdown

Seville(config-if)#~Z

Seville#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set

10.0.0.0/24 is subnetted, 2 subnets C 10.1.3.0 is directly connected, Ethernet0

C 10.1.130.0 is directly connected, Serial0

Seville#show ip interface brief

Interface IP-Address OK? Method Status Protocol

Serial0 10.1.130.253 YES manual up up

Serial1 10.1.129.253 YES manual Administratively down down

Ethernet0 10.1.3.253 YES manual up up

Seville#configure terminal

Enter configuration commands, one per line. End with CNTL/Z. Seville(config)#interface serial 1 Seville(config-if)#no shutdown Seville(config-if)#"Z

In the example, after the shutdown command under interface serial 1, the route connected to serial 1 (10.1.129.0, mask 255.255.255.0) was removed from the routing table, leaving only two entries. Also, the output of the show ip interfaces brief command lists a status of administratively down and down. (The show ip interfaces and show interfaces commands would show the same status for serial 1.) At the end of the example, the no shutdown command brings the interface back up.

Was this article helpful?

0 0

Post a comment