Cisco IOS basic IP configuration

advertisement
Course: Generel networking (no course)
Title: Cisco IOS basic IP configuration
Author: Thomas Ivarsson
Last edit: March 16, 2012
Cisco IOS basic IP configuration
A brief introduction to the interface configuration in Cisco IOS
Quick introduction
The basic interface configuration are the same, no matter what the interface
(media) type is. The basic assignment command is:
Router(config-if)#ip address <ip_address> <subnet_mask>
This will set or change the IP address if there already is one configured. To
remove an IP address and not assign a new, use the negation of the command:
Router(config-if)#no ip address
This command is not needed if you just want to change the IP address since giving
the ip address command will overwrite the previous IP address. Don't forget to
use the no shutdown command if the interface is configured for the first time.
Here is an example of how the IP address 192.168.228.15 with the default class C
subnet mask on the FastEthernet 0/0 interface:
Router(config)#interface FastEthernet 0/0
Router(config-if)#ip address 192.168.228.15 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#end
Don't forget that you can use command shortening.
Verifying IP interface configuration
To verify that the IP address was configured to the interface, or to see what IP
addresses are configured on the device, use the show ip interface brief
command (see Understanding the show ip interface brief command below for mor
information on the command).
Interface description
You can assign a description to an interface. The description will show up in the
configuration and also if one examinees the interface with the show interface
command. The descriptions should be short and informative. Here is an example
of how a description for an Internet facing interfaces could be configured:
1/4
Course: Generel networking (no course)
Title: Cisco IOS basic IP configuration
Author: Thomas Ivarsson
Last edit: March 16, 2012
Router(config)#interface FastEthernet 0/1
Router(config-if)#description To the Internet
Let's see how this looks if we use the show interface command:
Router#show interface FastEthernet 0/1
FastEthernet0/1 is up, line protocol is up
Hardware is Gt96k FE, address is 001c.f633.6014
Description: To the Internet
Internet address is ...
Different kinds of interfaces
The routers in the lab have two primary kinds of interfaces, the FastEthernet
interfaces and the Serial interfaces. The configuration for the FastEthernet
interfaces is pretty straight forward and has already been shown, but the Serial
interfaces is a bit trickier.
The switches in the lab uses virtual interfaces attached to a VLAN to
communicate (some of the switches can convert their interfaces to ordinary
Ethernet interfaces like the FastEthernet interfaces on the routers but that function
will not be covered in this document). The switch virtual interfaces (SVIs) will
become active once the VLAN is active in the switch and they will then stay
active. Depending on the model of switch it can have one or several active SVIs at
a time. Since our primary purpose with the SVI is to get a way to access the
switch via TCP/IP, one SVI per switch is often enough.
Another type of interfaces that can be found on most network equipment is
loopback interfaces. You won't find those by default on the Cisco IOS devices, but
you can create them yourself. The loopback interfaces is always up independently
of all other interfaces. This feature can be used for administrative purposes since
the loopback interface can be reached via any other interfaces, where as addresses
set on ordinary (physical) interfaces only can be reached if the interface is up.
This section will end with a brief introduction to the null interface.
Serial interfaces
The serial interfaces connecting two routers are slower than the Ethernet
interfaces but they can be used over longer distances and their primary use is to
build WANs (wide area networks). The speed of the serial link is controlled by the
clock rate of the DCE (data communication equipment) often owned by the
network provider. When working with serial interfaces in the lab, on of the routers
has to act as the DCE and the other as the DTE (data terminating equipment, the
subscriber side). The function of DCE/DTE is decided by the cable that connects
the routers. To find out if an interface is the DCE or the DTE, the show
2/4
Course: Generel networking (no course)
Title: Cisco IOS basic IP configuration
controllers
Author: Thomas Ivarsson
Last edit: March 16, 2012
command can be used. Here is an example for interface Serial
0/0/1:
Router#show controllers Serial 0/0/1
Interface Serial0/0/1
Hardware is GT96K
DCE V.35, clock rate 2000000
As can be seen from the output, the interface is the DCE and the clock rate for the
link is 2000000 (gives the link a capacity of circa 2Mbit/s).
Here is an example of how that interfaces was configured:
Router(config)#interface Serial 0/0/1
Router(config-if)#ip address 10.228.4.17 255.255.255.252
Router(config-if)#clock rate 2000000
Router(config-if)#description --> crow-d serial 0/0/0
Router(config-if)#no shutdown
To configure the interface on the other end of the link, the Serial 0/0/0 interface on
router “crow-delta”, the following commands could be issued:
crow-d(config)#interface Serial 0/0/0
crow-d(config-if)#ip address 10.228.4.18 255.255.255.252
crow-d(config-if)#description --> Router serial 0/0/1
crow-d(config-if)#no shutdown
Can you spot the difference? The DCE has the clock rate command, indicating
the speed of the link. This is how the router will know that it's the DCE of the
link.
Switch virtual interfaces (SVIs)
The SVI is a lot like the loopback interface – once it comes up it usually stays up,
even if the VLAN don't have any active physical connections to the switch. A SVI
is created by the administrator and function likes any other IP interface. Here is
how to create a SVI for VLAN 10:
Switch(config)#interface vlan 10
Switch(config-if)#ip address 172.16.10.5 255.255.255.0
The SVI don't need the no shutdown command unless the administrator
the shutdown command.
issued
Loopback interfaces
The loopback interface is created in the same way as the SVI. Every loopback
interface has a number and it's possible to create multiple loopback interfaces.
Here is how loopback interface 1 can be created and assigned an address:
3/4
Course: Generel networking (no course)
Title: Cisco IOS basic IP configuration
Author: Thomas Ivarsson
Last edit: March 16, 2012
Router(config)#interface Loopback 1
Router(config-if)#ip address 192.168.128.1 255.255.255.255
This interface will now be active until removed.
The null interface
The null interface is the trash can of the network devices. Sometimes you just
want traffic to disappear. When that is the case, send it to the null interface. Null
interfaces are mostly used in routing when you want traffic for certain summary
networks to disappear if you don't have a more specific route for the destination.
The null interface 0 don't need to be configured, just set it as the destination for a
router if needed.
Understanding the show ip interface brief
command
There is one more thing that can help when working with interfaces. We've
already seen the information in the example of show interface FastEthernet
0/1 but if we want to have a view of the whole devices, show ip interface
brief is a better command. Here is a possible output:
Interface
FastEthernet0/0
FastEthernet0/1
Serial0/0/0
Serial0/0/1
Serial0/1/0
Serial0/1/1
Serial0/2/0
Serial0/2/1
Loopback0
IP-Address
10.228.4.22
unassigned
10.228.4.17
10.228.4.14
10.228.4.45
10.228.4.53
unassigned
unassigned
10.228.4.3
OK?
YES
YES
YES
YES
YES
YES
YES
YES
YES
Method
NVRAM
NVRAM
NVRAM
NVRAM
NVRAM
NVRAM
NVRAM
NVRAM
NVRAM
Status
up
administratively down
up
up
down
down
down
administratively down
up
Protocol
up
down
up
up
down
down
down
down
up
Look at the “Status” and “Protocol” columns. The first one tells the status of the
interface. Up and down means that the interface is active (up) or inactive (down).
An inactive line is not able to get a link. The third status, administratively down,
tells us that the interface has been configured with the shutdown command. The
protocol column tells us if the protocol is active or not on the interface. If the
protocol is down but the link is up, then something is not configured as it should
be and then real troubleshooting is needed …
The show ip interface brief command will give you a handy list of the
interfaces on the devices, their status and the IP address configured on them. Since
interface numbering and naming can vary from device to device this command is
always a good first choice when starting out on a new device.
4/4
Download