SW 프로그래밍/우분투

Ubuntu 22.04 LTS Terminal에서 아이피 주소 변경하기

N2info 2024. 1. 4. 02:46

1. Ubuntu 22.04 LTS Terminal에서 아이피 주소 변경하기

1) 인터페이스 정보 확인

"ifconfig"명령어로 인터페이스 이름 확인

 

2) netplan 설정 파일 변경

"vim /etc/netplan/00-installer-config.yaml" 명령 실행하여 netplan 설정 파일을 vi편집기로 열어서 앞에서 확인한 네트워크 인터페이스 이름 아래에 있는 IP설정 정보를 변경합니다.

sudo nano /etc/netplan/00-installer-config.yaml

# 설정파일 변경 내용 적용
sudo netplan apply  

# ifconfig"명령을 통한 IP주소 변경 내용 확인
ifconfig

# 네트워크 정상 작동 여부 점검 (8.8.8.8은 구글 DNS주소)
ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=115 time=35.6 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=115 time=34.3 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=115 time=35.2 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=115 time=35.6 ms

# nslookup으로 확인
nslookup www.google.com
Server:         127.0.0.53
Address:        127.0.0.53#53

Non-authoritative answer:
Name:   www.google.com
Address: 172.217.25.164
Name:   www.google.com
Address: 2404:6800:400a:80a::2004
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens33:
      addresses:
      - 192.168.35.81/24
      gateway4: 192.168.35.1
      nameservers:
        addresses:
        - 8.8.8.8
        search: []
  version: 2

 

 

3) "sudo netplan apply" 명령을 통해 설정파일 변경 내용 적용 및 "ifconfig"명령을 통한 IP주소 변경 내용 확인과 "ping 8.8.8.8"을 통해 네트워크 정상 작동 여부 점검 (8.8.8.8은 구글 DNS주소)

 

 

 

출처 : https://travel-log.tistory.com/32

 

Ubuntu 22.04 LTS Terminal에서 아이피 주소 변경하기

1. Ubuntu 22.04 LTS Terminal에서 아이피 주소 변경하기 1) 인터페이스 정보 확인 "ifconfig"명령어로 인터페이스 이름 확인 2) netplan 설정 파일 변경 "vim /etc/netplan/00-installer-config.yaml" 명령 실행하여 netplan

travel-log.tistory.com