• 돌아가기
  • 아래로
  • 위로
  • 목록
  • 댓글
가이드

Ubuntu 24.04 LTS 고정 IP설정하기

달소 달소 142

0

3

 

안녕하세요. 달소입니다.

 

이번글에서는 앞서 설치한 Ubuntu 24에서 고정 ip를 설정하는방법입니다.

기본적으로 Ubuntu 20인가부터 netplan을 사용하기 시작했기때문에 설정방법은 모두 대동소이하나 기록용으로 남겨봅니다.

 

최초에 dhcp로 설정한 경우에는 헷갈릴수도있으니까요.

 

기본 vi 에디터가 없으면 apt install vim 으로 설치해주시면됩니다.

 

vi /etc/netplan/50-cloud-init.yaml

 

 DHCP로 설치하신경우 기본적으로 아래와같이 되어있는데요.

 

image.png.jpg

 

해당 값들을 아래처럼 바꿔주시면 됩니다.

 

인터페이스는 ifconfig 명령어로 확인해주시고 설정해주세요.

 

image.png.jpg

 

address: 는 ip와 서브넷마스크를 의미합니다.

nameservers:는 dns이고

routes:는 디폴트라우팅 설정입니다.

 

# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        ens18:
            addresses:
            - 192.168.1.23/24
            nameservers:
                addresses:
                - 1.1.1.1
                search:
                - 8.8.4.4
            routes:
            -   to: default
                via: 192.168.1.1
    version: 2

 

설정 후 netplan apply로 적용을 해주시면되는데

주의할점은 기존연결한 ip가 구 ip라면 연결이 끊기기때문에 가급적 콘솔에서 작업해주시는게 좋습니다.

 

image.png.jpg

 

ip가 바뀌면 아래처럼 다시 로그인하실 수 있습니다.

 

image.png.jpg

 

신고공유스크랩
3

달소 달소
98Lv. 195011P
다음 레벨까지 1009P


메인서버 - Ryzen 5700G / Proxmox 7.2 / Ubuntu / Xpenology / 기타 VM 등등
보조서버 - Intel i9-9900ES(QQC0) / H370M / Proxmox 7.1 / 아직개발용서버로 사용중
백업스토리지서버 - DS920+ 
하드웨어,가상화 등등 여러 IT분야에 관심이 두루두루많습니다만 깊게알고있는건 없습니다 하하하

profile image 1등
kmw_ 2024.04.26. 19:28
고정아이피 설정하려 했다가 이게 맞나 싶었는데 바뀌었나보군요
profile image
kmw_ 2024.04.26. 19:32
kmw_

추가로 위 방법대로 안해도

# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        enp6s18:
            addresses: [192.168.0.16/24]
            gateway4: 192.168.0.1
            nameservers:
                addresses: [1.1.1.1, 1.0.0.1]
    version: 2

 이전 방법으로 해도 되긴합니다 (분명 답글로 단것같은데 새로 달렸네요)

댓글 쓰기 권한이 없습니다. 로그인

취소 댓글 등록

cmt alert

신고

"님의 댓글"

이 댓글을 신고하시겠습니까?

댓글 삭제

"님의 댓글"

삭제하시겠습니까?


목록

공유

facebooktwitterpinterestbandkakao story
번호 분류 제목 글쓴이 날짜 조회 추천
질문 /var/www 폴더가 삭제되었습니다. ㅜ,.ㅜ 2 니속사정 1일 전20:42 250 +1
잡담 jellyfin 자원 진짜 안쓰네요 kmw_ 1일 전19:26 357 +1
잡담 iventoy pxe는 속도가 엄청 느리군요.. nohdd는 왜 빠르지.. 음... 2 purndal 2일 전00:52 193 +2
131 가이드
image
keiminem 23.12.24.21:55 643 +5
130 가이드
image
keiminem 23.12.24.21:36 617 +1
129 가이드
image
keiminem 23.12.24.21:12 283 0
128 가이드
image
keiminem 23.12.24.21:02 429 +1
127 가이드
image
keiminem 23.12.24.20:47 510 +1
126 가이드
image
달소 6일 전22:22 416 +3
125 가이드
image
ljr10 24.05.01.08:20 188 0
124 가이드
image
달소 24.04.26.18:09 373 0
123 가이드
image
달소 24.05.01.06:46 215 +1
122 가이드
image
달소 24.04.26.17:40 336 +2
121 가이드
image
달소 24.04.26.18:33 282 +1
가이드
image
달소 24.04.26.19:06 142 0
119 가이드
image
달소 24.04.25.07:24 403 0
118 가이드
image
달소 24.04.25.22:54 138 0
117 가이드
image
달소 24.04.25.23:10 173 +1
116 가이드
image
달소 24.04.11.23:10 754 +3
115 가이드
image
앨런임더 23.04.02.15:52 1443 +3
114 가이드
file
펜타네스트 24.04.15.18:39 335 +1
113 가이드
image
냐아아아ㅏ 23.09.27.01:41 343 +2
112 가이드
image
opq! 24.04.02.21:25 485 +8