통신 과정(네트워크 관점)

mcyoo.log·2022년 8월 16일
0

Network

목록 보기
14/14
post-thumbnail

요약
네트워크 장비 관점에서 통신이 되는 과정을 설명한다.

기술 스택
1. VLAN
2. OSPF
3. HSRP
4. PVST

구성도

1호기 설정

SW1#show run
Building configuration...

Current configuration : 2164 bytes
!
version 16.3.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname SW1
!
!
!
!
!
!
!
ip cef
ip routing
!
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
spanning-tree vlan 10 priority 8192
spanning-tree vlan 20 priority 24576
!
!
!
!
!
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface GigabitEthernet1/0/1
 switchport mode trunk
 switchport nonegotiate
!
interface GigabitEthernet1/0/2
 switchport mode trunk
 switchport nonegotiate
!
interface GigabitEthernet1/0/3
 switchport mode trunk
!
interface GigabitEthernet1/0/4
 no switchport
 ip address 192.168.100.10 255.255.255.252
 duplex auto
 speed auto
!
!
!
interface Vlan1
 no ip address
 shutdown
!
interface Vlan10
 mac-address 0010.1127.0301
 ip address 192.168.10.253 255.255.255.0
 standby 1 ip 192.168.10.1
 standby 1 priority 105
 standby 1 preempt
!
interface Vlan20
 mac-address 0010.1127.0302
 ip address 192.168.20.254 255.255.255.0
 standby 2 ip 192.168.20.1
 standby 2 priority 105
 standby 2 preempt
!
router ospf 10
 log-adjacency-changes
 redistribute connected subnets 
 network 192.168.100.8 0.0.0.3 area 0
!
ip classless
!
ip flow-export version 9
!
end

2호기 설정

SW2#show run
Building configuration...

Current configuration : 2066 bytes
!
version 16.3.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname SW2
!
!
!
!
!
!
!
no ip cef
ip routing
!
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface GigabitEthernet1/0/1
 switchport mode trunk
 switchport nonegotiate
!
interface GigabitEthernet1/0/2
 switchport mode trunk
 switchport nonegotiate
!
interface GigabitEthernet1/0/3
 switchport mode trunk
!
interface GigabitEthernet1/0/4
 no switchport
 ip address 192.168.100.9 255.255.255.252
 ip ospf priority 10
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
interface Vlan10
 mac-address 000d.bd0e.8d01
 ip address 192.168.10.254 255.255.255.0
 standby 1 ip 192.168.10.1
 standby 1 preempt
!
interface Vlan20
 mac-address 000d.bd0e.8d02
 ip address 192.168.20.253 255.255.255.0
 standby 2 ip 192.168.20.1
 standby 2 preempt
!
router ospf 10
 log-adjacency-changes
 redistribute connected subnets 
 network 192.168.100.8 0.0.0.3 area 0
!
ip classless
!
ip flow-export version 9
!
!
!
end

3호기 설정

show run
Building configuration...

Current configuration : 1174 bytes
!
version 15.0
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname SW3
!
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
 switchport access vlan 10
 switchport mode access
!
interface GigabitEthernet0/1
 switchport mode trunk
!
interface GigabitEthernet0/2
 switchport mode trunk
!
interface Vlan1
 no ip address
 shutdown
!
!
end

4호기 설정

SW4#show run
Building configuration...

Current configuration : 1174 bytes
!
version 15.0
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname SW4
!
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
interface FastEthernet0/1
 switchport access vlan 20
 switchport mode access
!
interface GigabitEthernet0/1
 switchport mode trunk
!
interface GigabitEthernet0/2
 switchport mode trunk
!
interface Vlan1
 no ip address
 shutdown
!
!
!
!
line con 0
!
line vty 0 4
 login
line vty 5 15
 login
!
!
!
!
end

확인사항

PC0(192.168.10.10) <-> PC1(192.168.20.10) 통신 경로 확인

PC0 에서 ping 192.168.20.10 쳤을때..

PC0 라우팅 테이블 확인

C:\>netstat -r

Route Table
===========================================================================
Interface List
0x1 ........................... PT TCP Loopback interface
0x2 ...00 16 6f 0d 88 ec ...... PT Ethernet interface
0x1 ........................... PT TCP Loopback interface
0x2 ...00 16 6f 0d 88 ec ...... PT Bluetooth interface
===========================================================================
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0     192.168.10.1   192.168.10.10       1
Default Gateway:      192.168.10.1
===========================================================================
Persistent Routes:
  None

192.168.20.10 은 인터페이스에 할당된 네트워크 대역이 달라서 게이트웨이 IP로 전송

arp 테이블 게이트웨이 IP MAC 주소 확인

C:\>arp -a
  Internet Address      Physical Address      Type
  192.168.10.1          0000.0c07.ac01        dynamic

출발지 MAC 주소(인터페이스 MAC)
0060.5c28.64ae
목적지 MAC 주소(게이트웨이 MAC)
0000.0c07.ac01
출발지 IP 주소
192.168.10.10
목적지 IP 주소
192.168.20.10

패킷 완성 자기 인터페이스(NIC 카드)로 전송

3호기 스위치 MAC table 확인

SW3#show mac address-table 
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----

   1    0002.164e.3201    DYNAMIC     Gig0/1
   1    0090.21b4.5902    DYNAMIC     Gig0/2
  10    0002.164e.3201    DYNAMIC     Gig0/1
  10    0010.1127.0301    DYNAMIC     Gig0/1
  10    0060.5c28.64ae    DYNAMIC     Fa0/1
  20    0002.164e.3201    DYNAMIC     Gig0/1
  20    0010.1127.0302    DYNAMIC     Gig0/1
  30    0002.164e.3201    DYNAMIC     Gig0/1
  30    0090.21b4.5902    DYNAMIC     Gig0/2
  40    0002.164e.3201    DYNAMIC     Gig0/1
  40    0090.21b4.5902    DYNAMIC     Gig0/2

목적지 MAC 주소에 해당되는 포트가 없으므로 수신한 포트 제외한 나머지 포트로 플로딩(뿌리기)
Gig0/1 , Gig0/2

트렁크 포트(태그포트) 로 설정된 포트로 나갈때는 VLAN ID 를 붙이고 플로딩 됨

1호기 패킷 수신 후 VLAN ID 확인

VLAN 10 에서 목적지 MAC 주소가 자기 자신에 MAC 주소 인거 확인 후 IP 확인

1호기(SW1) 라우팅 테이블 확인

SW1#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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

Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
O E2    2.2.2.2 [110/20] via 192.168.100.9, 00:59:19, GigabitEthernet1/0/4
C    192.168.10.0/24 is directly connected, Vlan10
C    192.168.20.0/24 is directly connected, Vlan20
     192.168.100.0/30 is subnetted, 1 subnets
C       192.168.100.8 is directly connected, GigabitEthernet1/0/4

connected로 된 192.168.20.0/24 경로 매치 (라우팅)

라우팅 경로가 VLAN 20 으로 되있음, arp 테이블 확인

SW1#show ip arp
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  192.168.10.1            35  0000.0C07.AC01  ARPA   Vlan10
Internet  192.168.10.10           31  0060.5C28.64AE  ARPA   Vlan10
Internet  192.168.10.253          -   0010.1127.0301  ARPA   Vlan10
Internet  192.168.20.10           36  0090.2B7D.7CA3  ARPA   Vlan20
Internet  192.168.20.253          36  000D.BD0E.8D02  ARPA   Vlan20
Internet  192.168.20.254          -   0010.1127.0302  ARPA   Vlan20
Internet  192.168.100.9           36  0090.21B4.5904  ARPA   GigabitEthernet1/0/4
Internet  192.168.100.10          -   0002.164E.3204  ARPA   GigabitEthernet1/0/4

VLAN20 에 해당 목적지 IP에 192.168.20.10 에 대한 MAC 주소가 있으므로

출발지 MAC
0060.5c28.64ae
목적지 MAC(변경)
0090.2B7D.7CA3
출발지 IP
192.168.10.10
목적지 IP
192.168.20.10

으로 패킷 만들고 mac 테이블 확인

SW1#show mac address-table 
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----

   1    00d0.ff6a.0a19    DYNAMIC     Gig1/0/2
  10    0060.5c28.64ae    DYNAMIC     Gig1/0/1
  20    0090.2b7d.7ca3    DYNAMIC     Gig1/0/2
  30    00d0.ff6a.0a19    DYNAMIC     Gig1/0/2
  40    00d0.ff6a.0a19    DYNAMIC     Gig1/0/2

VLAN 20 에 해당되는 포트 중에 MAC 목적지 MAC 주소와 일치하는 포트로 패킷을 포워딩한다.
Gig1/0/2로 전송

4호기 스위치

SW4#show mac address-table 
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----

   1    0002.164e.3202    DYNAMIC     Gig0/1
   1    0090.21b4.5901    DYNAMIC     Gig0/2
  10    0002.164e.3202    DYNAMIC     Gig0/1
  10    0010.1127.0301    DYNAMIC     Gig0/1
  20    0002.164e.3202    DYNAMIC     Gig0/1
  20    0010.1127.0302    DYNAMIC     Gig0/1
  20    0090.2b7d.7ca3    DYNAMIC     Fa0/1
  30    0090.21b4.5901    DYNAMIC     Gig0/2
  40    0090.21b4.5901    DYNAMIC     Gig0/2

목적지 MAC 주소와 일치하는 포트 Fa0/1 인거 확인
Fa0/1 로 패킷 포워딩

PC1

C:\>netstat -r

Route Table
===========================================================================
Interface List
0x1 ........................... PT TCP Loopback interface
0x2 ...00 16 6f 0d 88 ec ...... PT Ethernet interface
0x1 ........................... PT TCP Loopback interface
0x2 ...00 16 6f 0d 88 ec ...... PT Bluetooth interface
===========================================================================
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0     192.168.20.1   192.168.20.10       1
Default Gateway:      192.168.20.1
===========================================================================
Persistent Routes:
  None

PC1은 자기 자신의 MAC 주소인거 확인하고 IP 확인 내 IP 인거 확인 하고 ICMP 프로토콜(Ping) 처리 Reply 전송

반대도 똑같은 통신과정을 통해 Ping 성공이 됨

Request , Reply 둘 다 문제 없어야지 ping 성공

마무리
패킷트레이서를 이용하여 PC0 에서 PC1 로 스위치, 라우터 관점에서 통신이 되는 과정을 확인

0개의 댓글