Cisco роутер какой ip адрес

Базовая настройка маршрутизатора для CCNA и ICND. Назначение IP-адресов на интерфейсы маршрутизатора.

Предположим, что после деления сети 192.168.0.0/24 на 3 подсети A, B и C (по 100, 50, 2 хоста соответственно) мы получили такие подсети: A — 192.168.0.0/25, B — 192.168.0.128/26, C — 192.168.0.192/30.

Первый адрес подсети A надо назначить на интерфейс маршрутизатора fastethernet 0/0.

Первый адрес подсети B надо назначить на интерфейс маршрутизатора fastethernet 0/1.

Первый адрес подсети C надо назначить на интерфейс маршрутизатора serial 0/0/0. Причем на один конец кабеля (DCE) для интерфейса serial необходимо назначить clock rate (задать время для синхронизации сигнала), а для другого (DTE) этого делать не надо.

// Так я буду обозначать комментарии.

    Устанавливаем консольное соединение через гипертерминал со следующими настройками:

    Hyper Terminal под Windows 7, конфигурация по умолчанию, консоль для cisco

  • Скорость: 9600; Биты данных: 8; Четность: Нет; Стоповые биты: 1; Управление потоком: Нет;
  • Router>enable//Входим в привилегированный режим.
  • Router#
  • Router#erase startup-config//Очищаем маршрутизатор от предыдущих настроек.
  • Router#reload//Перезагружаем маршрутизатор.
  • Would you like to enter the initial configuration dialog? [yes/no]: no//После перезагрузки маршрутизатора IOS спросит, надо ли настраивать маршрутизатор в режиме диалога. Откажитесь.
  • Router>enable//Снова входим в привилегированный режим.
  • Router#
  • Router#configure terminal//входим в режим глобальной конфигурации
  • Router(config)#hostname R1//даём имя маршрутизатору, в данном случае R1
  • R1(config)#no ip domain-lookup//выключаем поиск DNS
  • R1(config)#enable secret class//включаем пароль на вход привилегированного режима
  • R1(config)#banner motd #//Настраиваем сообщение дня (message of the day). Между знаками «#» пишем сообщение.
    !!!ACCESS DENIED!!!
    #
  • R1(config)#line console 0//Входим в режим настройки консоли.
  • R1(config-line)#password cisco//Назначаем пароль на вход.
  • R1(config-line)#login//Включаем запрос пароля перед входом в консоль.
  • R1(config-line)#exit
  • R1(config)#line vty 0 4//Входим в режим настройки телнета.
  • R1(config-line)#password cisco//Назначаем пароль на вход.
  • R1(config-line)#login//Включаем запрос пароля перед входом с помощью телнета.
  • R1(config-line)#end
  • R1#show running-config//Проверяем введенные данные.
  • R1#copy running-config startup-config//Сохраняем произведенную настройку в энерго-независимую память. Сейвы помогают не только геймерам ;) Были случаи когда ПакетТрейсер вис и приходилось всё делать заново.
  • R1#configure terminal//снова заходим в режим глобальной конфигурации
  • R1(config)#interface fastethernet 0/0//заходим в режим конфигурации интерфейса
  • R1(config-if)#ip address 192.168.0.1 255.255.255.128//назначаем IP-адрес интерфейсу и маску 255.255.255.128 (эта маска является расшифровкой префикса /25)
  • R1(config-if)#des Subnet A//краткое описание интерфейса
  • R1(config-if)#no shutdown//включаем интерфейс
  • R1(config)#interface fastethernet 0/1//заходим в режим конфигурации интерфейса
  • R1(config-if)#ip address 192.168.0.129 255.255.255.192//назначаем IP-адрес интерфейсу и маску 255.255.255.128 (эта маска является расшифровкой префикса /25)
  • R1(config-if)#des Subnet B//краткое описание интерфейса
  • R1(config-if)#no shutdown//включаем интерфейс
  • R1(config)#interface serial 0/0/0//заходим в режим конфигурации интерфейса
  • R1(config-if)#ip address 192.168.0.193 255.255.255.252//назначаем IP-адрес интерфейсу и маску 255.255.255.128 (эта маска является расшифровкой префикса /25)
  • R1(config-if)#des Link to R2//краткое описание интерфейса
  • R1(config-if)#clock rate 64000//задаем время сигнала для синхронизации со вторым роутером. На втором роутере этого делать не надо!
  • R1(config-if)#no shutdown//включаем интерфейс
  • R1(config-line)#end//выходим в привилегированный режим EXEC Mode
  • R1#show running-config//Проверяем введенные данные.
  • R1#copy running-config startup-config//Сохраняем произведенную настройку в энерго-независимую память.

Скачать выполненное задание настройки роутера

Предлагаю скачать файл с выполненным заданием для программы эмулятора PacketTracer, открыть его и посмотреть на реализацию (пароль на консольный вход — cisco, на привилегированный режим — class).

Заметьте, что компьютер PC1 может нормально пинговать компьютер PC2, но не может пинговать PC3. Это происходит из-за не настроенной маршрутизации. А настроим мы её в следующей шпаргалке ;)

Настройка роутера копированием конфигурации

    Для автоматической базовой настройки (всё, что выше) маршрутизатора выполните следующие действия:

  • 1. Скопируйте текст ниже в буфер обмена: выделите всё, кликните правой кнопкой по выделенному и выберите «Копировать».
  • 2. При необходимости очистите роутер от всех настроек и перезагрузите его.
  • 3. Войдите в режим глобальной конфигурации и вызовите меню Гипер Терминала «Правка», а в нём «Передать главному компьютеру».
  • 4. Обязательно проверьте настройки с помощью команды show running-config
  • 5. При необходимости включите интерфейсы командой no shutdown из режима каждого интерфейса

Configuring IPv4 Addresses

This chapter contains information about, and instructions for configuring IPv4 addresses on interfaces that are part of a
networking device.

Note


All further references to IPv4 addresses in this document use only IP in the text, not IPv4.


Reference the Chapter Map here

Information About IP Addresses

Binary Numbering

IP addresses are 32 bits long. The 32 bits are divided into four octets (8-bits). A basic understanding of binary numbering
is very helpful if you are going to manage IP addresses in a network because changes in the values of the 32 bits indicate
either a different IP network address or IP host address.

A value in binary is represented by the number (0 or 1) in each position multiplied by the number 2 to the power of the position
of the number in sequence, starting with 0 and increasing to 7, working right to left. The figure below is an example of an
8-digit binary number.

Figure 1. Example of an 8-digit Binary Number

The figure below provides binary to decimal number conversion for 0 through 134.

Figure 2. Binary to Decimal Number Conversion for 0 to 134

The figure below provides binary to decimal number conversion for 135 through 255.

Figure 3. Binary to Decimal Number Conversion for 135 to 255

IP Address Structure

An IP host address identifies a device to which IP packets can be sent. An IP network address identifies a specific network
segment to which one or more hosts can be connected. The following are characteristics of IP addresses:

  • IP addresses are 32 bits long

  • IP addresses are divided into four sections of one byte (octet) each

  • IP addresses are typically written in a format known as dotted decimal

The table below shows some examples of IP addresses.

Table 1. Examples of IP Addresses

IP Addresses in Dotted Decimal

IP Addresses in Binary

10.34.216.75

00001010.00100010.11011000.01001011

172.16.89.34

10101100.00010000.01011001.00100010

192.168.100.4

11000000.10101000.01100100.00000100

Note


The IP addresses in the table above are from RFC 1918,
Address Allocation for Private Internets . These IP addresses are not routable on the Internet. They are intended for use in private networks. For more information
on RFC1918, see
http://www.ietf.org/rfc/rfc1918.txt .


IP addresses are further subdivided into two sections known as network and host. The division is accomplished by arbitrarily
ranges of IP addresses to classes. For more information see RFC 791 Internet Protocol at
http://www.ietf.org/rfc/rfc0791.txt .

IP Address Classes

In order to provide some structure to the way IP addresses are assigned, IP addresses are grouped into classes. Each class
has a range of IP addresses. The range of IP addresses in each class is determined by the number of bits allocated to the
network section of the 32-bit IP address. The number of bits allocated to the network section is represented by a mask written
in dotted decimal or with the abbreviation /n where
n = the numbers of bits in the mask.

The table below lists ranges of IP addresses by class and the masks associated with each class. The digits in bold indicate
the network section of the IP address for each class. The remaining digits are available for host IP addresses. For example,
IP address 10.90.45.1 with a mask of 255.0.0.0 is broken down into a network IP address of 10.0.0.0 and a host IP address
of 0.90.45.1.

Table 2. IP Address Ranges by Class with Masks

Class

Range

A (range/mask in dotted decimal)


0
.0.0.0 to 127.0.0.0/8 (255.0.0.0)

A (range in binary)


00000000
.00000000.00000000.00000000 to01111111 .00000000.00000000.00000000

A (mask in binary)

11111111.00000000.00000000.00000000/8

B (range/mask in dotted decimal)


128
.0.0.0 to
191 .255 .0.0/16 (255.255.0.0)

B (range in binary)


10000000
.00000000 .00000000.00000000 to10111111 .11111111 .00000000.00000000

B (mask in binary)


11111111
.11111111 .00000000.00000000/16

C (range/mask in dotted decimal)


192
.0 .0 .0 to
223 .255 .255 .0/24 (255.255.255.0)

C (range in binary)


11000000
.00000000 .00000000 .00000000 to11011111 .11111111 .11111111 .00000000

C (mask in binary)

11111111.11111111.11111111.0000000/24

D1 (range/mask in dotted decimal)


224
.0 .0 .0 to
239 .255 .255 .255 /32 (255.255.255.255)

D (range in binary)


11100000
.00000000 .00000000 .00000000 to11101111 .11111111 .11111111 .11111111

D (mask in binary)

11111111.11111111.11111111.11111111/32

E2 (range/mask in dotted decimal)


240
.0 .0 .0 to
255 .255 .255 .255 /32 (255.255.255.255)

E (range in binary)


11110000
.00000000 .00000000 .00000000 to11111111 .11111111 .11111111 .11111111

E (mask in binary)

11111111.11111111.11111111.11111111/32

1 Class D IP addresses are reserved for multicast applications.

2 Class E IP addresses are reserved for broadcast traffic.

Note


Some IP addresses in these ranges are reserved for special uses. For more information refer to RFC 3330,
Special-Use IP Addresses , at
http://www.ietf.org/rfc/rfc3330.txt .


When a digit that falls within the network mask changes from 1 to 0 or 0 to 1 the network address is changed. For example,
if you change 10101100.00010000.01011001.00100010/16 to 10101100.00110000.01011001.00100010/16 you have changed the network
address from 172.16.89.34/16 to 172.48.89.34/16.

When a digit that falls outside the network mask changes from 1 to 0 or 0 to 1 the host address is changed. For example,
if you change 10101100.00010000.01011001.00100010/16 to 10101100.00010000.01011001.00100011/16 you have changed the host address
from 172.16.89.34/16 to 172.16.89.35/16.

Each class of IP address supports a specific range of IP network addresses and IP host addresses. The range of IP network
addresses available for each class is determined with the formula 2 to the power of the number of available bits. In the case
of class A addresses, the value of the first bit in the 1st octet (as shown in the table above) is fixed at 0. This leaves
7 bits for creating additional network addresses. Therefore there are 128 IP network addresses available for class A (27 =
128).

The number of IP host addresses available for an IP address class is determined by the formula 2 to the power of the number
of available bits minus 2. There are 24 bits available in a class A addresses for IP host addresses. Therefore there are 16,777,214
IP hosts addresses available for class A ((224) — 2 = 16,777,214)).

Note


The 2 is subtracted because there are 2 IP addresses that cannot be used for a host. The all 0’s host address cannot be used
because it is the same as the network address. For example, 10.0.0.0 cannot be both a IP network address and an IP host address.
The all 1’s address is a broadcast address that is used to reach all hosts on the network. For example, an IP datagram addressed
to 10.255.255.255 will be accepted by every host on network 10.0.0.0.


The table below shows the network and host addresses available for each class of IP address.

Table 3. Network and Host Addresses Available for Each Class of IP Address

Class

Network Addresses

Host Addresses

A

128

16,777,214

B

16,3843

65534

C

2,097,1524

254

3 Only 14 bits are available for class B IP network addresses because the first 2 bits are fixed at 10 as shown in Table 2 .

4 Only 21 bits are available for class C IP network addresses because the first 3 bits are fixed at 110 as shown in Table 2
.

IP Network Subnetting

The arbitrary subdivision of network and host bits in IP address classes resulted in an inefficient allocation of IP space.
For example, if your network has 16 separate physical segments you will need 16 IP network addresses. If you use 16 class
B IP network addresses, you would be able to support 65,534 hosts on each of the physical segments. Your total number of supported
host IP addresses is 1,048,544 (16 * 65,534 = 1,048,544). Very few network technologies can scale to having 65,534 hosts on
a single network segment. Very few companies need 1,048,544 IP host addresses. This problem required the development of a
new strategy that permitted the subdivision of IP network addresses into smaller groupings of IP subnetwork addresses. This
strategy is known as subnetting.

If your network has 16 separate physical segments you will need 16 IP subnetwork addresses. This can be accomplished with
one class B IP address. For example, start with the class B IP address of 172.16.0.0 you can reserve 4 bits from the third
octet as subnet bits. This gives you 16 subnet IP addresses 24 = 16. The table below shows the IP subnets for 172.16.0.0/20.

Table 4. Examples of IP Subnet Addresses using 172.16.0.0/20

Number

IP Subnet Addresses in Dotted Decimal

IP Subnet Addresses in Binary

05

172.16.0.0

10101100.00010000.00000000.00000000

1

172.16.16.0

10101100.00010000.00010000.00000000

2

172.16.32.0

10101100.00010000.00100000.00000000

3

172.16.48.0

10101100.00010000.00110000.00000000

4

172.16.64.0

10101100.00010000.01000000.00000000

5

172.16.80.0

10101100.00010000.01010000.00000000

6

172.16.96.0

10101100.00010000.01100000.00000000

7

172.16.112.0

10101100.00010000.01110000.00000000

8

172.16.128.0

10101100.00010000.10000000.00000000

9

172.16.144.0

10101100.00010000.10010000.00000000

10

172.16.160.0

10101100.00010000.10100000.00000000

11

172.16.176.0

10101100.00010000.10110000.00000000

12

172.16.192.0

10101100.00010000.11000000.00000000

13

172.16.208.0

10101100.00010000.11010000.00000000

14

172.16.224.0

10101100.00010000.11100000.00000000

15

172.16.240.0

10101100.00010000.11110000.00000000

5 The first subnet that has all of the subnet bits set to 0 is referred to as subnet 0 . It is indistinguishable from the network
address and must be used carefully.

When a digit that falls within the subnetwork (subnet) mask changes from 1 to 0 or 0 to 1 the subnetwork address is changed.
For example, if you change 10101100.00010000.01011001.00100010/20 to 10101100.00010000.01111001.00100010/20 you have changed
the network address from 172.16.89.34/20 to 172.16.121.34/20.

When a digit that falls outside the subnet mask changes from 1 to 0 or 0 to 1 the host address is changed. For example, if
you change 10101100.00010000.01011001.00100010/20 to 10101100.00010000.01011001.00100011/20 you have changed the host address
from 172.16.89.34/20 to 172.16.89.35/20.

Timesaver


To avoid having to do manual IP network, subnetwork, and host calculations, use one of the free IP subnet calculators available
on the Internet.


Some people get confused about the terms network address and subnet or subnetwork addresses and when to use them. In the
most general sense the term network address means “the IP address that routers use to route traffic to a specific network
segment so that the intended destination IP host on that segment can receive it”. Therefore the term network address can apply
to both non-subnetted and subnetted IP network addresses. When you are troubleshooting problems with forwarding traffic from
a router to a specific IP network address that is actually a subnetted network address, it can help to be more specific by
referring to the destination network address as a subnet network address because some routing protocols handle advertising
subnet network routes differently from network routes. For example, the default behavior for RIP v2 is to automatically summarize
the subnet network addresses that it is connected to their non-subnetted network addresses (172.16.32.0/24 is advertised by
RIP v2 as 172.16.0.0/16) when sending routing updates to other routers. Therefore the other routers might have knowledge of
the IP network addresses in the network, but not the subnetted network addresses of the IP network addresses.

Tip


The term IP address space is sometimes used to refer to a range of IP addresses. For example, “We have to allocate a new
IP network address to our network because we have used all of the available IP addresses in the current IP address space”.


IP Network Address Assignments

Routers keep track of IP network addresses to understand the network IP topology (layer 3 of the OSI reference model) of
the network to ensure that IP traffic can be routed properly. In order for the routers to understand the network layer (IP)
topology, every individual physical network segment that is separated from any other physical network segment by a router
must have a unique IP network address.

The figure below shows an example of a simple network with correctly configured IP network addresses. The routing table in
R1 looks like the table below.

Table 5. Routing Table for a Correctly Configured Network

Interface Ethernet 0

Interface Ethernet 1

172.31.32.0/24 (Connected)

172.31.16.0/24 (Connected)

Figure 4. Correctly Configured Network

The figure below shows an example of a simple network with incorrectly configured IP network addresses. The routing table
in R1 looks like the table below. If the PC with IP address 172.31.32.3 attempts to send IP traffic to the PC with IP address
172.31.32.54, router R1 cannot determine which interface that the PC with IP address 172.31.32.54 is connected to.

Table 6. Routing Table in Router R1 for an Incorrectly Configured Network (Example 1)

Ethernet 0

Ethernet 1

172.31.32.0/24 (Connected)

172.31.32.0/24 (Connected)

Figure 5. Incorrectly Configured Network (Example 1)

To help prevent mistakes as shown in the figure above, Cisco IOS-based networking devices will not allow you to configure
the same IP network address on two or more interfaces in the router when IP routing is enabled.

The only way to prevent the mistake shown in the figure below, where 172.16.31.0/24 is used in R2 and R3, is to have very
accurate network documentation that shows where you have assigned IP network addresses.

Table 7. Routing Table in Router R1 for an Incorrectly Configured Network (Example 2)

Ethernet 0

Serial 0

Serial 1

172.16.32.0/24 (Connected)

192.168.100.4/29 (Connected) 172.16.31.0/24 RIP

192.168.100.8/29 (Connected) 172.16.31.0/24 RIP

Figure 6. Incorrectly Configured Network (Example 2)

For a more thorough explanation of IP routing, see the «Related Documents» section for a list of documents related to IP
routing.

Classless Inter-Domain Routing

Due to the continuing increase in internet use and the limitations on how IP addresses can be assigned using the class structure
shown in the table above, a more flexible method for allocating IP addresses was required. The new method is documented in
RFC 1519
Classless Inter-Domain Routing (CIDR): an Address Assignment and Aggregation Strategy. CIDR allows network administrators to apply arbitrary masks to IP addresses to create an IP addressing plan that meets the
requirements of the networks that they administrate.

For more information on CIDR, refer to RFC 1519 at
http://www.ietf.org/rfc/rfc1519.txt.

Prefixes

The term prefix is often used to refer to the number of bits of an IP network address that are of importance for building
routing tables. If you are using only classful (strict adherence to A, B, and C network address boundaries) IP addresses,
the prefixes are the same as the masks for the classes of addresses. For example, using classful IP addressing, a class C
IP network address such as 192.168.10.0 uses a 24-bit mask (/24 or 255.255.255.0) and can also be said to have a 24-bit prefix.

If you are using CIDR, the prefixes are arbitrarily assigned to IP network addresses based on how you want to populate the
routing tables in your network. For example, a group of class C IP addresses such as 192.168.10.0, 192.168.11.0, 192.168.12.0,
192.168.13.0 can be advertised as a single route to 192.168.0.0 with a 16-bit prefix (192.168.0.0/16). This results in a 4:1
reduction in the number of routes that the routers in your network need to manage.

How to Configure IP Addresses

Establishing IP Connectivity to a Network by Assigning an IP Address to an Interface

Perform this task to configure an IP address on an interface.

SUMMARY STEPS


  1. enable


  2. configure


    terminal


  3. interface


    type


    number


  4. no
    shutdown


  5. ip
    address


    ip-address


    mask


  6. end

DETAILED STEPS

  Command or Action Purpose

Step 1


enable

Example:


Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2


configure


terminal

Example:


Router# configure terminal

Enters global configuration mode.

Step 3


interface


type


number

Example:


Router(config)# interface fastethernet 0/0

Specifies an interface and enters interface configuration mode.

Step 4


no
shutdown

Example:


Router(config-if)# no shutdown

Enables the interface.

Step 5


ip
address


ip-address


mask

Example:


Router(config-if)# ip address 172.16.16.1 255.255.240.0

Configures the IP address on the interface.

Step 6


end

Example:


Router(config-if)# end

Exits the current configuration mode and returns to privileged EXEC mode.

Troubleshooting Tips

The following commands can help troubleshoot IP addressing:


  • show
    ip
    interface
    —Displays the IP parameters for the interface.


  • show
    ip
    route
    connected
    —Displays the IP networks the networking device is connected to.

Increasing the Number of IP Hosts that Are Supported on a Network by Using Secondary IP Addresses

If you have a situation in which you need to connect more IP hosts to
a network segment and you have used all of the available IP host addresses for
the subnet to which you have assigned the segment, you can avoid having to
readdress all of the hosts with a different subnet by adding a second IP
network address to the network segment.

Perform this task to configure a secondary IP address on an
interface.

SUMMARY STEPS


  1. enable


  2. configure


    terminal


  3. interface


    type


    number


  4. no
    shutdown


  5. ip
    address


    ip-address


    mask


  6. ip
    address


    ip-address


    mask


    secondary


  7. end

DETAILED STEPS

  Command or Action Purpose

Step 1


enable

Example:


Router> enable

Enables privileged EXEC mode.

  • Enter your password
    if prompted.

Step 2


configure


terminal

Example:


Router# configure terminal

Enters global configuration mode.

Step 3


interface


type


number

Example:


Router(config)# interface fastethernet 0/0

Specifies an interface and enters interface configuration mode.

Step 4


no
shutdown

Example:


Router(config-if)# no shutdown

Enables the interface.

Step 5


ip
address


ip-address


mask

Example:


Router(config-if)# ip address 172.16.16.1 255.255.240.0

Configures the IP address on the interface.

Step 6


ip
address


ip-address


mask


secondary

Example:


Router(config-if)# ip address 172.16.32.1 255.255.240.0 secondary

Configures the secondary IP address on the interface.

Step 7


end

Example:


Router(config-if)# end

Exits the current configuration mode and returns to privileged
EXEC mode.

Troubleshooting Tips

The following commands can help troubleshoot IP addressing:


  • show
    ip
    interface
    —Displays the IP parameters for the interface.


  • show
    ip
    route
    connected
    —Displays the IP networks the networking device is connected to.

What to Do Next

If your network has two or more routers and you have already configured a routing protocol, make certain that the other routers
can reach the new IP network that you assigned. You might need to modify the configuration for the routing protocol on the
router so that it advertises the new network. Consult the
Cisco IOS IP Routing: Protocol-Independent Configuration Guide for information on configuring routing protocols.

Maximizing the Number of Available IP Subnets by Allowing the Use of IP Subnet Zero

If you using subnetting in your network and you are running out of network addresses, you can configure your networking device
to allow the configuration of subnet zero. This adds one more usable network address for every subnet in your IP addressing
scheme. The table above shows the IP subnets (including subnet 0) for 172.16.0.0/20.

Perform this task to enable the use of IP subnet zero on your networking device.

SUMMARY STEPS


  1. enable


  2. configure


    terminal


  3. ip
    subnet-zero


  4. interface


    type


    number


  5. no
    shutdown


  6. ip
    address


    ip-address


    mask


  7. end

DETAILED STEPS

  Command or Action Purpose

Step 1


enable

Example:


Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2


configure


terminal

Example:


Router# configure terminal

Enters global configuration mode.

Step 3


ip
subnet-zero

Example:


Router(config)# ip subnet-zero

Enables the use of IP subnet zero.

Step 4


interface


type


number

Example:


Router(config)# interface fastethernet 0/0

Specifies an interface and enters interface configuration mode.

Step 5


no
shutdown

Example:


Router(config-if)# no shutdown

Enables the interface.

Step 6


ip
address


ip-address


mask

Example:


Router(config-if)# ip address 172.16.0.1 255.255.240.0

Configures the subnet zero IP address on the interface.

Step 7


end

Example:


Router(config-if)# end

Exits the current configuration mode and returns to privileged EXEC mode.

Troubleshooting Tips

The following commands can help troubleshoot IP addressing:


  • show
    ip
    interface
    —Displays the IP parameters for the interface.


  • show
    ip
    route
    connected
    —Displays the IP networks the networking device is connected to.

Specifying the Format of Network Masks

By default,
show commands display an IP address and then its netmask in dotted decimal notation. For example, a subnet would be displayed
as 131.108.11.55 255.255.255.0.

You might find it more convenient to display the network mask in hexadecimal format or bit count format instead. The hexadecimal
format is commonly used on UNIX systems. The previous example would be displayed as 131.108.11.55 0XFFFFFF00.

The bit count format for displaying network masks is to append a slash (/) and the total number of bits in the netmask to
the address itself. The previous example would be displayed as 131.108.11.55/24.

Specifying the Format in Which Netmasks Appear for the Current Session

Perform this task to specify the format in which netmasks appear for the current session.

SUMMARY STEPS


  1. enable


  2. term


    ip


    netmask-format
    {bitcount | decimal | hexadecimal }

DETAILED STEPS

  Command or Action Purpose

Step 1


enable

Example:

Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2


term


ip


netmask-format
{bitcount | decimal | hexadecimal }

Example:

Router# term ip netmask-format hexadecimal

Specifies the format the router uses to display network masks.

Specifying the Format in Which Netmasks Appear for an Individual Line

Perform this task to specify the format in which netmasks appear for an individual line.

SUMMARY STEPS


  1. enable


  2. configure


    terminal


  3. line
    vty




    first
    last


  4. term


    ip


    netmask-format
    {bitcount | decimal | hexadecimal }

  5. end

DETAILED STEPS

  Command or Action Purpose

Step 1


enable

Example:

Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2


configure


terminal

Example:

Router# configure terminal

Enters global configuration mode.

Step 3


line
vty




first
last

Example:

Router(config)# line vty 0 4

Enters line configuration mode for the range of lines specified by the first and last arguments.

Step 4


term


ip


netmask-format
{bitcount | decimal | hexadecimal }

Example:

Router(config-line)# ip netmask-format hexadecimal

Specifies the format the router uses to display the network mask for an individual line.

Step 5


end

Example:

Router(config-if)# end

Exits the current configuration mode and returns to privileged EXEC mode.

Using IP Unnumbered
Interfaces on Point-to-Point WAN Interfaces to Limit Number of IP Addresses
Required

If you have a limited
number of IP network or subnet addresses and you have point-to-point WANs in
your network, you can use the IP Unnumbered Interfaces feature to enable IP
connectivity on the point-to-point WAN interfaces without actually assigning an
IP address to them.

Perform this task to
configure the IP Unnumbered Interfaces feature on a point-to-point WAN
interface.

IP Unnumbered Feature

The IP Unnumbered Interfaces feature enables IP processing on a
point-to-point WAN interface without assigning it an explicit IP address. The
IP unnumbered point-to-point WAN interface uses the IP address of another
interface to enable IP connectivity, which conserves network addresses.

Note


The following restrictions apply to the IP Unnumbered Interfaces
feature:

  • The IP Unnumbered
    Interfaces feature is only supported on point-to-point (non-multiaccess) WAN
    interfaces

  • You cannot netboot a
    Cisco IOS image over an interface that is using the IP Unnumbered Interfaces
    feature


SUMMARY STEPS


  1. enable


  2. configure


    terminal


  3. interface


    type


    number


  4. no
    shutdown


  5. ip
    address


    ip-address


    mask


  6. interface


    type


    number


  7. no
    shutdown


  8. ip
    unnumbered


    type


    number


  9. end

DETAILED STEPS

  Command or Action Purpose

Step 1


enable

Example:

Router> enable

Enables privileged EXEC mode.

  • Enter your password
    if prompted.

Step 2


configure


terminal

Example:

Router# configure terminal

Enters global configuration mode.

Step 3


interface


type


number

Example:

Router(config)# interface fastethernet 0/0

Specifies an interface and enters interface configuration mode.

Step 4


no
shutdown

Example:

Router(config-if)# no shutdown

Enables the interface.

Step 5


ip
address


ip-address


mask

Example:

Router(config-if)# ip address 172.16.16.1 255.255.240.0 

Configures the IP address on the interface.

Step 6


interface


type


number

Example:

Router(config-if)# interface serial 0/0

Specifies a point-to-point WAN interface and enters interface
configuration mode.

Step 7


no
shutdown

Example:

Router(config-if)# no shutdown

Enables the point-to-point WAN interface.

Step 8


ip
unnumbered


type


number

Example:

Router(config-if)# ip unnumbered fastethernet 0/0

Enables the IP unnumbered feature on the point-to-point WAN
interface.

In this example the point-to-point WAN interface uses IP address
172.16.16.1 from Fast Ethernet 0/0.

Step 9


end

Example:

Router(config-if)# end

Exits the current configuration mode and returns to privileged
EXEC mode.

Troubleshooting Tips

The following commands can help troubleshoot IP addressing:


  • show
    ip
    interface
    —Displays the IP parameters for the interface.


  • show
    ip
    route
    connected
    —Displays the IP networks the networking device is connected to.

Using IP addresses with 31-Bit Prefixes on Point-to-Point WAN Interfaces to Limit Number of IP Addresses Required

You can reduce the number of IP subnets used by networking devices to establish IP connectivity to point-to-point WANs that
they are connected to by using IP Addresses with 31-bit Prefixes as defined in RFC 3021.

Perform this task to configure an IP address with a 31-bit prefix on a point-to-point WAN interface.

RFC 3021

Prior to RFC 3021,
Using 31-bit Prefixes on IPv4 Point-to-Point Links , many network administrators assigned IP address with a 30-bit subnet mask (255.255.255.252) to point-to-point interfaces
to conserve IP address space. Although this practice does conserve IP address space compared to assigning IP addresses with
shorter subnet masks such as 255.255.255.240, IP addresses with a 30-bit subnet mask still require four addresses per link:
two host addresses (one for each host interface on the link), one all-zeros network address, and one all-ones broadcast network
address.

The table below shows an example of the four IP addresses that are created when a 30-bit (otherwise known as 255.255.255.252
or /30) subnet mask is applied to the IP address 192.168.100.4. The bits that are used to specify the host IP addresses in
bold.

Table 8. Four IP Addresses Created When a 30-Bit Subnet Mask (/30) Is Used

Address

Description

Binary

192.168.100.4/30

All-zeros IP address

11000000.10101000.01100100.00000100

192.168.100.5/30

First host addresses

11000000.10101000.01100100.00000101

192.168.100.6/30

Second host address

11000000.10101000.01100100.00000110

192.168.100.7/30

All-ones broadcast address

11000000.10101000.01100100.00000111

Point-to-point links only have two endpoints (hosts) and do not require broadcast support because any packet that is transmitted
by one host is always received by the other host. Therefore the all-ones broadcast IP address is not required for a point-to-point
interface.

The simplest way to explain RFC 3021 is to say that the use of a 31-bit prefix (created by applying a 31-bit subnet mask
to an IP address) allows the all-zeros and all-ones IP addresses to be assigned as host addresses on point-to-point networks.
Prior to RFC 3021 the longest prefix in common use on point-to-point links was 30-bits, which meant that the all-zeros and
all-ones IP addresses were wasted.

The table below shows an example of the two IP addresses that are created when a 31-bit (otherwise known as 255.255.255.254
or /31) subnet mask is applied to the IP address 192.168.100.4. The bit that is used to specify the host IP addresses in bold

Table 9. Two IP Addresses Created When a 31-Bit Subnet Mask (/31) Is Used

Address

Description

Binary

192.168.100.4/31

First host address

11000000.10101000.01100100.00000100

192.168.100.5/31

Second host address

11000000.10101000.01100100.00000101

The complete text for RFC 3021 is available at
http://www.ietf.org/rfc/rfc3021.txt .

Before you begin

You must have classless IP addressing configured on your networking device before you configure an IP address with a 31-bit
prefix on a point-to-point interface. Classless IP addressing is enabled by default in many versions of Cisco IOS software.
If you are not certain that your networking device has IP classless addressing configured, enter the
ip
classless
command in global configuration mode to enable it.

Note


This task can only be performed on point-to-point (nonmultiaccess) WAN interfaces.


SUMMARY STEPS


  1. enable


  2. configure


    terminal


  3. ip
    classless


  4. interface


    type


    number


  5. no
    shutdown


  6. ip
    address


    ip-address


    mask


  7. end

DETAILED STEPS

  Command or Action Purpose

Step 1


enable

Example:

Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2


configure


terminal

Example:

Router# configure terminal

Enters global configuration mode.

Step 3


ip
classless

Example:

Router(config)# ip classless

(Optional) Enables IP classless (CIDR).

Note

 

This command is enabled by default in many versions of Cisco IOS. If you are not certain if it is enabled by default in the
version of Cisco IOS that your networking device is running, enter the
ip
classless
command as shown. When you are done with this task view the configuration. If the
ip
classless
command does not appear in your configuration, it is enabled by default.

Step 4


interface


type


number

Example:

Router(config)# interface serial 0/0

Specifies a point-to-point WAN interface and enters interface configuration mode.

Step 5


no
shutdown

Example:

Router(config-if)# no shutdown

Enables the interface.

Step 6


ip
address


ip-address


mask

Example:

Router(config-if)# ip address 192.168.100.4 255.255.255.254

Configures the 31bit prefix IP address on the point-to-point WAN interface.

Step 7


end

Example:

Router(config-if)# end

Exits the current configuration mode and returns to privileged EXEC mode.

Troubleshooting Tips

The following commands can help troubleshoot IP addressing:


  • show
    ip
    interface
    —Displays the IP parameters for the interface.


  • show
    ip
    route
    connected
    —Displays the IP networks the networking device is connected to.

Configuration Examples for IP Addresses

Example Establishing IP Connectivity to a Network by Assigning an IP Address to an Interface

The following example configures an IP address on three interfaces:


!
interface FastEthernet0/0
 no shutdown
 ip address 172.16.16.1 255.255.240.0
!
interface FastEthernet0/1
 no shutdown
 ip address 172.16.32.1 255.255.240.0
!
interface FastEthernet0/2
 no shutdown
 ip address 172.16.48.1 255.255.240.0
!

Example Increasing the Number of IP Hosts that are Supported on a Network by Using Secondary IP Addresses

The following example configures secondary IP addresses on three interfaces:


!
interface FastEthernet0/0
 no shutdown
 ip address 172.16.16.1 255.255.240.0
 ip address 172.16.32.1 255.255.240.0 secondary
!
!
interface FastEthernet0/1
 no shutdown
 ip address 172.17.16.1 255.255.240.0
 ip address 172.17.32.1 255.255.240.0 secondary
!
!
interface FastEthernet0/2
 no shutdown
 ip address 172.18.16.1 255.255.240.0
 ip address 172.18.32.1 255.255.240.0 secondary
!

Example Using IP Unnumbered
Interfaces on Point-to-Point WAN Interfaces to Limit Number of IP Addresses
Required

The following
example configures the unnumbered IP feature on three interfaces:


!
interface FastEthernet0/0
 no shutdown
 ip address 172.16.16.1 255.255.240.0
!
interface serial0/0
 no shutdown
 ip unnumbered fastethernet0/0
!
interface serial0/1
 no shutdown
 ip unnumbered fastethernet0/0
!
interface serial0/2
 no shutdown
 ip unnumbered fastethernet0/0
!

Example Using IP addresses
with 31-Bit Prefixes on Point-to-Point WAN Interfaces to Limit Number of IP
Addresses Required

The following
example configures 31-bit prefixes on two interfaces:


!
ip classless
!
interface serial0/0
 no shutdown
 ip address 192.168.100.2 255.255.255.254
!
!
interface serial0/1
 no shutdown
 ip address 192.168.100.4 255.255.255.254

Example Maximizing the Number of Available IP Subnets by Allowing the Use of IP Subnet Zero

The following example enables subnet zero:


!
interface FastEthernet0/0
 no shutdown
 ip address 172.16.16.1 255.255.240.0
!
ip subnet-zero
!

Where to Go Next

If your network has two or more routers and you have not already configured a routing protocol, consult the
Cisco IOS IP Routing Protocols Configuration Guide, Release 12.4T, for information on configuring routing protocols.

Additional References

Related Documents

Related Topic

Document Title

Cisco IOS commands

Cisco IOS Master Commands List, All Releases

IP addressing commands: complete command syntax, command mode, command history, defaults, usage guidelines, and examples

Cisco IOS IP Addressing Services Command Reference

Fundamental principles of IP addressing and IP routing

IP Routing Primer ISBN 1578701082

Standards

Standard

Title

No new or modified standards are supported, and support for existing standards has not been modified

MIBs

MIB

MIBs Link

No new or modified MIBs are supported, and support for existing MIBs has not been modified

To locate and download MIBs for selected platforms, Cisco software releases, and feature sets, use Cisco MIB Locator found
at the following URL:

http://www.cisco.com/go/mibs

RFCs

RFC6

Title

RFC 791

Internet Protocol

http://www.ietf.org/rfc/rfc0791.txt

RFC 1338

Classless Inter-Domain Routing (CIDR): an Address Assignment and Aggregation Strategy

http://www.ietf.org/rfc/rfc1519.txt

RFC 1466

Guidelines for Management of IP Address Space

http://www.ietf.org/rfc/rfc1466.txt

RFC 1716

Towards Requirements for IP Routers

http://www.ietf.org/rfc/rfc1716.txt

RFC 1918

Address Allocation for Private Internets

http://www.ietf.org/rfc/rfc1918.txt

RFC 3330

Special-Use IP Addresses

http://www.ietf.org/rfc/rfc3330.txt

6 These references are only a sample of the many RFCs available on subjects related to IP addressing and IP routing. Refer to
the IETF RFC site at http://www.ietf.org/rfc.html for a full list of RFCs.

Technical Assistance

Description

Link

The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use
these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products
and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password.

http://www.cisco.com/cisco/web/support/index.htmll

Feature Information for IP Addresses

The following table provides release information about the feature or features described in this module. This table lists
only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise,
subsequent releases of that software release train also support that feature.

Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco
Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.

Table 10. Feature Information for IP Addresses

Feature Name

Releases

Feature Information

Classless Inter-Domain Routing

10.0

CIDR is a new way of looking at IP addresses that eliminates the concept of classes (class A, class B, and so on). For example,
network 192.213.0.0, which is an illegal class C network number, is a legal supernet when it is represented in CIDR notation
as 192.213.0.0/16. The /16 indicates that the subnet mask consists of 16 bits (counting from the left). Therefore, 192.213.0.0/16
is similar to 192.213.0.0 255.255.0.0.

The following command was introduced or modified:
ip
classless
.

IP Subnet Zero

10.0

In order to conserve IP address space IP Subnet Zero allows the use of the all-zeros subnet as an IP address on an interface,
such as configuring 172.16.0.1/24 on Fast Ethernet 0/0.

The following command was introduced or modified:
ip
subnet-zero
.

IP Unnumbered Interfaces

10.0

In order to conserve IP address space, IP unnumbered interfaces use the IP address of another interface to enable IP connectivity.

The following command was introduced or modified:
ip
unnumbered
.

Using 31-bit Prefixes on IP Point-to-Point Links

12.0(14)S 12.2(4)T

In order to conserve IP address space on the Internet, a 31-bit prefix length allows the use of only two IP addresses on
a point-to-point link. Previously, customers had to use four IP addresses or unnumbered interfaces for point-to-point links.

Всем привет! Сегодня я на простом примере расскажу вам про настройку роутера Cisco (2911, 1841, 881 и другие модели). Я выдумал некую простую схему с примером, которая позволит вам понять, как подключить локальную сеть к интернету через наш маршрутизатор. Я покажу пример настройки через консоль. Но вы можете делать конфигурирование через программу «Cisco Packet Tracer» – видеоинструкцию смотрим в конце статьи.

Содержание

  1. Пример подключения
  2. ШАГ 1: Подключение к маршрутизатору
  3. ШАГ 2: Reset настроек
  4. ШАГ 3: Конфигурация интерфейсов
  5. ШАГ 4: Удаленный доступ к роутеру
  6. ШАГ 5: Настройка шлюза
  7. ШАГ 6: Настройка NAT
  8. Видео
  9. Задать вопрос автору статьи

Пример подключения

Представим себе, что у нас есть один роутер Cisco. С помощью маршрутизатора мы должны подключить офис с несколькими компьютерами. Для коннекта всех локальных машин будем использовать коммутатор. Fa 4 и Fa 0 – это внешний и внутренний физический интерфейс. Также у нас есть:

  • 277.146.101.1 – это шлюз провайдера.
  • 277.146.101.2 – это внешний IP адрес роутера, его выдает провайдер.
  • 192.168.1.1 – это локальный IP адрес.

Как настроить роутер Cisco: пример и реализация от WiFiGid

Я думаю, схема достаточно понятная и простая.

ШАГ 1: Подключение к маршрутизатору

Для подключения мы будем использовать вот такой вот кабель, который обычно идет в комплекте со всем подобным оборудованием.

Как настроить роутер Cisco: пример и реализация от WiFiGid

С одной стороны консольного кабеля должен быть COM-порт (RS 232). Подключаем один конец в CONSOLE (может иметь надпись CON) порты.

Как настроить роутер Cisco: пример и реализация от WiFiGid

Вы можете столкнуться с проблемой, что у современных компов и ноутов нет подобного входа. Поэтому можно использовать USB переходник.

Как настроить роутер Cisco: пример и реализация от WiFiGid

После подключения скачиваем программку PuTTY – она бесплатная и достаточно удобная. Очень важный момент – в разделе «Connection type» после запуска установите значение «Serial».

И далее нажимаем по кнопке «Open». Если у вас возникли трудности и подключение не происходит, то проверьте в «Диспетчере устройств», какой COM порт используется. Может быть баг, что порт указан не тот. Особенно этот баг проявляется при использовании переходника USB-COM.

Как настроить роутер Cisco: пример и реализация от WiFiGid

Далее вы должны увидеть приветственную надпись в запрос ввода логина и пароля.

ШАГ 2: Reset настроек

Итак, в первую очередь нам нужно полностью очистить старые настройки – они нам ни к чему, все будем делать с нуля (так сказать). Изначально вы увидите вот такую надпись:

router>

Но нам нужно запустить роутер с правами администратора, чтобы вместо стрелочки стояла решетка (#). Для этого вводим команду:

router> enable

Теперь сначала удаляем старый конфиг, а потом ребутаем аппарат:

router# write erase
router# reload

Нужно будет немного подождать. После этого роутер загрузится и выведет сообщение – использовать стандартную конфигурацию? – отвечаем:

no

Как настроить роутер Cisco: пример и реализация от WiFiGid

ШАГ 3: Конфигурация интерфейсов

В первую очередь давайте назовем наше устройство для удобства обращения через команду. Я назвал его: «WIFIGID-ROUTER» – смотрим на картинку. Вообще, если у вас будут возникать какие-то вопросы по командам, то смотрите на схему в начале статьи. Итак, обзываем наш роутер:

router#conf t
router (config)#hostname WIFIGID-ROUTER

После этого вместо «router» вы должны увидеть свое название. Вспомним, что у роутера есть два интерфейса,

Внутренний (связь с локальной сетью) – с адресацией:

192.168.1.0/24

Внешний (связь с глобальным интернетом) – понятное дело, что у нас тут будут статические настройки:

  • Сеть провайдера: 277.146.101.0
  • Маска: 255.255.255.252 (/30)
  • Шлюз: 277.146.101.1

Я придумал все эти значения, просто чтобы показать настройку – вы же подставляйте свои циферки. Маршрутизатор будет выступать шлюзом, и наша задача связать две эти сети и дать клиентам доступ в интернет.

Давайте введем настройки внешнего статического адреса:

WIFIGID-ROUTER #conf t
WIFIGID-ROUTER (config)#
interface Fa 4
ip address 227.146.101.2 255.255.255.252
no shutdown

Для подключения к интернету мы используем четвёртый интерфейс. Выше я задал внешний IP как 227.146.101.2, после этого прописал маску и запустил настройку последней командой. Ах да, не забудьте подключить интернет кабель от провайдера. В качестве проверки пингуем сначала сам роутер:

WIFIGID-ROUTER #ping 227.146.101.2

А потом шлюз провайдера:

WIFIGID-ROUTER #ping 227.146.101.1

Если все хорошо, и оба устройства пингуются, идем настраивать интерфейс для связи с локальной сетью. Локальная сеть у нас будет с адресацией:

192.168.1.0

Локальный адрес роутера:

192.168.1.1

Маска стандартная:

255.255.255.0

И еще один совет – обязательно оставьте пару адресов про запас. То есть диапазон адресов будет примерно от 192.168.1.2 до 192.168.1.10. Остальные уже будут использоваться клиентами и другими устройствами в локалке.

Локальный адрес роутера мы будем прописывать в VLAN:

R-DELTACONFIG#conf t
interface Vlan 1
Ip address 192.168.2.1 255.255.255.0
no shutdown
interface Fa 0
switchport access vlan 1
no shutdown

А для подключения будем использовать интерфейс «Fa 0». Что мы сделали, мы привязали сначала локальный адрес к Vlan. А потом уже VLAN привязали к физическому интерфейсу. Подключаем к этому физическому интерфейсу наш коммутатор, к которому уже будут подключены все рабочие машины, принтеры и другие сетевые устройства.

ШАГ 4: Удаленный доступ к роутеру

Чтобы вам постоянно не сидеть рядом с роутером и подключенным к нему консольным кабелем, я вам советую сразу настроить удалённый доступ. Мы будем использовать подключение по защищенному каналу SSH (второй версии).

WIFIGID-ROUTER (config)#
ip ssh ver 2
ip domain-name wifigid-router-c.ru

Сначала мы запустили SSH-2, а потом прописали произвольный домен. Теперь создаем ключ с помощью команды.

crypto key generate rsa

Далее вылезет вот такая вот надпись:

Как настроить роутер Cisco: пример и реализация от WiFiGid

Вписываем число:

1024

Создаем пользователя с правами админа и паролем. Вместо «password» введите свой пароль.

username admin privilege 15 secret 0 password

Включаем пользователя в базу устройства:

line vty 0 4
login local

И задаем пароль для режима доступа:

enable secret 0 password-2

Опять же вместо «password-2» вводим свой пароль. После этого вы можете использовать любую программу с поддержкой SSH для доступа из локальной сети к этому роутеру.

ШАГ 5: Настройка шлюза

Теперь нам нужно подключиться к шлюзу провайдера:

WIFIGID-ROUTER (config)#
ip route 0.0.0.0 0.0.0.0 227.146.101.1

После этого пингуем любой внешний сайт, но лучше использовать именно IP, а не DNS адрес. Можно даже пропинговать один из DNS-серверов.

WIFIGID-ROUTER#ping 8.8.8.8

ШАГ 6: Настройка NAT

Опять же локальные компьютеры пользователя пока не имеют доступа в интернет, но мы это исправим. Для этого нам нужно настроить динамическую трансляцию локальных IP во внешний. У нас всего один внешний адрес, поэтому локальные адреса должны превращаться в него, проходя через наш роутер, выполняющий роль шлюза.

Прописываем диапазон тех адресов, которые в теории могут использоваться локальными машинами:

WIFIGID-ROUTER (config)#
ip access-list standard ACL_NAT
permit 192.168.1.0 0.0.0.255

Далее указываем наш VLAN:

Interface Vlan 1
ip nat inside

Они будет неким локальным интерфейсом, ведь в VLAN может быть сразу несколько адресов. Теперь указываем физический внешний интерфейс, к которому мы подключили провайдерский кабель:

Interface Fa 4
ip
nat outside

А теперь мы создаем NAT правило:

ip nat inside source list WIFIGID_NAT interface fa4

Далее мы уже можем из локальной сети с любого компа клиента пинговать любые интернет-адреса. Также в качестве пробы используем внешний IP адрес. Ну и в самом конце не забудьте сохранить конфиг в память роутера:

WIFIGID-ROUTER#write

Видео

Read the article BASIC CONFIGURATION OF THE CISCO ROUTER. ACCESS TO THE INTERNET in Read in EnglishEnglish

Рассмотрим схему подключения офиса к сети Интернет с помощью маршрутизатора Cisco. Для примера возьмем модель Cisco 881. Команды для настройки других маршрутизаторов (1841, 2800, 3825…) будут аналогичными  Различия могут быть в настройке интерфейсов, вернее в их названиях и нумерации.

В схеме присутствуют:

  • канал в Интернет со статическим адресом
  • несколько компьютеров в локальной сети офиса
  • маршрутизатор
  • коммутатор, который используется для организации локальной сети офиса

Задача: обеспечить доступ компьютеров локальной сети в Интернет.

Начальная настройка маршрутизатора Cisco. Доступ в Интернет.

Шаг 0. Очистка конфигурации

Первое, с чего стоит начать настройку нового маршрутизатора – полностью очистить стартовую конфигурацию устройства. (Выполнять только на новом или тестовом оборудовании!) Для этого нужно подключиться с помощью специального кабеля к консольному порту  маршрутизатора, зайти в командную строку и выполнить следующее:

Войти в привилегированный режим(#), возможно потребуется ввести логин/пароль.
router> enable
Удалить стартовую конфигурацию
router# write erase
/подтверждение/

Перезагрузить маршрутизатор
router# reload
/подтверждение/

После выполнения маршрутизатор должен перезагрузиться в течение 3ех минут, а при старте вывести запрос о начале базовой настройки. Следует отказаться.
Would you like to enter the basic configuration dialog (yes/no): no
В текущей конфигурации маршрутизатора будут только технологические строки по умолчанию, и можно приступать к основной настройке.

Шаг 1. Имя устройства

Задание имени маршрутизатора для удобства последующего администрирования выполняется командой hostname «название устройства»
router#conf t
router (config)#hostname R-DELTACONFIG
R-DELTACONFIG(config)#

Шаг 2. Настройка интерфейсов

Необходимо настроить 2 интерфейса: внешний и внутренний.
Через внешний интерфейс будет осуществляться связь с Интернет. На нем будут те ip адрес и маска сети, которые предоставил Интернет провайдер.
Внутренний интерфейс будет настроен для локальной сети  192.168.0.0 /24

Предположим, что оператор связи предоставил нам следующие адреса:

  • Сеть 200.150.100.0
  • Маска подсети 255.255.255.252 или /30
  • Шлюз по умолчанию 200.150.100.1

Настроим внешний интерфейс: зададим ip адрес и сетевую маску,  и включим его командой no shut
R-DELTACONFIG#conf t
R-DELTACONFIG (config)#
interface Fa 4
ip address 200.150.100.2 255.255.255.252
no shutdown

После этого соединяем этот интерфейс маршрутизатора с портом оборудования провайдера при помощи прямого патч корда и далее проверяем его доступность командой ping.

Сначала собственный интерфейс
R-DELTACONFIG#ping 200.150.100.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.150.100.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms

Затем соседний адрес — шлюз провайдера
R-DELTACONFIG#ping 200.150.100.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.150.100.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/4/10 ms

Убедившись в доступности шлюза Провайдера, переходим к настройке внутреннего интерфейса.

В локальной сети будет использоваться следующая адресация

  • Сеть 192.168.0.0
  • Маска подсети 255.255.255.0
  • Внутренний адрес маршрутизатора, который выполняет роль шлюза в Интернет для всех хостов в сети, 192.168.0.1
  • Диапазон внутренних  адресов сети (пользователи, принтеры, серверы и.т.д.) советую начинать с адреса 192.168.0.5
  • Максимально возможный доступный для использования адрес в этой сети будет 192.168.0.254
  • Адреса с 192.168.0.2 до 192.168.0.4 оставим про запас для непредвиденных технологических нужд

Для настройки внутреннего интерфейса локальной сети следует зайти в режим конфигурирования виртуального интерфейса Vlan 1, задать на нем ip адрес и соотнести ему один из физических интерфейсов маршрутизатора (Fa 0).
R-DELTACONFIG#conf t
interface Vlan 1
Ip address 192.168.0.1 255.255.255.0
no shutdown

Выбираем физический интерфейс маршрутизатора и соотносим его с виртуальным Vlan
interface Fa 0
switchport access vlan 1
no shutdown

Для наглядности:

deltaconfig - cisco аутсорсинг

ip address => interface Vlan X => interface Fastethernet Y
Ip адрес присваивается виртуальному интерфейсу Vlan X, а он привязывается к физическому интерфейсу Fastethernet Y.

Интерфейс маршрутизатора Fa 0 нужно соединить с коммутатором, где располагаются рабочие станции локальной  сети или напрямую с рабочей станцией администратора. После этого проверить доступность этого интерфейса маршрутизатора с помощью ping из командной строки.

Шаг 3 Настройка удаленного доступа к маршрутизатору

Получить доступ к консоли маршрутизатора можно не только с помощью консольного кабеля, но и удаленно с помощью протоколов Telnet(данные передаются в открытом виде) или SSH(защищенное соединение).
Рассмотрим настройку безопасного подключения.
Включаем протокол SSH 2 версии и задаем произвольное имя домена
R-DELTACONFIG (config)#
ip ssh ver 2
ip domain-name xxx.ru

Генерируем ключи rsa, необходимые для подключения. При запросе указываем 1024.
crypto key generate rsa
How many bits in the modulus [512]: 1024

Задаем имя пользователя с правами администратора и его пароль (*****)
username admin privilege 15 secret 0 *****
Включаем авторизацию через локальную базу устройства (тот пользователь, которого создали строчкой выше)
line vty 0 4
login local

Задаем пароль на привилегированный режим
enable secret 0 *****
После этого при помощи специальной программы, поддерживающей протокол SSH можно зайти в командную строку маршрутизатора удаленно с любой из рабочих станций локальной сети. При авторизации следует ввести логин и пароль, которые были задан. Подробнее про доступ на устройство по протоколу SSH написано в этой статье.

Шаг 4. Шлюз по умолчанию

Для маршрутизации пакетов в сеть Интернет на устройстве необходимо указать шлюз по умолчанию(default gateway).
R-DELTACONFIG (config)#
ip route 0.0.0.0 0.0.0.0 200.150.100.1

После этого можно проверить не только доступность оборудования провайдера, но и полностью канала в Интернет. Для этого необходимо запустить ping до любого адреса во внешней сети в цифровой форме(DNS для локальной сети лучше настраивать после настройки маршрутизатора). Для примера возьмем адрес лидера на рынке ping – www.yandex.ru (93.158.134.3)
R-DELTACONFIG#ping 93.158.134.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 93.158.134.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/10 ms

Важно!
Обратите внимание, что на данный момент ping внешних адресов работает только(!) будучи запущенным из консоли управления маршрутизатором. Рабочие станции локальной сети все еще не имеют доступа в Интернет.

Шаг 5 Настройка трансляции адресов (NAT)

Для доступа в Интернет из локальной сети необходимо динамически транслировать все  внутренние адреса в определенный внешний ip адрес. В нашем случае, так как провайдер предоставляет только один внешний адрес 200.150.100.2 (определяется маской подсети /30 в условиях примера), то все адреса локальной сети должны транслироваться в него.
Указываем список внутренних адресов, которые будем транслировать во внешний адрес.
R-DELTACONFIG (config)#
ip access-list standard ACL_NAT
permit 192.168.0.0 0.0.0.255

Указываем внутренний интерфейс для процедуры трансляции
Interface Vlan 1
ip nat inside

Указываем внешний интерфейс для процедуры трансляции
Interface Fa 4
ip nat outside

Создаем правило трансляции (NAT)
ip nat inside source list ACL_NAT interface fa4
В результате должен появиться доступ с любой рабочей станции локальной сети в Интернет при условии, что шлюзом по умолчанию указан внутренний ip адрес маршрутизатора (192.168.0.1). Проверить можно с помощью команды ping до адреса в Интернет из командной строки. Желательно, чтобы проверяемый адрес был в цифровом виде, чтобы исключить потенциальные проблемы с DNS именами.

Важно!
В указанном примере меняется собственный адрес источника. Если в процессе работы необходимо транслировать адрес назначения — пускать траффик на вымышленный адрес, чтобы попасть на некий настоящий, то прочитайте статью ip nat outside.

Важно!
Не стоит оставлять полный доступ в Интернет со всех адресов локальной сети. Советую после проверки работоспособности соединения для безопасности ограничить доступ в Интернет  и разрешить его только с конкретных адресов — например с прокси сервера и рабочих станций администратора и/или директора. О том как это сделать можно прочитать в статье «немного об access lists«.

Важно!

Не забудьте сохранить конфигурацию на всех устройствах командой write или copy run start. Иначе после перезагрузки все изменения будут потеряны.
R-DELTACONFIG#write
Building configuration...
[OK]

Перейти к оглавлению

The interface is the port at which the router connects to a given network. It acts as an entry or exit point for data that is to be transmitted through the router. Every interface must be labeled or assigned an IP address, which should be unique among all the IP addresses in the network. 

In Cisco Packet Tracer, to understand the process of assigning IP addresses, we will be using routers. This is because a router has many interfaces to connect to different networks and also after configuring a router by any routing protocol(RIP, static routing, etc.), we can observe how an interface and an IP address work in a router. 

Steps to configure an IP address for an interface of a router in Cisco Packet Tracer:

Step 1: Open Cisco Packet Tracer and select the following devices:

S.NO

Device

Quantity

1.

PC 4

2.

Router 2

IPv4 Addressing Table:

S.NO

Device

IPv4 Address

Subnet Mask

Default Gateway

1.

PC0 192.168.10.1 255.255.255.0 192.168.10.2

2.

PC1 192.168.20.1 255.255.255.0 192.168.20.2

3.

PC2 192.168.30.1 255.255.255.0 192.168.30.2

4.

PC3 192.168.40.1 255.255.255.0 192.168.40.2
  • Create the following topology and label the configuration as shown in the figure:

  • Also, assign the respective IP addresses and default gateways to all 4 PCs.

Step 2: In Cisco Packet Tracer, assigning IP addresses to an interface of a router can either be done through the command line or the GUI mode. Both of them are discussed as follows:

Through command line mode:

  • Firstly, enter the command line by clicking on any router and then selecting the CLI tab.
  • Enter config mode by typing the following commands in the command line:
en
config t
  • Now we can assign IP addresses to their respective interfaces. To do this, firstly we need to enter into the interface we want to assign the IP address. This is done by typing the keyword interface followed by the label of the interface.

Interface [label of the interface]:

For example:

interface fa0/0
  • After entering the interface, type the command IP address followed by the IP address you want to assign and also followed by the subnet mask of the IP address assigned.

IP address [IP address to be assigned] [subnet mask of the IP address]

For example:

IP address 192.168.20.2 255.255.255.0
  • After assigning the IP address type, the command no shutdown to activate the port. Initially, all the ports of the router are switched off, so we need to manually activate them. You would also note that the color of the triangles representing the ports of the router changes to green and also start pointing upward.

For example:

no shutdown
  • At last, exit the interface by typing the following command:
exit
  • Repeat the above steps for all the interfaces of the router, and then for all interfaces of other routers as well.

Following is the image of the command line of the router after configuring all interfaces:

For a better understanding of the process, you may refer to the following simulation:

Through GUI mode:

  • Click on any router and select the Config tab from the above tabs.
  • Now find the interface to which you want to assign the IP address, from the tabs available on the left side of the window.

For example:

  • After selecting the interface, fill in the IP address and the subnet mask in the fields named IPv4 Address and Subnet Mask.

For example:

  • Activate the port by checking the checkbox labeled as On for the Port Status option.

For example:

The interface of the router has been assigned an IP address.

  • Repeat the above steps for all the interfaces of the router, and then for all interfaces of other routers as well.

Simulation Result:

Last Updated :
21 Jul, 2022

Like Article

Save Article

  • Cisco роутер как зайти в настройки
  • Cisco packet tracer роутер коммутатор
  • Cisco packet tracer роутер vlan
  • Cpu что такое в роутере
  • Cisco packet tracer работа с роутером