ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Virtual box 고정 IP 생성 (우분투 STATIC IP 만들기)
    서버 2016. 1. 23. 13:29


     OS

     Virtual box

     guest OS

     윈도우 10

     5.0.12

     우분투 14.04 LTS


    먼저 virtual box(이하 vb라 부름)에서 우분투 14.04 LTS vm을 생성한 뒤, 설정 - 네트워크로 이동합니다.

    다음에 연결됨의 속성을 브리지 어댑터로 변경하고 무작위 모드의 속성을 가상 머신에 허용으로 바꿉니다.

     

    확인을 누른 후, 해당 vm 을 실행합니다.

     

    아래와 같은 명령어를 쳐서 interfaces를 텍스트 편집기로 실행합니다.

    1
    $ sudo vi /etc/network/interfaces 
    cs

     

    정상적으로 열렸을 시, 아래와 같이 보입니다.

    # This file describes the network interfaces available on your system

    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface

    auto lo

    iface lo inet loopback

    # The primary network interface

    auto eth0

    iface eth0 inet dhcp

     

    이 내용들을 다음과 같이 수정 및 추가해줍니다.

    # This file describes the network interfaces available on your system

    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface

    auto lo

    iface lo inet loopback

    # The primary network interface

    auto eth0

    iface eth0 inet static

    address 10.101.30.124

    gateway 10.101.30.1

    netmask 255.255.255.0


    address는 해당 vm에서 사용할 ip입니다.

    gateway는 address 대역대에서 (x.x.x.1)을 gateway로 지정합니다. 

    netmask는 255.255.255.0으로 설정합니다.

    저장을 한 다음, 아래의 명령어를 실행시키면 다음과 같이 보입니다.

    $ sudo vi /etc/resolv.conf

    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

     

    여기에 nameserver를 추가시킵니다.

    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN4

    nameserver 164.124.101.2

     

    고정 IP를 사용하는 것이 아닌 유동 IP를 사용할 때 nameserver는 보통 168.126.63.1을 적으면 사용 가능합니다.


    다음 vm을 재부팅 시키면 ip가 변경된 것을 확인할 수 있습니다.


    여기서 vm의 ip를 변경하고 아웃바운드가 가능하게 하려면 로컬에서 cmd를 실행시켜 잡혀있는 서브넷마스크, 게이트웨이, 동일한 대역대의 ip로 설정해야 합니다.

     

     



    댓글