*-------------------------------------
* POMEMBNO:
* pred to vajo prekinemo vse povezave med stikali -- aktivne so le povezave stikal z usmerjevalnikom


*-------------------------------------
* nastavitev vmesnika na usmerjevalniku

router#sh run int Gig1/0/22                      
Building configuration...

Current configuration : 136 bytes
!
interface GigabitEthernet1/0/22
 description --- switch2,  Fast0/12 ---
 logging event trunk-status
 logging event spanning-tree
end

*-------------------------------------
* pripravimo VLAN

router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
router(config)#vlan 31
router(config-vlan)#name org3adm
router(config-vlan)#^Z

*-------------------------------------
* nastavimo snop

router(config)#interface GigabitEthernet1/0/22
router(config-if)#switchport trunk encapsulation dot1q 
router(config-if)#switchport mode trunk

*-------------------------------------
* povezava usmerjevalnika do stikala se prekine -- nastavimo "trunk" se na stikalu

switch2#
Apr  9 14:25:25: %SPANTREE-7-RECV_1Q_NON_TRUNK: Received 802.1Q BPDU on non trunk FastEthernet0/12 VLAN1.
Apr  9 14:25:25: %SPANTREE-7-BLOCK_PORT_TYPE: Blocking FastEthernet0/12 on VLAN0001. Inconsistent port type.1

switch2#show spanning-tree vlan 1

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000d.bce6.9b80
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     000d.bce6.9b80
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 15 

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/9            Desg FWD 19        128.9    P2p 
Fa0/12           Root BKN*19        128.12   P2p *TYPE_Inc

switch2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
switch2(config)#int Fa0/12
switch2(config-if)#switchport mode trunk
switch2(config-if)#^Z

switch2#
Apr  9 14:26:30: %SYS-5-CONFIG_I: Configured from console by u31 on vty0 (153.5.188.31)
Apr  9 14:26:30: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/12, changed state to down
Apr  9 14:26:33: %DTP-5-TRUNKPORTON: Port Fa0/12 has become dot1q trunk
Apr  9 14:26:34: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/12, changed state to up

*-------------------------------------
* dovolimo le tiste VLAN-e, ki so potrebni

router(config)#interface GigabitEthernet1/0/22
router(config-if)#switchport trunk allowed vlan 1
router(config-if)#switchport trunk allowed vlan add 31

switch2(config)#interface FastEthernet0/12
switch2(config-if)#switchport trunk allowed vlan 1
switch2(config-if)#switchport trunk allowed vlan add 31
switch2(config-if)#^Z

router#show spanning-tree vlan 31

VLAN0031
  Spanning tree enabled protocol ieee
  Root ID    Priority    32799
             Address     000d.bce6.9b80
             Cost        19
             Port        22 (GigabitEthernet1/0/22)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32799  (priority 32768 sys-id-ext 31)
             Address     000e.38f4.6580
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 15 

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi1/0/22         Root FWD 19        128.22   P2p 

switch2#show spanning-tree vlan 31

VLAN0031
  Spanning tree enabled protocol ieee
  Root ID    Priority    32799
             Address     000d.bce6.9b80
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32799  (priority 32768 sys-id-ext 31)
             Address     000d.bce6.9b80
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 15 

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/12           Desg FWD 19        128.12   P2p 


*-------------------------------------
* IP gateway

router(config)#int vlan 31
router(config-if)#description --- org.3/admin ---
router(config-if)#ip address 153.5.188.161 255.255.255.192
router(config-if)#no shut
router(config-if)#^Z


*-------------------------------------
* svoj vmesnik nastavimo v nacin "access"

switch2#sh run int FastEthernet0/9
Building configuration...

Current configuration : 153 bytes
!
interface FastEthernet0/9
 description --- predavatelj ---
 switchport mode access
 no ip address
 no cdp enable
 spanning-tree bpdufilter enable
end

switch2(config)#interface FastEthernet0/9
switch2(config-if)#switchport access vlan 31
--- izgubimo povezavo ---

*-------------------------------------
* zamenjamo IP na PC-ju

[root@ciprnik ~]# ifconfig eth2 153.5.188.162/26
[root@ciprnik ~]# ping 153.5.188.161
PING 153.5.188.161 (153.5.188.161) 56(84) bytes of data.
64 bytes from 153.5.188.161: icmp_seq=0 ttl=255 time=3.88 ms
64 bytes from 153.5.188.161: icmp_seq=1 ttl=255 time=0.487 ms
64 bytes from 153.5.188.161: icmp_seq=2 ttl=255 time=0.484 ms

--- 153.5.188.161 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.484/1.620/3.889/1.604 ms, pipe 2

[root@ciprnik ~]# route add -net 153.5.188.0/26 gw 153.5.188.161

--- sedaj lahko ponovno dostopamo do opreme ---

*-------------------------------------
* IPv6

router#sh run int vlan 31
Building configuration...

Current configuration : 99 bytes
!
interface Vlan31
 description --- org.3/admin ---
 ip address 153.5.188.161 255.255.255.192
end

router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
router(config)#interface Vlan31
router(config-if)#ipv6 address 2001:1470:fac3:1::1/64  
router(config-if)#ipv6 nd prefix 2001:1470:fac3:1::/64
router(config-if)#ipv6 nd ra-interval 120
router(config-if)#no ipv6 redirects 
router(config-if)#^Z

[root@ciprnik ~]# ifconfig eth2
eth2      Link encap:Ethernet  HWaddr 00:11:95:5C:EC:AA  
          inet addr:153.5.188.162  Bcast:153.5.188.191  Mask:255.255.255.192
          inet6 addr: 2001:1470:fac3:1:211:95ff:fe5c:ecaa/64 Scope:Global
          inet6 addr: fe80::211:95ff:fe5c:ecaa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3829 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5630 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:376102 (367.2 KiB)  TX bytes:392409 (383.2 KiB)
          Interrupt:193 Base address:0x4000 

[root@ciprnik ~]# ip -6 addr 
1: lo: <LOOPBACK,UP> mtu 16436 
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
5: eth2: <BROADCAST,MULTICAST,UP> mtu 1500 qlen 1000
    inet6 2001:1470:fac3:1:211:95ff:fe5c:ecaa/64 scope global dynamic 
       valid_lft 2591972sec preferred_lft 604772sec
    inet6 fe80::211:95ff:fe5c:ecaa/64 scope link 
       valid_lft forever preferred_lft forever

[root@ciprnik ~]# ip -6 route
2001:1470:fac3:1::/64 dev eth2  proto kernel  metric 256  expires 214677sec mtu 1500 advmss 1440 hoplimit 64
fe80::/64 dev eth2  metric 256  expires 2133400sec mtu 1500 advmss 1440 hoplimit 64
ff00::/8 dev eth2  metric 256  expires 2133400sec mtu 1500 advmss 1440 hoplimit 1
default via fe80::20e:38ff:fef4:65c2 dev eth2  proto kernel  metric 1024  expires 174sec mtu 1500 advmss 1440 hoplimit 64
unreachable default dev lo  proto none  metric -1  error -101 hoplimit 255
