CS/Linux

๋ฆฌ๋ˆ…์Šค ๊ณ ์ • IP ์„ค์ •ํ•˜๋Š” ๋ฒ•

๋ฉ์Ÿˆ๋ฝ€์จ• 2024. 12. 16. 02:40

๐Ÿ’ก ๋ชจ๋ฅด๋ฉด ๋ฐ”๋ณด (๋‚˜๋งŒ)
๋ฆฌ๋ˆ…์Šค: ์œˆ๋„์šฐ๋ž‘ ๋น„์Šทํ•œ ๊ฑฐ
๋ช…๋ น์–ด: ํ”„๋กœ๊ทธ๋žจ
์„œ๋ฒ„: ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ
ํด๋ผ์ด์–ธํŠธ: ์„œ๋น„์Šค๋ฅผ ์ด์šฉํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ
IP์ฃผ์†Œ: ๋ฉ€๋ฆฌ ์žˆ๋Š” ์ปดํ“จํ„ฐ๋ฅผ ์ฐพ์•„๊ฐ€๋Š” ์ฃผ์†Œ
ํฌํŠธ ๋ฒˆํ˜ธ : ์ปดํ“จํ„ฐ์—์„œ ์‹คํ–‰ ์ค‘์ธ ํŠน์ • ํ”„๋กœ๊ทธ๋žจ์„ ์ฐพ์•„๊ฐ€๋Š” ๋ฒˆํ˜ธ

 

 

 

**IP์ฃผ์†Œ**

0.0.0.0~255.255.255.255

00000000.00000000.00000000.00000000

11111111.11111111.11111111.11111111

 

IP์ฃผ์†Œ 00000000.00000000.00000000.00000000

์„œ๋ธŒ๋„ท 11111111.11111111.00000000.00000000

(๋ณดํ†ต ์•ž์—์„œ 3๋ฒˆ์งธ๊นŒ์ง€ ๋„คํŠธ์›Œํฌ ๊ตฌ๋ถ„ ์ฃผ์†Œ)

 

IP ์ฃผ์†Œ์˜ ์•ž ์ชฝ์€ ๋„คํŠธ์›Œํฌ๋ฅผ ๊ตฌ๋ถ„ํ•˜๋Š” ์ฃผ์†Œ

IP ์ฃผ์†Œ์˜ ๋’ค์ชฝ์€ ํŠน์ • ๋„คํŠธ์›Œํฌ์—์„œ ์ปดํ“จํ„ฐ๋ฅผ ๊ตฌ๋ถ„ํ•˜๋Š” ์ฃผ์†Œ

โœจ๊ณ ์ • IP์„ค์ •ํ•˜๋Š” ๋ฒ•

์„œ๋ฒ„์ปดํ“จํ„ฐ๋Š” ip๋ฅผ ์•Œ์•„์„œ ์„ค์ •ํ•˜๋ฉด ์•ˆ๋œ๋‹ค.

→ ์™œ๋ƒํ•˜๋ฉด ์„œ๋ฒ„ ์ปดํ“จํ„ฐ๋Š” ๊ณ ์ • IP์ฃผ์†Œ๊ฐ€ ํ•„์š”ํ•จ

  1. ๊ด€๋ฆฌ์ž ๋กœ๊ทธ์ธ
sudo su - root
2. ๋„คํŠธ์›Œํฌ ip์ฃผ์†Œ ์„ค์ •
vi /etc/netplan/00-installer-config.ya

์›๋ž˜๋Š” ์œ„์— ์ฒ˜๋Ÿผ dhcp4:true๋กœ ์•Œ์•„์„œ ip์ฃผ์†Œ๋ฅผ ํ• ๋‹น ์‹œ์ผฐ๋Š”๋ฐ

์•„๋ž˜์ฒ˜๋Ÿผ false๋กœ ์„ค์ •(์ˆ˜๋™ ์„ค์ •)ํ•ด์„œ ip ์ฃผ์†Œ๊ฐ€ ๊ณต์œ ๊ธฐ๊ฐ€ ๋ฐ”๋€Œ๋”๋ผ๋„ ๊ณ ์ •์ด ๋˜๋„๋ก ์„ค์ •.

 

์ฐธ๊ณ ) ๊ฒŒ์ดํŠธ ์›จ์ด ์ฃผ์†Œ ํ™•์ธํ•˜๊ธฐ(Virtual Network Editor๋Š” vm์›จ์–ด ๋ฉ”๋‰ด ์ค‘ edit์— ์žˆ๋‹ค.)

์•„๋ž˜ ์‚ฌ์ง„(Virtual Network Editor) subnetIP๋Š” ๋„คํŠธ์›Œํฌ ๋Œ€์—ญ์„ ์„ค์ •ํ•˜๋Š” ๊ฒƒ IP์ฃผ์†Œx

 

 

 

network:
  ethernets:
    ens33:                                #์ธํ„ฐํŽ˜์ด์Šค ์ด๋ฆ„
      dhcp4: false                        # DHCP ๋น„ํ™œ์„ฑํ™” (์ •์  IP ์‚ฌ์šฉ)
      addresses:
        - 100.100.100.10/24               # ์ •์  IP ์ฃผ์†Œ ๋ฐ ์„œ๋ธŒ๋„ท ๋งˆ์Šคํฌ
      nameservers:
        addresses: [8.8.8.8]              # DNS ์„œ๋ฒ„ ์ฃผ์†Œ
      routes:
        - to: default                     # ๊ธฐ๋ณธ ๋ผ์šฐํŒ… (๋ชจ๋“  ํŠธ๋ž˜ํ”ฝ)
          via: 100.100.100.2              # ๊ธฐ๋ณธ ๊ฒŒ์ดํŠธ์›จ์ด ์ฃผ์†Œ
  version: 2                              # Netplan ๊ตฌ์„ฑ ํŒŒ์ผ ๋ฒ„์ „

 

 

dhcp4: false

  • DHCP๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธ
    • DHCP(Dynamic Host Configuration Protocol)๋Š” ๋„คํŠธ์›Œํฌ ์ƒ์—์„œ IP ์ฃผ์†Œ๋ฅผ ์ž๋™์œผ๋กœ ํ• ๋‹นํ•ด ์ฃผ๋Š” ์„œ๋น„์Šค
    • ์—ฌ๊ธฐ์„œ๋Š” ์ •์  IP ์ฃผ์†Œ๋ฅผ ์„ค์ •ํ•˜๋ฏ€๋กœ DHCP๋ฅผ ๋„๊ณ  ์žˆ์Œ

address:

100.100.100.10/24

100.100.100.10์€ip, 24๋Š” ์„œ๋ธŒ๋„ท ๋งˆ์Šคํฌ(255.255.255.0→11111111.11111111.11111111.00000000)

nameservers:

  • DNS ์„œ๋ฒ„ ์ฃผ์†Œ๋ฅผ ์ง€์ •
    • addresses: [8.8.8.8]: Google์˜ ํผ๋ธ”๋ฆญ DNS ์„œ๋ฒ„(8.8.8.8)๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ์„ค์ •

to: default

  • ๋ชจ๋“  ๋„คํŠธ์›Œํฌ ํŠธ๋ž˜ํ”ฝ(0.0.0.0/0)์„ ๊ธฐ๋ณธ ๊ฒŒ์ดํŠธ์›จ์ด(via: 100.100.100.2)๋กœ ๋ณด๋‚ธ๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธ

๊ธฐ๋ณธ ๊ฒŒ์ดํŠธ์›จ์ด = ๊ธฐ๋ณธ ๊ณต์œ ๊ธฐ ip ์ฃผ์†Œ, ์ฆ‰ ์ด ๊ณต์œ ๊ธฐ๋ฅผ ์‚ฌ์šฉํ•ด๋ผ.

 

:wq! ํŒŒ์ผ ์ˆ˜์ •ํ•˜๊ณ ๋‚˜์„œ ์ €์žฅ ํ•  ๋•Œ ์ ์šฉ ๋ช…๋ น์–ด

!ํŒŒ์ผ ๋ณ€๊ฒฝ ์‹œ ์ฃผ์˜ ์‚ฌํ•ญ!

์„ค์ • ํŒŒ์ผ ๋ณ€๊ฒฝ → ์ ์šฉ → ๋™์ž‘ ํ™•์ธ

ping 8.8.8.8

ping www.naver.com

์œ„ ๋ช…๋ น์–ด๊ฐ€ ์ž‘๋™ ์•ˆํ•˜๋ฉด ์•„๋ž˜ ๋ถ€๋ถ„ ํ™•์ธ!!

      routes:
        - to: default                     # ๊ธฐ๋ณธ ๋ผ์šฐํŒ… (๋ชจ๋“  ํŠธ๋ž˜ํ”ฝ)
          via: 100.100.100.2              # ๊ธฐ๋ณธ ๊ฒŒ์ดํŠธ์›จ์ด ์ฃผ์†Œ
  version: 2                              # Netplan ๊ตฌ์„ฑ ํŒŒ์ผ ๋ฒ„์ „

๋ฆฌ๋ˆ…์Šค์— ip ์ฃผ์†Œ๋ฅผ ์„ค์ •ํ•ด์„œ ์ž˜ ๋™์ž‘ํ•˜๋Š” ์ง€ ํ™•์ธ

๋™์ž‘ x

ovsdb-server.service is not running ์ด๋ ‡๊ฒŒ ๋– ๋„ ์˜ค๋ฅ˜๊ฐ€ ์•„๋‹ˆ๊ณ  WARNING์ด๊ธฐ๋•Œ๋ฌธ์— ๊ทธ๋ƒฅ ๋„˜์–ด๊ฐ€๋ฉด ๋œ๋‹ค.

'''
apt update -y
apt-get install -y openvswitch-switch-dpdk
'''

ํ˜น์‹œ waring ํ•ด๊ฒฐํ•˜๊ณ  ์‹ถ์œผ๋ฉด ์œ„์ฒ˜๋Ÿผ ๋‹ค์šด ๋ฐ›์œผ๋ฉด ๋œ๋‹ค.

์ด๋ ‡๊ฒŒ ์„ค์น˜ํ–ˆ๋”๋‹ˆ ๊ฐ‘์ž๊ธฐ ๋ฌดํ•œ ๋‹ค์šด๋กœ๋“œ์˜ ๊ตด๋ ˆ์— ๋น ์กŒ๋‹ค.

์›์ธ์€ ์ธํ„ฐ๋„ท ํ™˜๊ฒฝ ๋ฌธ์ œ์˜€๋‹ค. ๋ฆฌ๋ˆ…์Šค ์ปดํ“จํ„ฐ์˜ ๊ณต์œ ๊ธฐ IP์ฃผ์†Œ์™€ ๋ฆฌ๋ˆ…์Šค ์ปดํ“จํ„ฐ์˜ IP์ฃผ์†Œ๊ฐ€ ๊ฐ™์•˜์—ˆ๋‹ค.

์„ค์น˜์ด์ „์— ์ธํ„ฐ๋„ท์ด ๋˜๋Š”์ง€ ํ™•์ธํ•˜๊ณ  ์‹ถ์œผ๋ฉด

ping [8.8.8.8]

 

ํ†ต์‹ ์ด ์•ˆ๋˜๋Š” ์ผ€์ด์Šค

  • ๋ณด๋ƒˆ๋Š”๋ฐ ์‘๋‹ต์ด ์•ˆ์˜ค๋Š” ๊ฒฝ์šฐ: ์ƒ๋Œ€๋ฐฉ์˜ ๋ฐฉํ™”๋ฒฝ์ด ์ผœ์ ธ์žˆ์„๋•Œ
    • ์š”์ฒญ์‹œ๊ฐ„์ด ๋งŒ๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
    • timeout
  • ๋ณด๋‚ด์ง€์กฐ์ฐจ ๋ชปํ•œ ์ผ€์ด์Šค: ๋‚ด ์ปดํ“จํ„ฐ์˜ IP ์„ค์ •์ด ์ž˜๋ชป๋์„ ๋•Œ
    • destination unreachable

 

 

  1. ๋ ˆํฌ์ง€ํ† ๋ฆฌ ๋ชฉ๋ก ๊ฐฑ์‹ (์ฒ˜์Œ ์ƒ์„ฑํ• ๋•Œ ๋ฌด์กฐ๊ฑด ํ•ด์ค˜์•ผํ•จ)
apt update

๋ฆฌ๋ˆ…์Šค ๋ช…๋ น์–ด

apt๋ฆฌ๋ˆ…์Šค

pip ํŒŒ์ด์ฌ

npm ๋…ธ๋“œ

์–ด์ฉŒ๊ตฌ ๋“ฑ๋“ฑ

apt → ์•Œ์•„์„œ ์ธํ„ฐ๋„ท์—์„œ ์ฐพ์•„์„œ ์„ค์น˜๋จ(์ธํ„ฐ๋„ท ์—ฐ๊ฒฐ ํ•„์ˆ˜)

apt install [ํ”„๋กœ๊ทธ๋žจ๋ช…]

apt install nginx → ์›น์„œ๋ฒ„

๋ฆฌ๋ˆ…์Šค๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ๋ณดํ†ต ์„œ๋น„์Šค๋กœ ๋“ฑ๋กํ•˜๊ณ 

systemctl restart [ํ”„๋กœ๊ทธ๋žจ๋ช…]

๋ช…๋ น์–ด๋กœ ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰์‹œํ‚ด

ํ™•์ธ ํ•˜๋ ค๋ฉด

ps -ef ํ˜น์€

systemctl status [ํ”„๋กœ๊ทธ๋žจ๋ช…]

q ๋ˆ„๋ฅด๋ฉด ๋๋‚ด๊ธฐ

netstat -anlp

netstat - anlp | grep :80

:80 ๋“ค์–ด๊ฐ„ ๊ฒƒ๋งŒ ๊ณจ๋ผ์„œ ๋ณด์—ฌ์คŒ

apt update: ์ €์žฅ์†Œ ๋ชฉ๋ก์„ ์ตœ์‹  ๋ชฉ๋ก์œผ๋กœ ๋ฐ”๊ฟ”์คŒ(apt๋ช…๋ น์–ด ์‚ฌ์šฉํ•˜๊ธฐ ์ „์— ๊ผญ ํ•ด์ค˜์•ผํ•œ๋‹ค ๋งจ์ฒ˜์Œ์— ์•ˆํ•ด์ฃผ๋ฉด ์˜ค๋ฅ˜๋‚จ)

ํฌํŠธ๋ฒˆํ˜ธ

์›น ์„œ๋ฒ„(80)

์›น์„œ๋ฒ„์— ํฌํŠธ๋ฒˆํ˜ธ๊ฐ€ ์—†๋Š” ์ด์œ : 80์œผ๋กœ ์•ฝ์†ํ•˜๊ณ  ํ”„๋กœ๊ทธ๋žจ์—์„œ ์•Œ์•„์„œ ์ง€์ •ํ•ด์คŒ

DNS ์„œ๋ฒ„(53)

SSH์„œ๋ฒ„(22)