dhcp 스크립트에서 호스트 이름을 불러 오지 않게 하려면..
다음은 /etc/sysconfig/network-scripts/ifup 의 스크립트입니다.
이 스크립트에 어디를 고쳐 줘야
DHCP 서버로 부터 자동으로 할당되는 호스트이름을 불러 오지 않을까요?
제가 스크립트는 아직 못 해운지라..
스트립트 올립니다.. 살펴 주십시오..
-----------------------------
[root@8804316 ~]# cat /etc/sysconfig/network-scripts/ifup
#!/bin/bash
# Network Interface Configuration System
# Copyright (c) 1996-2001 Red Hat, Inc. all rights reserved.
#
# This software may be freely redistributed under the terms of the GNU
# public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
. /etc/init.d/functions
cd /etc/sysconfig/network-scripts
. network-functions
[ -f ../network ] && . ../network
CONFIG=${1}
[ -z "${CONFIG}" ] && {
    echo $"Usage: ifup <device name>" >&2
    exit 1
}
need_config ${CONFIG}
[ -f "${CONFIG}" ] || {
    echo $"$0: configuration for ${1} not found." >&2
    echo $"Usage: ifup <device name>" >&2
    exit 1
}
if [ ${UID} != 0 ]; then
    if [ -x /usr/sbin/usernetctl ]; then
        source_config
        if /usr/sbin/usernetctl ${CONFIG} report ; then
            exec /usr/sbin/usernetctl ${CONFIG} up
        fi
    fi
    echo $"Users cannot control this device." >&2
    exit 1
fi
source_config
if [ "foo$2" = "fooboot" ] && [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ]
then
    exit 0
fi
if [ -n "$IN_HOTPLUG" ] && [ "${HOTPLUG}" = "no" -o "${HOTPLUG}" = "NO" ]
then
    exit 0
fi
if [ -n "$IN_HOTPLUG" -a "${TYPE}" = "Bridge" ];
then
    exit 0
fi
# Ethernet 802.1Q VLAN support
if [ -x /sbin/vconfig -a "${VLAN}" = "yes" ]; then
    VID=""
    if echo ${DEVICE} | LANG=C egrep -v '(:)' | LANG=C egrep -q '(eth|bond)[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?'; then
        VID="`echo ${DEVICE} | \
            LANG=C egrep '(eth|bond)[0-9]+\.[0-9][0-9]?[0-9]?[0-9]?$' | \
            LANG=C sed 's/^[a-z0-9]*\.//g;s/^0*//'`"
        PHYSDEV="`echo ${DEVICE} | \
            LANG=C egrep '(eth|bond)[0-9]+\.[0-9][0-9]?[0-9]?[0-9]?$' | \
            LANG=C sed 's/\.[a-z0-9]*$//g'`"
     fi
     if echo ${DEVICE} | LANG=C egrep -q 'vlan[0-9][0-9]?[0-9]?[0-9]?'; then
        VID="`echo ${DEVICE} | LANG=C sed 's/^vlan//;s/^0*//'`"
        # PHYSDEV should be set in ifcfg-vlan* file
        if test -z "$PHYSDEV"; then
                echo $"PHYSDEV should be set for device ${DEVICE}"
                exit 1
        fi
     fi
     if [ -n "$VID" ]; then
        if [ ! -d /proc/net/vlan ]; then
            if modprobe 8021q >/dev/null 2>&1 ; then
                test -z "$VLAN_NAME_TYPE" && VLAN_NAME_TYPE=DEV_PLUS_VID_NO_PAD
                /sbin/vconfig set_name_type "$VLAN_NAME_TYPE" >/dev/null 2>&1 || {
                    echo $"Could not set 802.1Q VLAN parameters."
                }
            else
                echo $"No 802.1Q VLAN support available in kernel for device ${DEVICE}"
                exit 1
            fi
        fi
        is_available ${PHYSDEV} || {
            if [ "$?" = "1" ] ; then
                echo $"$alias device ${DEVICE} does not seem to be present, delaying initialization."
                exit 1
            else
                exit 0
            fi
        }
        # Link on Physical device needs to be up but no ip required
        check_device_down ${PHYSDEV} && {
            ip -o link set dev ${PHYSDEV} up
        }
        if [ ! -f /proc/net/vlan/${DEVICE} ]; then
            /sbin/vconfig add ${PHYSDEV} ${VID} || {
                (logger -p daemon.info -t ifup \
                    $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}" &)&
                echo $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}"
                exit 1
            }
        fi
        if [ -f /proc/net/vlan/${DEVICE} ]; then
            case "$REORDER_HDR" in
                yes|1)
                    /sbin/vconfig set_flag ${DEVICE} 1 1 || {
                        (logger -p daemon.info -t ifup \
                            "WARNING: vconfig not able to enable REORDER_HDR on ${DEVICE}" &)&
                    }
                    ;;
                no|0)
                    /sbin/vconfig set_flag ${DEVICE} 1 0 || {
                        (logger -p daemon.info -t ifup \
                            $"WARNING: vconfig not able to disable REORDER_HDR on ${DEVICE}" &)&
                    }
                    ;;
            esac
        fi
    fi
fi
# Old BOOTP variable
if [ "${BOOTP}" = "yes" ]; then
    BOOTPROTO=bootp
fi
if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then
    DYNCONFIG=true
fi
if [ -x /sbin/ifup-pre-local ]; then
    /sbin/ifup-pre-local ${CONFIG} $2
fi
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-${DEVICETYPE}"
if [ ! -x ${OTHERSCRIPT} ]; then
    OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-eth"
fi
exec ${OTHERSCRIPT} ${CONFIG} $2
[root@8804316 ~]#


redhat인가요?ifup 스크립트를 수정하는 하지 않아도,d
redhat인가요?
ifup 스크립트를 수정하는 하지 않아도,
dhcp쪽 설정 부분에
호스트네임을 갱신하지 않게 하는 옵션이 있을텐데요?
[quote="누구게?"]redhat인가요?ifup 스크립트를 수
레드햇 페도라4입니다. 미리 밝혔어야 하는데 죄송하구요..
제가 아마도 설치할 때 DHCP설정 부분에서 받아 오지 말라고 해준것 같고.. 또 X에서 레드햇 네트워크 설정에서 역시 받아 오지 말라고 체크 해줬는데도 그런데요.. . 다시 한번 확인 해 보겠습니다.
파일을 뒤져보기는 귀찮고(^^)네트워크 설정 메뉴를 열어봤습니다.
파일을 뒤져보기는 귀찮고(^^)
네트워크 설정 메뉴를 열어봤습니다.
장치 탭의 eth0를 선택하고 메뉴의 편집 눌러보니
DHCP 설정이란 것이 있고 호스트명(옵션)이라는 네모칸이 보입니다.
현재 빈칸입니다. DNS 자동 얻기에는 체크가 안 되어 있고,
다시 DNS탭을 눌러보니 호스트명이 입력되어 있습니다.
호스트탭에도 127.0.0.1이 위의 호스트명으로 되어 있습니다.
제가 설정한 것이지만 보이는 그대로 적어봤습니다.
FC4 환경이고 물론 호스트명은 제가 설정한 그대로 아무 문제 없고요...
댓글 달기