Slackware 또는 SLAX에서 static IP 설정하기
펭귄컴퓨팅/라이브씨디 / 2009. 10. 30. 13:52
어떤 분이 갑자기 질문하시기도 했고, 후배가 질문한 내용이 우연히 딱 맞아서
찾아봤습니다.
를 참고했습니다.
BackTrack 3 버전에서도 마찬가지입니다.
Slackware나 SLAX에는 레드햇 또는 페도라 리눅스에서 네트워크 카드의 IP 정보를 설정하는 ifcfg-eth0 와 같은 파일들이 존재하지 않습니다.
모든 리눅스는 부팅스크립트에 의해서, 모든 설정이 이루어지는데,
레드햇이나 페도라는 별도의 설정파일을 읽어서 네트워크 설정을 합니다만,
Slackware나 SLAX는 그런 설정파일이 별도로 없습니다.
결국, 네트워크 설정 스크립트에서 그냥 설정해서 써야합니다.
/etc/rc.d/rc.inet1 파일을 수정하면 됩니다.
HOSTNAME=`cat /etc/HOSTNAME`
# Attach the loopback device.
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
# IF YOU HAVE AN ETHERNET CONNECTION, use these lines below to configure the
# eth0 interface.
# Edit these values to set up a static IP address:
IPADDR="192.100.168.64" # REPLACE with YOUR IP address!
NETMASK="255.255.255.0" # REPLACE with YOUR netmask!
GATEWAY="192.100.168.254" # REPLACE with YOUR gateway address!
NETWORK="192.100.168.0" # REPLACE with YOUR network address!
BROADCAST="192.100.168.255" # REPLACE with YOUR broadcast address, if you
# have one. If not, leave blank and edit below.
#GATEWAY="" # REPLACE with YOUR gateway address!
# To use DHCP instead of a static IP, set this value to "yes":
DHCP="no" # Use DHCP ("yes" or "no")
# OK, time to set up the interface:
#if [ "$DHCP" = "yes" ]; then # use DHCP to set everything up:
#echo "Attempting to configure eth0 by contacting a DHCP server..."
#/sbin/dhcpcd
#elif [ ! "$IPADDR" = "127.0.0.1" ]; then # set up IP statically:
# Set up the ethernet card:
echo "Configuring eth0 as ${IPADDR}..."
/sbin/ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
/sbin/route add default gw 192.100.168.254
# If that didn't succeed, give the system administrator some hints:
#if [ ! $? = 0 ]; then
#cat
#
# Attach the loopback device.
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
# IF YOU HAVE AN ETHERNET CONNECTION, use these lines below to configure the
# eth0 interface.
# Edit these values to set up a static IP address:
IPADDR="192.100.168.64" # REPLACE with YOUR IP address!
NETMASK="255.255.255.0" # REPLACE with YOUR netmask!
GATEWAY="192.100.168.254" # REPLACE with YOUR gateway address!
NETWORK="192.100.168.0" # REPLACE with YOUR network address!
BROADCAST="192.100.168.255" # REPLACE with YOUR broadcast address, if you
# have one. If not, leave blank and edit below.
#GATEWAY="" # REPLACE with YOUR gateway address!
# To use DHCP instead of a static IP, set this value to "yes":
DHCP="no" # Use DHCP ("yes" or "no")
# OK, time to set up the interface:
#if [ "$DHCP" = "yes" ]; then # use DHCP to set everything up:
#echo "Attempting to configure eth0 by contacting a DHCP server..."
#/sbin/dhcpcd
#elif [ ! "$IPADDR" = "127.0.0.1" ]; then # set up IP statically:
# Set up the ethernet card:
echo "Configuring eth0 as ${IPADDR}..."
/sbin/ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
/sbin/route add default gw 192.100.168.254
# If that didn't succeed, give the system administrator some hints:
#if [ ! $? = 0 ]; then
#cat
#
내용은 위와 같이, 바꾸시면 됩니다.
그리고,
/etc/resolv.conf 파일에서
nameserver xxx.xxx.xxx.xxx
라고, 도메인 서버의 IP 주소를 써주면 됩니다.