우분투 서버 and 데스크탑 모두 해당되는 사항입니다.
데스크탑의 경우는 GUI 환경이라 간편하게 설정을 할 수 있습니다만, 서버의 경우는 콘솔이나 터미널 상에서 설정을 해야 합니다...

우분투를 설치하게되면 보통 dhcp로 자동으로 ip가 할당이 되게 되어 있습니다.
이것을 수동으로 잡아보도록 하겠습니다.

주의) 아래 네트워크 정보는 사용자 마다 다를 수 있습니다. vmware 환경에서 설정한 사항입니다.

우선 현재 네트워크 사항입니다. (dhcp로 할당된 ip 정보)
장치명 : eth1
ip : 192.168.32.131
netmask : 255.255.255.0
gateway : 192.168.32.2

위의 사항에서 ip 주소만 변경하여 보겠습니다. (고정 ip로 변경)
변경할 ip : 192.168.32.132


1. 현재 네트워크 사항을 확인해 봅니다.
windpyj@ubuntu:~$ ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:0C:29:0F:88:75
          inet addr:192.168.32.131  Bcast:192.168.32.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe0f:8875/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:296 errors:0 dropped:0 overruns:0 frame:0
          TX packets:404 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:32183 (31.4 KiB)  TX bytes:35425 (34.5 KiB)
          Interrupt:185 Base address:0x1400
windpyj@ubuntu:~$


2. ip 변경을 위해 /etc/networking/interfaces 파일을 엽니다.
windpyj@ubuntu:~$ sudo vi /etc/networking/interfaces


# 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 eth1
iface eth1 inet dhcp # 여기 설정에 보시면 eth1 장치를 dhcp로 ip가 할당되게끔 되어 있습니다. 이부분을 변경하면 됩니다.


3. ip 주소를 변경하기위해 다음과 같이 세팅을 하여 봅니다.
# 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 eth1
# iface eth1 inet dhcp # 기존 설정은 주석 처리 하였습니다, 다음 파란색 부분 처럼 세팅하시면 됩니다.
iface eth1 inet static
        address 192.168.32.132
        netmask 255.255.255.0
        network 192.168.32.0
        broadcast 192.168.32.255
        gateway 192.168.32.2


4. 세팅이 완료되었다면 저장하고 데몬을 재시작 하여 줍니다.
windpyj@ubuntu:~$ sudo /etc/init.d/networking restart


5. 데몬이 재시작되면 콘솔에서 접속하신 분들은 상관이 없지만 터미널로 접속하신 분들은 터미널 연결이 끊기게 됩니다. ip 주소를 변경해서 그렇겠죠?
그럼 터미널에서 변경한 ip 주소로 다시 접속하면 됩니다.


6. 재접속 후 ip주소를 확인해 봅니다.
확인해 보면 ip주소가 192.168.32.131 에서 192.168.32.132로 변경된 것을 확인 할 수 있습니다.
windpyj@ubuntu:~$ ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:0C:29:0F:88:75
          inet addr:192.168.32.132  Bcast:192.168.32.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe0f:8875/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1019 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1404 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:108881 (106.3 KiB)  TX bytes:118314 (115.5 KiB)
          Interrupt:185 Base address:0x1400
windpyj@ubuntu:~$

'Web > Ubuntu' 카테고리의 다른 글

우분투(ubuntu) apt-get 사용  (0) 2010.05.06
우분투 네이트온 설치  (0) 2010.05.06
git 설치  (0) 2010.05.06
의존성 알아보기  (0) 2010.05.06
root 패스워드 지정  (0) 2010.05.06
Posted by jazzlife
,