Wednesday, March 15, 2006

Ubuntu dhcp

기존의 고정 IP에서 유동 IP로 변경됨에 따라 dhcp client 설정 필요하게 되었다.

그러나 KT의 경우는 그것이 쉽지 않은데.....
처음엔 단순하게 생각하고 /etc/network/interfaces 파일만을 수정해 두었다.

기존의 /etc/network/interfaces
auto lo
iface lo inet loopback

mapping hotplug
script grep
map eth0

iface eth0 inet staticaddress 192.168.1.110
netmask 255.255.255.0

iface eth1 inet staticaddress 192.168.0.1
netmask 255.255.255.0

변경한 /etc/network/interfaces

auto lo
iface lo inet loopback

mapping hotplug
script grep
map eth0

iface eth0 inet dhcp

iface eth1 inet staticaddress 192.168.0.1
netmask 255.255.255.0

auto eth1
auto eth0

이렇게 하고 장비를 옮겨서 재부팅하면 바로 사용가능하리라 판단하였다.

그러나

부팅 후 네트웍이 살지않아 ifconfig 명령을 해보니

network interface는 살아있으니 eth0에 ip address가 인가되어 있지 않다.
/etc/init.d/dhclient start 명령을 직접 주어보니
네트웍 주소를 받아오지 못한다.

몇번의 삽질 끝에 파악하기로는
아마도 KT에서 network card의 MAC address를 탐지하여
기존에 인가된 주소와 일치할 경우에만 주소를 주는 것으로 판단된다.
/etc/dhcp3/dhclient.conf파일을 일단 살펴보았다.

그래서 아래와 같이 /etc/dhcp3/dhclient.conf를 수정하였다.

#send host-name "andare.fugue.com";
send dhcp-client-identifier 1:0:01:80:22:26:79;
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope;
#require subnet-mask, domain-name-servers;
#timeout 60;
#retry 60;
#reboot 10;
#select-timeout 5;
#initial-interval 2;
#script "/etc/dhcp3/dhclient-script";
#media "-link0 -link1 -link2", "link0 link1";
#reject 192.33.137.209;

timeout 60;
retry 60;
reboot 10;
select-timeout 5;
initial-interval 2;

alias {
# interface "eth0";
# fixed-address 192.5.5.213;
# option subnet-mask 255.255.255.255;
}

#lease {
# interface "eth0";
# fixed-address 192.33.137.200;
# medium "link0 link1";
# option host-name "andare.swiftmedia.com";
# option subnet-mask 255.255.255.0;
# option broadcast-address 192.33.137.255;
# option routers 192.33.137.250;
# option domain-name-servers 127.0.0.1;
# renew 2 2000/1/12 00:00:01;
# rebind 2 2000/1/12 00:00:01;
# expire 2 2000/1/12 00:00:01;
#}

그 다음 부팅한 결과 dhcp로 주소를 정상적으로 받아오는 것이 확인 되었다.