Narzędzia użytkownika

Narzędzia witryny


sk1:vlan

Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

Both sides previous revision Poprzednia wersja
Nowa wersja
Poprzednia wersja
sk1:vlan [2018/05/09 13:41]
jkonczak [Konfiguracja switchy CISCO]
sk1:vlan [2020/05/19 13:18] (aktualna)
jkonczak [Konfiguracja switchy CISCO]
Linia 35: Linia 35:
     * ''​enable''​ – wejście w tryb uprzywilejowany     * ''​enable''​ – wejście w tryb uprzywilejowany
   * tryb uprzywilejowany ''#''​   * tryb uprzywilejowany ''#''​
 +    * ''​show interfaces status''​ – pokazanie listę i stan interfejsów
     * ''​configure terminal''​ (''​conf t''​) – wejście w tryb konfiguracji     * ''​configure terminal''​ (''​conf t''​) – wejście w tryb konfiguracji
     * ''​show vlan [brief]''​ (''​sh vlan [br]''​) – pokazanie konfiguracji vlanów     * ''​show vlan [brief]''​ (''​sh vlan [br]''​) – pokazanie konfiguracji vlanów
     * ''​show interfaces trunk''​ – pokazanie aktywnych połączeń typu trunk     * ''​show interfaces trunk''​ – pokazanie aktywnych połączeń typu trunk
 +  * tryb konfiguracji ''​(config)#''​
     * <​html><​small></​html>''​vlan <​nr_vlana>''​ – wejście w konfigurację sieci vlan <​html></​small></​html>​     * <​html><​small></​html>''​vlan <​nr_vlana>''​ – wejście w konfigurację sieci vlan <​html></​small></​html>​
       * <​html><​small></​html>​ ''​name <​nazwa>''​ – nazwanie vlana <​html></​small></​html>​       * <​html><​small></​html>​ ''​name <​nazwa>''​ – nazwanie vlana <​html></​small></​html>​
-  * tryb konfiguracji ''​(config)#''​ 
     * ''​interface <​nazwa_interfejsu>''​ – konfiguracja interfejsu, np. \\ ''​interface //​FastEthernet 0/​1//''​ (''​interface //​Fa0/​1//''​)     * ''​interface <​nazwa_interfejsu>''​ – konfiguracja interfejsu, np. \\ ''​interface //​FastEthernet 0/​1//''​ (''​interface //​Fa0/​1//''​)
     * ''​interface range <lista interfejsów>''​ – konfiguracja wielu interfejsów naraz, np. \\ ''​interface range //​FastEthernet 0/1-5, FastEthernet 0/​11-15//''​     * ''​interface range <lista interfejsów>''​ – konfiguracja wielu interfejsów naraz, np. \\ ''​interface range //​FastEthernet 0/1-5, FastEthernet 0/​11-15//''​
Linia 102: Linia 103:
   * ''​ip l add link <​nazwa_nadinterfejsu>​ <​nazwa_nowego_interfejsu>​ type vlan id <​numer_vlan>''​ \\ dodanie interfejsu reprezentującego vlan, np: \\ ''​ip l add link //eth0// //eth0.2// type vlan id //​2//''​   * ''​ip l add link <​nazwa_nadinterfejsu>​ <​nazwa_nowego_interfejsu>​ type vlan id <​numer_vlan>''​ \\ dodanie interfejsu reprezentującego vlan, np: \\ ''​ip l add link //eth0// //eth0.2// type vlan id //​2//''​
   * ''​ip l del <​nazwa>''​ usunięcie interfejsu   * ''​ip l del <​nazwa>''​ usunięcie interfejsu
 +
 +++++ Przykład konfiguracji routera na Linuksie: |
 +<​html><​pre>​
 +# ip link
 +1: lo: &​lt;​LOOPBACK,​UP,​LOWER_UP>​ mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
 +    link/​loopback 00:​00:​00:​00:​00:​00 brd 00:​00:​00:​00:​00:​00
 +2: eth0: &​lt;​BROADCAST,​MULTICAST>​ mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
 +    link/ether 00:​11:​38:​f0:​41:​00 brd ff:​ff:​ff:​ff:​ff:​ff
 +#
 +# <span title="​Stworzenie na eth0 podinterfejsu dopiętego do sieci o identyfikatorze 10" style="​background-color:​rgba(0,​255,​255,​0.2)">​ip link add eth0.10 link eth0 type <​b>​vlan id 10</​b></​span>​
 +# <span title="​Stworzenie na eth0 podinterfejsu dopiętego do sieci o identyfikatorze 20" style="​background-color:​rgba(255,​255,​0,​0.4)">​ip link add eth0.20 link eth0 type <​b>​vlan id 20</​b></​span>​
 +#
 +<span title="​Włączenie interfejsów"​ style="​background-color:​rgba(0,​0,​0,​0.1)">#​ ip link set eth0 up
 +# ip link set eth0.10 up
 +# ip link set eth0.20 up</​span>​
 +#
 +<span title="​Ustawienie IP z odpowiednich sieci" style="​background-color:​rgba(0,​0,​0,​0.1)">#​ ip link add 192.168.10.1/​24 dev eth0.10
 +# ip link add 192.168.20.1/​24 dev eth0.20</​span>​
 +#
 +# ip -d address
 +1: lo: &​lt;​LOOPBACK,​UP,​LOWER_UP>​ mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
 +    link/​loopback 00:​00:​00:​00:​00:​00 brd 00:​00:​00:​00:​00:​00 promiscuity 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
 +    inet 127.0.0.1/8 scope host lo
 +       ​valid_lft forever preferred_lft forever
 +2: eth0: &​lt;​BROADCAST,​MULTICAST,​UP,​LOWER_UP>​ mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
 +    link/ether 00:​11:​38:​f0:​41:​00 brd ff:​ff:​ff:​ff:​ff:​ff promiscuity 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
 +3: <span style="​background-color:​rgba(0,​255,​255,​0.2)">​eth0.10</​span>​@eth0:​ &​lt;​BROADCAST,​MULTICAST,​UP,​LOWER_UP>​ mtu 1500 qdisc noqueue state UP group default qlen 1000
 +    link/ether 00:​11:​38:​f0:​41:​00 brd ff:​ff:​ff:​ff:​ff:​ff promiscuity 0 
 +    <span style="​background-color:​rgba(0,​255,​255,​0.2)">​vlan protocol 802.1Q id 10</​span>​ &​lt;​REORDER_HDR>​ numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
 +    inet 192.168.10.1/​24 brd 192.168.10.255 scope global
 +       ​valid_lft forever preferred_lft forever
 +4: <span style="​background-color:​rgba(255,​255,​0,​0.4)">​eth0.20</​span>​@eth0:​ &​lt;​BROADCAST,​MULTICAST,​UP,​LOWER_UP>​ mtu 1500 qdisc noqueue state UP group default qlen 1000
 +    link/ether 00:​11:​38:​f0:​41:​00 brd ff:​ff:​ff:​ff:​ff:​ff promiscuity 0 
 +    <span style="​background-color:​rgba(255,​255,​0,​0.4)">​vlan protocol 802.1Q id 20</​span>​ &​lt;​REORDER_HDR>​ numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
 +    inet 192.168.20.1/​24 brd 192.168.20.255 scope global
 +       ​valid_lft forever preferred_lft forever
 +# ip route
 +192.168.10.0/​24 dev eth0.10 proto kernel scope link src 192.168.10.1 ​
 +192.168.20.0/​24 dev eth0.20 proto kernel scope link src 192.168.20.1
 +<span title="​Zabronienie nawiązywania połączeń z VLANu 10 do VLANu 20" style="​background-color:​rgba(0,​0,​0,​0.1)">#​ iptables -A FORWARD -i eth0.10 -o eth0.20 -m conntrack --ctstate NEW -j DROP</​span>​
 +<span title="​Włączenie przekazywania pakietów"​ style="​background-color:​rgba(0,​0,​0,​0.1)">#​ sysctl net.ipv4.conf.all.forwarding=1</​span>​
 +</​pre></​html>​ ++++
  
 ===== Konfiguracja routerów CISCO ===== ===== Konfiguracja routerów CISCO =====
Linia 113: Linia 156:
     * ''​no shut''​– żeby podinterfejs działał, trzeba włączyć cały interfejs     * ''​no shut''​– żeby podinterfejs działał, trzeba włączyć cały interfejs
  
 +++++ Przykładowa konfiguracja routera CISCO: |
 +<​html><​pre>​
 +R1#           
 +R1#conf t
 +R1(config)#<​span title="​Stworzenie na eth0 podinterfejsu dopiętego do sieci o identyfikatorze 10" style="​background-color:​rgba(0,​255,​255,​0.2)">​interface GigabitEthernet 0/​0.10</​span>​
 +R1(config-subif)#<​span title="​Stworzenie na eth0 podinterfejsu dopiętego do sieci o identyfikatorze 10" style="​background-color:​rgba(0,​255,​255,​0.2)">​encapsulation dot1Q 10</​span>​
 +R1(config-subif)#<​span title="​Ustawienie IP z odpowiedniej sieci" style="​background-color:​rgba(0,​0,​0,​0.1)">​ip address 192.168.10.254 255.255.255.0</​span>​
 +R1(config-subif)#​exit
 +R1(config)#<​span title="​Stworzenie na eth0 podinterfejsu dopiętego do sieci o identyfikatorze 20" style="​background-color:​rgba(255,​255,​0,​0.4)">​interface GigabitEthernet 0/​0.20</​span>​
 +R1(config-subif)#<​span title="​Stworzenie na eth0 podinterfejsu dopiętego do sieci o identyfikatorze 20" style="​background-color:​rgba(255,​255,​0,​0.4)">​encapsulation dot1Q 20</​span>​
 +R1(config-subif)#<​span title="​Ustawienie IP z odpowiedniej sieci" style="​background-color:​rgba(0,​0,​0,​0.1)">​ip address 192.168.20.254 255.255.255.0</​span>​
 +R1(config-subif)#​exit
 +R1(config)#​interface GigabitEthernet 0/0
 +R1(config-if)#<​span title="​Włączenie interfejsów"​ style="​background-color:​rgba(0,​0,​0,​0.1)">​no shutdown</​span>​
 +R1(config-if)#​end
 +R1#sh ip interface brief 
 +Interface ​                 IP-Address ​     OK? Method Status ​               Protocol
 +GigabitEthernet0/​0 ​        ​unassigned ​     YES unset  up                    up      ​
 +GigabitEthernet0/​0.10 ​     192.168.10.254 ​ YES manual up                    up      ​
 +GigabitEthernet0/​0.20 ​     192.168.20.254 ​ YES manual up                    up      ​
 +GigabitEthernet1/​0 ​        ​unassigned ​     YES unset  administratively down down    ​
 +R1#show interfaces GigabitEthernet 0/0.10
 +<span style="​background-color:​rgba(0,​255,​255,​0.2)">​GigabitEthernet0/​0.10</​span>​ is up, line protocol is up 
 +  Hardware is i82543 (Livengood),​ address is ca03.485d.0008 (bia ca03.485d.0008)
 +  Internet address is 192.168.10.254/​24
 +  MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, 
 +     ​reliability 255/255, txload 1/255, rxload 1/255
 +  <span style="​background-color:​rgba(0,​255,​255,​0.2)">​Encapsulation 802.1Q Virtual LAN, Vlan ID  10.</​span>​
 +  ARP type: ARPA, ARP Timeout 04:00:00
 +  Last clearing of "show interface"​ counters never
 +R1#show interfaces GigabitEthernet 0/0
 +GigabitEthernet0/​0 is up, line protocol is up 
 +  Hardware is i82543 (Livengood),​ address is ca03.485d.0008 (bia ca03.485d.0008)
 +  MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, 
 +     ​reliability 255/255, txload 1/255, rxload 1/255
 +  <span title="​Pakiety z native VLAN – domyślnie VLAN 1 – będą odbierane na głównym interfejsie"​ style="​background-color:​rgba(0,​0,​0,​0.1)">​Encapsulation 802.1Q Virtual LAN, Vlan ID  1., loopback not set</​span>​
 +  ...
 +</​pre></​html>​++++
sk1/vlan.1525866104.txt.gz · ostatnio zmienione: 2018/05/09 13:41 przez jkonczak