Разлика между версии на „Маршрутизиране на трафика с Catalyst 2960“
(Нова страница: Category:Cisco =Примерна топология (IPv4)= Файл:Lanbase_Routing_Topology.PNG) |
(→Конфигурация на S1, S2 и S3) |
||
(5 intermediate revisions by the same user not shown) | |||
Ред 2: | Ред 2: | ||
=Примерна топология (IPv4)= | =Примерна топология (IPv4)= | ||
[[Файл:Lanbase_Routing_Topology.PNG]] | [[Файл:Lanbase_Routing_Topology.PNG]] | ||
+ | |||
+ | В примера е разгледана конфигурацията на S1. Устройства S2 и S3 се използват като стандартни L2 комутатори, с конфигурирани VLAN и Trunk, | ||
+ | |||
+ | =SDM Templates= | ||
+ | С помощта на SDM Templates е възможно при комутаторите на Cisco Systems да се оптимизират или активират дадени услуги. По подразбиране при IOS 15 Catalyst 2960 не поддържа маршрутизиране на трафика чрез статични пътища, но след активиране на '''sdm prefer lanbase-routing''' тази функционалност се активира. | ||
+ | |||
+ | Допълнителна информация за SDM Templates при Catalyst 2960 можете да намерите на адрес: | ||
+ | [http://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2960/software/release/12-2_55_se/configuration/guide/scg_2960/swsdm.html Configuring SDM Templates] | ||
+ | |||
+ | =Конфигуриране на S1= | ||
+ | Първоначално е необходимо да се провери и/или активира SDM Template Lanbase-routing. За целта се използва командата '''sdm prefer lanbase-routing''': | ||
+ | |||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | Switch#conf t | ||
+ | Enter configuration commands, one per line. End with CNTL/Z. | ||
+ | Switch(config)# | ||
+ | Switch(config)#sdm prefer lanbase-routing | ||
+ | Changes to the running SDM preferences have been stored, but cannot take effect | ||
+ | until the next reload. | ||
+ | Use 'show sdm prefer' to see what SDM preference is currently active. | ||
+ | Switch(config)# | ||
+ | Switch(config)#do reload | ||
+ | </pre> | ||
+ | |||
+ | Проверката на активния в момента SDM Template се извървшва с '''show sdm prefer''': | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | Switch#show sdm prefer | ||
+ | The current template is "lanbase-routing" template. | ||
+ | The selected template optimizes the resources in | ||
+ | the switch to support this level of features for | ||
+ | 0 routed interfaces and 255 VLANs. | ||
+ | |||
+ | number of unicast mac addresses: 4K | ||
+ | number of IPv4 IGMP groups + multicast routes: 0.25K | ||
+ | number of IPv4 unicast routes: 4.25K | ||
+ | number of directly-connected IPv4 hosts: 4K | ||
+ | number of indirect IPv4 routes: 256 | ||
+ | number of IPv6 multicast groups: 0.375k | ||
+ | number of IPv6 unicast routes: 1.25K | ||
+ | number of directly-connected IPv6 addresses: 0.75K | ||
+ | number of indirect IPv6 unicast routes: 448 | ||
+ | number of IPv4 policy based routing aces: 0 | ||
+ | number of IPv4/MAC qos aces: 0.125k | ||
+ | number of IPv4/MAC security aces: 0.375k | ||
+ | number of IPv6 policy based routing aces: 0 | ||
+ | number of IPv6 qos aces: 0.375k | ||
+ | number of IPv6 security aces: 127 | ||
+ | </pre> | ||
+ | |||
+ | Спрямо примерната топология на S1 следва да се конфигурират VLAN, Trunk, SVI и маршрутизирането на трафика: | ||
+ | |||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | enable | ||
+ | conf t | ||
+ | hostname S1 | ||
+ | |||
+ | vlan 10 | ||
+ | vlan 20 | ||
+ | vlan 30 | ||
+ | vlan 99 | ||
+ | exit | ||
+ | |||
+ | interface range gi0/1-2 | ||
+ | switchport mode trunk | ||
+ | switchport trunk native vlan 99 | ||
+ | |||
+ | interface range fa0/1-8 | ||
+ | switchport mode access | ||
+ | switchport access vlan 10 | ||
+ | interface range fa0/9-16 | ||
+ | switchport mode access | ||
+ | switchport access vlan 20 | ||
+ | interface range fa0/17-24 | ||
+ | switchport mode access | ||
+ | switchport access vlan 30 | ||
+ | exit | ||
+ | |||
+ | interface vlan 10 | ||
+ | ip address 10.10.0.1 255.255.0.0 | ||
+ | interface vlan 20 | ||
+ | ip address 10.20.0.1 255.255.0.0 | ||
+ | interface vlan 30 | ||
+ | ip address 10.30.0.1 255.255.0.0 | ||
+ | |||
+ | ip routing | ||
+ | |||
+ | end | ||
+ | </pre> | ||
+ | |||
+ | =Проверка на интерфейсите= | ||
+ | За да се проверят IPv4 адресите на SVI може да се използва командата '''show ip interface brief''': | ||
+ | |||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | S1#show ip interface brief | ||
+ | Interface IP-Address OK? Method Status Protocol | ||
+ | Vlan1 unassigned YES unset administratively down down | ||
+ | Vlan10 10.10.0.1 YES manual up up | ||
+ | Vlan20 10.20.0.1 YES manual up up | ||
+ | Vlan30 10.30.0.1 YES manual up up | ||
+ | ... | ||
+ | </pre> | ||
+ | |||
+ | =Проверка на маршрутизиращата таблица= | ||
+ | Аналогично на маршрутизаторите за да се провери съдържанието на IPv4 маршрутизиращата таблица може да се използва командата '''show ip route''': | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | show ip route | ||
+ | Codes: L - local, C - connected, S - static, 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 | ||
+ | i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP | ||
+ | + - replicated route, % - next hop override | ||
+ | |||
+ | Gateway of last resort is not set | ||
+ | |||
+ | 10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks | ||
+ | C 10.10.0.0/16 is directly connected, Vlan10 | ||
+ | L 10.10.0.1/32 is directly connected, Vlan10 | ||
+ | C 10.20.0.0/16 is directly connected, Vlan20 | ||
+ | L 10.20.0.1/32 is directly connected, Vlan20 | ||
+ | C 10.30.0.0/16 is directly connected, Vlan30 | ||
+ | L 10.30.0.1/32 is directly connected, Vlan30 | ||
+ | </pre> | ||
+ | |||
+ | =Маршрутизиране на трафика чрез статични пътища= | ||
+ | ==Добаване на път по подразбиране== | ||
+ | Чрез SDM Template Lanbaserouting комутаторът Catalyst 2960 поддържа '''до 16 статични пътя'''. | ||
+ | Добаването на път по подразбиране е аналогично на маршрутизатора и е чрез командата '''ip route 0.0.0.0 0.0.0.0''' ''next-hop'': | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | S1(config)#ip route 0.0.0.0 0.0.0.0 192.168.0.1 | ||
+ | </pre> | ||
+ | |||
+ | ==Добавяне на статични пътища към отдалечени мрежи== | ||
+ | Отново аналогично на конфигуриането на маршрутизатори за да се опишат статичните пътища към отдалеченик мрежи се използва командата '''ip route''' ''мрежови адрес'' ''маска'' ''next-hop''. | ||
+ | |||
+ | =Конфигурация на S1, S2 и S3= | ||
+ | ==S1== | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | version 15.0 | ||
+ | no service pad | ||
+ | service timestamps debug datetime msec | ||
+ | service timestamps log datetime msec | ||
+ | no service password-encryption | ||
+ | ! | ||
+ | hostname S1 | ||
+ | ! | ||
+ | boot-start-marker | ||
+ | boot-end-marker | ||
+ | ! | ||
+ | ! | ||
+ | no aaa new-model | ||
+ | system mtu routing 1500 | ||
+ | ip routing | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | spanning-tree mode pvst | ||
+ | spanning-tree extend system-id | ||
+ | ! | ||
+ | vlan internal allocation policy ascending | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | interface FastEthernet0/1 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/2 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/3 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/4 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/5 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/6 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/7 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/8 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/9 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/10 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/11 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/12 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/13 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/14 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/15 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/16 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/17 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/18 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/19 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/20 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/21 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/22 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/23 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/24 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface GigabitEthernet0/1 | ||
+ | switchport trunk native vlan 99 | ||
+ | switchport mode trunk | ||
+ | ! | ||
+ | interface GigabitEthernet0/2 | ||
+ | switchport trunk native vlan 99 | ||
+ | switchport mode trunk | ||
+ | ! | ||
+ | interface Vlan1 | ||
+ | no ip address | ||
+ | shutdown | ||
+ | ! | ||
+ | interface Vlan10 | ||
+ | ip address 10.10.0.1 255.255.0.0 | ||
+ | ! | ||
+ | interface Vlan20 | ||
+ | ip address 10.20.0.1 255.255.0.0 | ||
+ | ! | ||
+ | interface Vlan30 | ||
+ | ip address 10.30.0.1 255.255.0.0 | ||
+ | ! | ||
+ | ip http server | ||
+ | ip http secure-server | ||
+ | ip route 0.0.0.0 0.0.0.0 192.168.0.1 | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | line con 0 | ||
+ | line vty 5 15 | ||
+ | ! | ||
+ | end | ||
+ | </pre> | ||
+ | ==S2== | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | version 15.0 | ||
+ | no service pad | ||
+ | service timestamps debug datetime msec | ||
+ | service timestamps log datetime msec | ||
+ | no service password-encryption | ||
+ | ! | ||
+ | hostname S2 | ||
+ | ! | ||
+ | boot-start-marker | ||
+ | boot-end-marker | ||
+ | ! | ||
+ | ! | ||
+ | no aaa new-model | ||
+ | system mtu routing 1500 | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | |||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | spanning-tree mode pvst | ||
+ | spanning-tree extend system-id | ||
+ | ! | ||
+ | vlan internal allocation policy ascending | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | interface FastEthernet0/1 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/2 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/3 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/4 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/5 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/6 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/7 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/8 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/9 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/10 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/11 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/12 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/13 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/14 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/15 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/16 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/17 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/18 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/19 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/20 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/21 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/22 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/23 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/24 | ||
+ | switchport access vlan 20 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface GigabitEthernet0/1 | ||
+ | switchport trunk native vlan 99 | ||
+ | switchport mode trunk | ||
+ | ! | ||
+ | interface GigabitEthernet0/2 | ||
+ | shutdown | ||
+ | ! | ||
+ | interface Vlan1 | ||
+ | no ip address | ||
+ | shutdown | ||
+ | ! | ||
+ | ip http server | ||
+ | ! | ||
+ | ! | ||
+ | line con 0 | ||
+ | line vty 0 4 | ||
+ | login | ||
+ | line vty 5 15 | ||
+ | login | ||
+ | ! | ||
+ | end | ||
+ | |||
+ | </pre> | ||
+ | ==S3== | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | version 15.0 | ||
+ | no service pad | ||
+ | service timestamps debug datetime msec | ||
+ | service timestamps log datetime msec | ||
+ | no service password-encryption | ||
+ | ! | ||
+ | hostname S3 | ||
+ | ! | ||
+ | boot-start-marker | ||
+ | boot-end-marker | ||
+ | ! | ||
+ | ! | ||
+ | no aaa new-model | ||
+ | system mtu routing 1500 | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | spanning-tree mode pvst | ||
+ | spanning-tree extend system-id | ||
+ | ! | ||
+ | vlan internal allocation policy ascending | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | ! | ||
+ | interface FastEthernet0/1 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/2 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/3 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/4 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/5 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/6 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/7 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/8 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/9 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/10 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/11 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/12 | ||
+ | switchport access vlan 10 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/13 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/14 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/15 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/16 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/17 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/18 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/19 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/20 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/21 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/22 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/23 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface FastEthernet0/24 | ||
+ | switchport access vlan 30 | ||
+ | switchport mode access | ||
+ | ! | ||
+ | interface GigabitEthernet0/1 | ||
+ | switchport trunk native vlan 99 | ||
+ | switchport mode trunk | ||
+ | ! | ||
+ | interface GigabitEthernet0/2 | ||
+ | shutdown | ||
+ | ! | ||
+ | interface Vlan1 | ||
+ | no ip address | ||
+ | shutdown | ||
+ | ! | ||
+ | ip http server | ||
+ | ! | ||
+ | ! | ||
+ | line con 0 | ||
+ | line vty 0 4 | ||
+ | login | ||
+ | line vty 5 15 | ||
+ | login | ||
+ | ! | ||
+ | end | ||
+ | </pre> |
Текуща версия към 09:13, 28 ноември 2015
Съдържание
Примерна топология (IPv4)
В примера е разгледана конфигурацията на S1. Устройства S2 и S3 се използват като стандартни L2 комутатори, с конфигурирани VLAN и Trunk,
SDM Templates
С помощта на SDM Templates е възможно при комутаторите на Cisco Systems да се оптимизират или активират дадени услуги. По подразбиране при IOS 15 Catalyst 2960 не поддържа маршрутизиране на трафика чрез статични пътища, но след активиране на sdm prefer lanbase-routing тази функционалност се активира.
Допълнителна информация за SDM Templates при Catalyst 2960 можете да намерите на адрес: Configuring SDM Templates
Конфигуриране на S1
Първоначално е необходимо да се провери и/или активира SDM Template Lanbase-routing. За целта се използва командата sdm prefer lanbase-routing:
Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)# Switch(config)#sdm prefer lanbase-routing Changes to the running SDM preferences have been stored, but cannot take effect until the next reload. Use 'show sdm prefer' to see what SDM preference is currently active. Switch(config)# Switch(config)#do reload
Проверката на активния в момента SDM Template се извървшва с show sdm prefer:
Switch#show sdm prefer The current template is "lanbase-routing" template. The selected template optimizes the resources in the switch to support this level of features for 0 routed interfaces and 255 VLANs. number of unicast mac addresses: 4K number of IPv4 IGMP groups + multicast routes: 0.25K number of IPv4 unicast routes: 4.25K number of directly-connected IPv4 hosts: 4K number of indirect IPv4 routes: 256 number of IPv6 multicast groups: 0.375k number of IPv6 unicast routes: 1.25K number of directly-connected IPv6 addresses: 0.75K number of indirect IPv6 unicast routes: 448 number of IPv4 policy based routing aces: 0 number of IPv4/MAC qos aces: 0.125k number of IPv4/MAC security aces: 0.375k number of IPv6 policy based routing aces: 0 number of IPv6 qos aces: 0.375k number of IPv6 security aces: 127
Спрямо примерната топология на S1 следва да се конфигурират VLAN, Trunk, SVI и маршрутизирането на трафика:
enable conf t hostname S1 vlan 10 vlan 20 vlan 30 vlan 99 exit interface range gi0/1-2 switchport mode trunk switchport trunk native vlan 99 interface range fa0/1-8 switchport mode access switchport access vlan 10 interface range fa0/9-16 switchport mode access switchport access vlan 20 interface range fa0/17-24 switchport mode access switchport access vlan 30 exit interface vlan 10 ip address 10.10.0.1 255.255.0.0 interface vlan 20 ip address 10.20.0.1 255.255.0.0 interface vlan 30 ip address 10.30.0.1 255.255.0.0 ip routing end
Проверка на интерфейсите
За да се проверят IPv4 адресите на SVI може да се използва командата show ip interface brief:
S1#show ip interface brief Interface IP-Address OK? Method Status Protocol Vlan1 unassigned YES unset administratively down down Vlan10 10.10.0.1 YES manual up up Vlan20 10.20.0.1 YES manual up up Vlan30 10.30.0.1 YES manual up up ...
Проверка на маршрутизиращата таблица
Аналогично на маршрутизаторите за да се провери съдържанието на IPv4 маршрутизиращата таблица може да се използва командата show ip route:
show ip route Codes: L - local, C - connected, S - static, 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 i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP + - replicated route, % - next hop override Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks C 10.10.0.0/16 is directly connected, Vlan10 L 10.10.0.1/32 is directly connected, Vlan10 C 10.20.0.0/16 is directly connected, Vlan20 L 10.20.0.1/32 is directly connected, Vlan20 C 10.30.0.0/16 is directly connected, Vlan30 L 10.30.0.1/32 is directly connected, Vlan30
Маршрутизиране на трафика чрез статични пътища
Добаване на път по подразбиране
Чрез SDM Template Lanbaserouting комутаторът Catalyst 2960 поддържа до 16 статични пътя. Добаването на път по подразбиране е аналогично на маршрутизатора и е чрез командата ip route 0.0.0.0 0.0.0.0 next-hop:
S1(config)#ip route 0.0.0.0 0.0.0.0 192.168.0.1
Добавяне на статични пътища към отдалечени мрежи
Отново аналогично на конфигуриането на маршрутизатори за да се опишат статичните пътища към отдалеченик мрежи се използва командата ip route мрежови адрес маска next-hop.
Конфигурация на S1, S2 и S3
S1
version 15.0 no service pad service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname S1 ! boot-start-marker boot-end-marker ! ! no aaa new-model system mtu routing 1500 ip routing ! ! ! ! ! ! ! ! ! ! spanning-tree mode pvst spanning-tree extend system-id ! vlan internal allocation policy ascending ! ! ! ! ! ! interface FastEthernet0/1 switchport access vlan 10 switchport mode access ! interface FastEthernet0/2 switchport access vlan 10 switchport mode access ! interface FastEthernet0/3 switchport access vlan 10 switchport mode access ! interface FastEthernet0/4 switchport access vlan 10 switchport mode access ! interface FastEthernet0/5 switchport access vlan 10 switchport mode access ! interface FastEthernet0/6 switchport access vlan 10 switchport mode access ! interface FastEthernet0/7 switchport access vlan 10 switchport mode access ! interface FastEthernet0/8 switchport access vlan 10 switchport mode access ! interface FastEthernet0/9 switchport access vlan 20 switchport mode access ! interface FastEthernet0/10 switchport access vlan 20 switchport mode access ! interface FastEthernet0/11 switchport access vlan 20 switchport mode access ! interface FastEthernet0/12 switchport access vlan 20 switchport mode access ! interface FastEthernet0/13 switchport access vlan 20 switchport mode access ! interface FastEthernet0/14 switchport access vlan 20 switchport mode access ! interface FastEthernet0/15 switchport access vlan 20 switchport mode access ! interface FastEthernet0/16 switchport access vlan 20 switchport mode access ! interface FastEthernet0/17 switchport access vlan 30 switchport mode access ! interface FastEthernet0/18 switchport access vlan 30 switchport mode access ! interface FastEthernet0/19 switchport access vlan 30 switchport mode access ! interface FastEthernet0/20 switchport access vlan 30 switchport mode access ! interface FastEthernet0/21 switchport access vlan 30 switchport mode access ! interface FastEthernet0/22 switchport access vlan 30 switchport mode access ! interface FastEthernet0/23 switchport access vlan 30 switchport mode access ! interface FastEthernet0/24 switchport access vlan 30 switchport mode access ! interface GigabitEthernet0/1 switchport trunk native vlan 99 switchport mode trunk ! interface GigabitEthernet0/2 switchport trunk native vlan 99 switchport mode trunk ! interface Vlan1 no ip address shutdown ! interface Vlan10 ip address 10.10.0.1 255.255.0.0 ! interface Vlan20 ip address 10.20.0.1 255.255.0.0 ! interface Vlan30 ip address 10.30.0.1 255.255.0.0 ! ip http server ip http secure-server ip route 0.0.0.0 0.0.0.0 192.168.0.1 ! ! ! line con 0 line vty 5 15 ! end
S2
version 15.0 no service pad service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname S2 ! boot-start-marker boot-end-marker ! ! no aaa new-model system mtu routing 1500 ! ! ! ! ! ! ! ! ! spanning-tree mode pvst spanning-tree extend system-id ! vlan internal allocation policy ascending ! ! ! ! ! ! interface FastEthernet0/1 switchport access vlan 10 switchport mode access ! interface FastEthernet0/2 switchport access vlan 10 switchport mode access ! interface FastEthernet0/3 switchport access vlan 10 switchport mode access ! interface FastEthernet0/4 switchport access vlan 10 switchport mode access ! interface FastEthernet0/5 switchport access vlan 10 switchport mode access ! interface FastEthernet0/6 switchport access vlan 10 switchport mode access ! interface FastEthernet0/7 switchport access vlan 10 switchport mode access ! interface FastEthernet0/8 switchport access vlan 10 switchport mode access ! interface FastEthernet0/9 switchport access vlan 10 switchport mode access ! interface FastEthernet0/10 switchport access vlan 10 switchport mode access ! interface FastEthernet0/11 switchport access vlan 10 switchport mode access ! interface FastEthernet0/12 switchport access vlan 10 switchport mode access ! interface FastEthernet0/13 switchport access vlan 20 switchport mode access ! interface FastEthernet0/14 switchport access vlan 20 switchport mode access ! interface FastEthernet0/15 switchport access vlan 20 switchport mode access ! interface FastEthernet0/16 switchport access vlan 20 switchport mode access ! interface FastEthernet0/17 switchport access vlan 20 switchport mode access ! interface FastEthernet0/18 switchport access vlan 20 switchport mode access ! interface FastEthernet0/19 switchport access vlan 20 switchport mode access ! interface FastEthernet0/20 switchport access vlan 20 switchport mode access ! interface FastEthernet0/21 switchport access vlan 20 switchport mode access ! interface FastEthernet0/22 switchport access vlan 20 switchport mode access ! interface FastEthernet0/23 switchport access vlan 20 switchport mode access ! interface FastEthernet0/24 switchport access vlan 20 switchport mode access ! interface GigabitEthernet0/1 switchport trunk native vlan 99 switchport mode trunk ! interface GigabitEthernet0/2 shutdown ! interface Vlan1 no ip address shutdown ! ip http server ! ! line con 0 line vty 0 4 login line vty 5 15 login ! end
S3
version 15.0 no service pad service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname S3 ! boot-start-marker boot-end-marker ! ! no aaa new-model system mtu routing 1500 ! ! ! ! ! ! ! ! spanning-tree mode pvst spanning-tree extend system-id ! vlan internal allocation policy ascending ! ! ! ! ! ! interface FastEthernet0/1 switchport access vlan 10 switchport mode access ! interface FastEthernet0/2 switchport access vlan 10 switchport mode access ! interface FastEthernet0/3 switchport access vlan 10 switchport mode access ! interface FastEthernet0/4 switchport access vlan 10 switchport mode access ! interface FastEthernet0/5 switchport access vlan 10 switchport mode access ! interface FastEthernet0/6 switchport access vlan 10 switchport mode access ! interface FastEthernet0/7 switchport access vlan 10 switchport mode access ! interface FastEthernet0/8 switchport access vlan 10 switchport mode access ! interface FastEthernet0/9 switchport access vlan 10 switchport mode access ! interface FastEthernet0/10 switchport access vlan 10 switchport mode access ! interface FastEthernet0/11 switchport access vlan 10 switchport mode access ! interface FastEthernet0/12 switchport access vlan 10 switchport mode access ! interface FastEthernet0/13 switchport access vlan 30 switchport mode access ! interface FastEthernet0/14 switchport access vlan 30 switchport mode access ! interface FastEthernet0/15 switchport access vlan 30 switchport mode access ! interface FastEthernet0/16 switchport access vlan 30 switchport mode access ! interface FastEthernet0/17 switchport access vlan 30 switchport mode access ! interface FastEthernet0/18 switchport access vlan 30 switchport mode access ! interface FastEthernet0/19 switchport access vlan 30 switchport mode access ! interface FastEthernet0/20 switchport access vlan 30 switchport mode access ! interface FastEthernet0/21 switchport access vlan 30 switchport mode access ! interface FastEthernet0/22 switchport access vlan 30 switchport mode access ! interface FastEthernet0/23 switchport access vlan 30 switchport mode access ! interface FastEthernet0/24 switchport access vlan 30 switchport mode access ! interface GigabitEthernet0/1 switchport trunk native vlan 99 switchport mode trunk ! interface GigabitEthernet0/2 shutdown ! interface Vlan1 no ip address shutdown ! ip http server ! ! line con 0 line vty 0 4 login line vty 5 15 login ! end