Set a Static IP Address on Debian

오늘은 Debian에서 네트워크 IP를 고정으로 사용하는 방법에 대해 글을 작성합니다.


🛠 1. Edit the Network Interface Configuration File
(네트워크 인터페이스 설정 파일 수정)

sudo nano /etc/network/interfaces

📄 2. Add Static IP Configuration (Static IP 설정 추가)

For example, to configure the ens18 interface:

예시 설정:

auto ens18
iface ens18 inet static
  address 192.168.0.100
  netmask 255.255.255.0
  gateway 192.168.0.1
  dns-nameservers 8.8.8.8 8.8.4.4
  • address: Static IP address to assign (할당할 고정 IP 주소)
  • netmask: Subnet mask (서브넷 마스크)
  • gateway: Default gateway IP (기본 게이트웨이)
  • dns-nameservers: DNS servers (DNS 서버들)

Check your interface name using ip addr (인터페이스 이름은 ip addr 명령어로 확인 가능).


🔄 3. Reboot to Apply Changes (재부팅하여 설정 적용)

Once configuration is complete, reboot your system:

sudo reboot now

🧪 4. Verify Static IP is Set (설정 적용 확인)

After reboot, run:

ip a

or:

ip addr

Check if your configured static IP appears correctly.

Leave a Comment