Перейти к содержанию

ctudent

Members
  • Постов

    2
  • Зарегистрирован

  • Посещение

Сообщения, опубликованные ctudent

  1. Добрый день!
    Прошу помощи/совета в следующем - необходимо изменить mac-адрес ip камеры axis, которая работает на linux.

    В веб-морде есть возможность редактирования конфигов, папки etc/network нет, есть файлы init.d/net.eth0 и init.d/mac

    В скрипте init.d/eth0 вызывается скрипт init.d/mac

    Вот содержимое скрипта init.d/mac

    Пробовал вместо MAC=$MAC написать MAC="нужный мас" но адрес всё равно не поменялся...

    #!/bin/sh
    
    . /etc/init.d/functions.sh
    [ ! -f /etc/conf.d/mac ] || . /etc/conf.d/mac
    
    default_mac=00:40:8C:CD:00:00
    
    begin "Determining MAC address"
    
    if [ "$MAC" ]; then
    	MAC=$(echo $MAC | tr a-f A-F)
    else
    	MAC=$default_mac
    fi
    
    if [ $MAC = $default_mac ]; then
    	serno=
    	! exists bootblocktool || serno=$(bootblocktool -x SERNO || :)
    	if [ -z "$serno" ]; then
    		warning "Cannot determine serial number."
    		information "No serial number, using default MAC address: $MAC"
    		setled -l statusled -c red -d none -i 1 -s LED_STATE_SERNO_ERROR
    	else
    		# Use serial number with colons added.
    		MAC=$(echo $serno | tr a-f A-F |
    			sed -re 's/([0-9A-F]{2})/\1:/g;s/:$//')
    		information "Using serial number as MAC address: $MAC"
    	fi
    
    	# Only write to the config-file if needed.
    	if [ "$MAC" != $default_mac ] || [ ! -f /etc/conf.d/mac ]; then
    		# Write the new address to the config-file.
    		cat <<-EOT >/etc/conf.d/mac
    			# This file was automatically generated by '$0'
    			# to be used by the net-scripts if the conf-file of a
    			# net-script doesn't define MAC.
    			#
    			# Change MAC if you want a MAC address different than
    			# the serial number.
    
    			MAC=$MAC
    		EOT
    		information "MAC address saved: $MAC"
    	fi
    else
    	information "Using saved MAC address: $MAC."
    fi
    
    end $?
    

     

×
×
  • Создать...