Information Security Lab

Research on penetration testing and information security

KH 정보교육원 국비지원 과정/Summary of study contents

25-7-10(목) 리눅스 파일 구조 및 CISCO 네트워크 구축

information-security-lab 2025. 7. 10. 17:35
목차

Ⅰ. 리눅스 사용자 관리 복습 및 파일 구조
      1. 리눅스 기초 사용자 복습
      2. 파일 구조

Ⅱ. CISCO LAN 환경 네트워크 구축
      1. VLAN 설정 변경
      2. Trunk 구성
      3. VLAN Routing

 


 

Ⅰ. 리눅스 사용자 관리 복습 및 파일 구조

1. 리눅스 기초 사용자 복습

가. groupadd / useradd 복습

 

- 유저 생성 시에는 -g 옵션으로 그룹을 추가하면서 생성해야 함

 

- 일반 기업에서는 사용자를 하나의 UID로 관리하고 그룹은 기업의 부서에 맞게 할당하여 계정 관리

 

 

### 명령어 사용 알아두기 ###

- 명령어 사용 시에는 옵션을 묶어서 사용하는 습관이 필요

ex)
# cp -arpf

# tar cvfz

# tar xvfz

 

 

나. usermod

# usermod [ 옵션 ] [ 사용자_명 ]

< 옵션 >

● -g // 그룹 변경

● -G // 보조 그룹 변경
        -a 와 함께 사용되면 보조그룹이 추가됨

● -s // 셸 변경

● -u // UID 변경

● -l // 계정 변경(--login)
        -d, -m 도 같이 사용됨

● -d // 홈 디렉터리 변경(--home)
        -m : 지정한 홈 디렉터리 생성 및 파일 이전, -d와 함께 쓰임(--move-home)

 

 

 

2. 파일 구조

가. 퍼미션 종류

 

- r : read

 

- w : write

 

- x : execute

 

### 참고 ###

- 퍼미션의 문자 하나당 1 bit 이므로 총 9 bit로 구성됨

 

- 자주 사용되는 퍼미션

● 7

● 6

● 5

● 4

 

 

나. 퍼미션 관련 명령

 

- 퍼미션 수정 명령 1

# chmod [ 옵션 ] [ 퍼미션 ] [ 파일 ]

< 옵션 >
● -R // 디렉터리인 경우 하위 디렉터리와 파일까지 수정

 

- 퍼미션 수정 명령 2

# chmod -R 755 ./a/

# chmod o+x,g-x a.txt

# chmod g+wx,o-w,o+x a.txt

# chmod a+rwx,g=w a.txt

 

 

다. SET UID / SET GID / Sticky bit

 

- 추가된 퍼미션으로 실행 및 삭제 권한을 보완함

 

 


 

 

Ⅱ. CISCO LAN 환경 네트워크 구축

1. VLAN 설정 변경

가. 네트워크 구성 개요

사진 Ⅱ-1-1

 

 

나. 각 스위치 설정 

< SW1 설정 >

SW1>en
SW1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#int gig0/1
SW1(config-if)#sw ac vlan 10
SW1(config-if)#sw mode access
SW1(config-if)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24, Gig0/2
10   vlan10                           active    Fa0/2, Gig0/1
20   vlan20                           active    Fa0/3
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
 --More-- 
%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on GigabitEthernet0/1 (10), with SW2 GigabitEthernet0/1 (1).

SW1(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/2, changed state to up

SW1(config-if)#exit
SW1(config)#int gig0/2
SW1(config-if)#sw ac vlan 20
SW1(config-if)#sw mode access
SW1(config-if)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24
10   vlan10                           active    Fa0/2, Gig0/1
20   vlan20                           active    Fa0/3, Gig0/2
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   

SW1(config-if)#^Z
SW1#
%SYS-5-CONFIG_I: Configured from console by console

SW1#write 
%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on GigabitEthernet0/2 (20), with SW2 GigabitEthernet0/2 (1).
Building configuration...
[OK]
SW1#
SW1#write memory
Building configuration...
[OK]
SW1#


< SW2 설정 >

SW2>en
SW2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW2(config)#int gig0/1
SW2(config-if)#sw ac vlan 10
SW2(config-if)#sw mode access
SW2(config-if)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24, Gig0/2
10   vlan10                           active    Fa0/2, Gig0/1
20   vlan20                           active    Fa0/3
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   

SW2(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/2, changed state to up

%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on GigabitEthernet0/2 (1), with SW1 GigabitEthernet0/2 (20).

SW2(config-if)#
SW2(config-if)#^Z
SW2#
%SYS-5-CONFIG_I: Configured from console by console

SW2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW2(config)#int gig0/2
SW2(config-if)#sw ac vlan 20
SW2(config-if)#sw mode access
SW2(config-if)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24
10   vlan10                           active    Fa0/2, Gig0/1
20   vlan20                           active    Fa0/3, Gig0/2
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   

SW2(config-if)#^Z
SW2#
%SYS-5-CONFIG_I: Configured from console by console

SW2#
SW2#
SW2#write memory
Building configuration...
[OK]
SW2#

 

 

 

2. Trunk 구성

가. 네트워크 구성 개요

사진 Ⅱ-2-1

 

 

나. 각 스위치 설정

< SW1 설정 >

SW1>en
SW1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#int gig0/1
SW1(config-if)#no switchport mode access
SW1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up

SW1(config-if)#no switchport access vlan 10
SW1(config-if)#switchport mode trunk

SW1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up

%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on GigabitEthernet0/1 (1), with SW2 GigabitEthernet0/1 (10).

SW1(config-if)#do show int trunk
Port        Mode         Encapsulation  Status        Native vlan
Gig0/1      on           802.1q         trunking      1

Port        Vlans allowed on trunk
Gig0/1      1-1005

Port        Vlans allowed and active in management domain
Gig0/1      1,10,20

Port        Vlans in spanning tree forwarding state and not pruned
Gig0/1      none

SW1(config-if)#^Z
SW1#
%SYS-5-CONFIG_I: Configured from console by console

SW1#write memory
Building configuration...
[OK]
SW1#
%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on GigabitEthernet0/1 (1), with SW2 GigabitEthernet0/1 (10).


< SW2 설정 >

SW2>
SW2>en
SW2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW2(config)#int gig0/1
SW2(config-if)#no switchport mode access
SW2(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up

SW2(config-if)#no switchport access vlan
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to 
SW2(config-if)#
SW2(config-if)#no switchport access vlan10
                                        ^
% Invalid input detected at '^' marker.
	
SW2(config-if)#switchport mode trunk
SW2(config-if)#do show int trunk
Port        Mode         Encapsulation  Status        Native vlan
Gig0/1      on           802.1q         trunking      1

Port        Vlans allowed on trunk
Gig0/1      1-1005

Port        Vlans allowed and active in management domain
Gig0/1      1,10,20

Port        Vlans in spanning tree forwarding state and not pruned
Gig0/1      none

SW2(config-if)#^Z
SW2#
%SYS-5-CONFIG_I: Configured from console by console

SW2#write memory
Building configuration...
[OK]
SW2#

 

 

다. 결과

사진 Ⅱ-2-2

 

 

 

3. VLAN Routing

가. 네트워크 구성 개요

사진 Ⅱ-3-1

 

 

나. 라우터 및 스위치 설정

/* 스위치 설정 */

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname S1
S1(config)#exit
S1#
%SYS-5-CONFIG_I: Configured from console by console

S1#no ip domain-lookup
      ^
% Invalid input detected at '^' marker.
	
S1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
S1(config)#no ip domain-lookup
S1(config)#exit
S1#
%SYS-5-CONFIG_I: Configured from console by console

S1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
S1(config)#vlan 10
S1(config-vlan)#name vlan10
S1(config-vlan)#exit
S1(config)#vlan 20
S1(config-vlan)#name vlan20
S1(config-vlan)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/12
                                                Fa0/13, Fa0/14, Fa0/15, Fa0/16
                                                Fa0/17, Fa0/18, Fa0/19, Fa0/20
                                                Fa0/21, Fa0/22, Fa0/23, Fa0/24
                                                Gig0/1, Gig0/2
10   vlan10                           active    
20   vlan20                           active    
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0

S1(config-vlan)#interface range fa0/10-14
S1(config-if-range)#switchport access vlan 10
S1(config-if-range)#switchport mode access
S1(config-if-range)#exit
S1(config)#int range fa0/20-24
S1(config-if-range)#sw ac vlan 20
S1(config-if-range)#sw mode access
S1(config-if-range)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Gig0/1, Gig0/2
10   vlan10                           active    Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14
20   vlan20                           active    Fa0/20, Fa0/21, Fa0/22, Fa0/23
                                                Fa0/24
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   

S1(config-if-range)#^Z
S1#
%SYS-5-CONFIG_I: Configured from console by console

S1#write memory
Building configuration...
[OK]
S1#
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up

%LINK-5-CHANGED: Interface GigabitEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/2, changed state to up


/* 라우터 설정 */

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#no ip domain-lookup
Router(config)#hostname R1
R1(config)#int 0/0
               ^
% Invalid input detected at '^' marker.
	
R1(config)#int g0/0
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#no sh

R1(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up

R1(config-if)#exit
R1(config)#int g0/1
R1(config-if)#ip address 2.2.2.1 255.255.255.0
R1(config-if)#no sh

R1(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up

R1(config-if)#do show ip int brief
Interface              IP-Address      OK? Method Status                Protocol 
GigabitEthernet0/0     1.1.1.1         YES manual up                    up 
GigabitEthernet0/1     2.2.2.1         YES manual up                    up 
Vlan1                  unassigned      YES unset  administratively down down
R1(config-if)#^Z
R1#
%SYS-5-CONFIG_I: Configured from console by console

R1#
R1#write memory
Building configuration...
[OK]
R1#

 

 

다. 결과

사진 Ⅱ-3-2

/* 1.1.1.3 PC에서 2.2.2.3 PC로 ping이 잘 가는 것을 확인 */

Pinging 2.2.2.3 with 32 bytes of data:

Request timed out.
Reply from 2.2.2.3: bytes=32 time=1ms TTL=127
Reply from 2.2.2.3: bytes=32 time<1ms TTL=127
Reply from 2.2.2.3: bytes=32 time<1ms TTL=127

Ping statistics for 2.2.2.3:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms

C:\>

 

 

 

끝.