HK2000-如何修改数采IP以及网关等
常用操作:
Ctrl+C结束当前程序
Ctrl+BackSpace 强制退格,当输入错误,出现^H时,可使用改快捷键强行退格。
VI操作:
1.打开文件vi 文件名
2.设置编辑模式。按i 表示将当前文本设置成编辑模式,需要修改文件时需要先按i设置当前文本为编辑状态。
3.保存退出操作:按Esc 后按:wq
数采的IP信息存储到/usr/ete/rc.local 文件中,内容如下:
/sbin/ifconfig lo 127.0.0.1 up
/sbin/ifconfig eth0 172.19.190.3 netmask 255.255.255.0 up //IP 掩码
/sbin/route add default gw 172.19.190.1 //网关
如果需要修改IP,网关,掩码可通过修改该文件后,下一次重启数采后,IP信息会自动进行加载。
编辑rc.local命令 vi /usr/etc/rc.local
修改后查看命令 cat /usr/etc/rc.local
附件为/usr/etc/rc.local文件内容
#!/bin/sh
mknod /dev/ram0 b 1 0
rm -rf /var
/bin/mke2fs -vm0 /dev/ram0 4096
mount -t ext2 /dev/ram0 /tmp
cd /tmp
mkdir var
ln -fs /tmp/var /var
cd var
mkdir lock
mkdir log
mkdir run
mkdir spool
mkdir tmp
cd /
# insmod /lib/modules/at91_rtcex.o > /dev/null
# insmod /lib/modules/at91_led.o > /dev/null
# insmod /lib/modules/at91_key.o > /dev/null
# mknod /dev/LED c 251 1
# mknod /dev/keyboard c 252 1
# Setup the Macaddress by random for the first time
MACADDRESS=/usr/etc/Mac.txt
MAC0="00"
if [ -s $MACADDRESS ]; then
MAC1=$(cut -b1-2 $MACADDRESS)
MAC2=$(cut -b3-4 $MACADDRESS)
MAC3=$(cut -b5-6 $MACADDRESS)
MAC4=$(cut -b7-8 $MACADDRESS)
MAC5=$(cut -b9-10 $MACADDRESS)
else
hexdump -e '"%02x"' -n 5 /dev/urandom > $MACADDRESS
MAC1=$(cut -b1-2 $MACADDRESS)
MAC2=$(cut -b3-4 $MACADDRESS)
MAC3=$(cut -b5-6 $MACADDRESS)
MAC4=$(cut -b7-8 $MACADDRESS)
MAC5=$(cut -b9-10 $MACADDRESS)
fi
ifconfig eth0 hw ether $MAC0:$MAC1:$MAC2:$MAC3:$MAC4:$MAC5
/sbin/ifconfig lo 127.0.0.1 up
/sbin/ifconfig eth0 172.19.190.3 netmask 255.255.255.0 up
/sbin/route add default gw 172.19.190.1
mount -t yaffs /dev/mtdblock/4 /mnt/Nand
cd /mnt/Nand/bject
./StartUp.sh
cd /
syslogd
inetd
Ctrl+C结束当前程序
Ctrl+BackSpace 强制退格,当输入错误,出现^H时,可使用改快捷键强行退格。
VI操作:
1.打开文件vi 文件名
2.设置编辑模式。按i 表示将当前文本设置成编辑模式,需要修改文件时需要先按i设置当前文本为编辑状态。
3.保存退出操作:按Esc 后按:wq
数采的IP信息存储到/usr/ete/rc.local 文件中,内容如下:
/sbin/ifconfig lo 127.0.0.1 up
/sbin/ifconfig eth0 172.19.190.3 netmask 255.255.255.0 up //IP 掩码
/sbin/route add default gw 172.19.190.1 //网关
如果需要修改IP,网关,掩码可通过修改该文件后,下一次重启数采后,IP信息会自动进行加载。
编辑rc.local命令 vi /usr/etc/rc.local
修改后查看命令 cat /usr/etc/rc.local
附件为/usr/etc/rc.local文件内容
#!/bin/sh
mknod /dev/ram0 b 1 0
rm -rf /var
/bin/mke2fs -vm0 /dev/ram0 4096
mount -t ext2 /dev/ram0 /tmp
cd /tmp
mkdir var
ln -fs /tmp/var /var
cd var
mkdir lock
mkdir log
mkdir run
mkdir spool
mkdir tmp
cd /
# insmod /lib/modules/at91_rtcex.o > /dev/null
# insmod /lib/modules/at91_led.o > /dev/null
# insmod /lib/modules/at91_key.o > /dev/null
# mknod /dev/LED c 251 1
# mknod /dev/keyboard c 252 1
# Setup the Macaddress by random for the first time
MACADDRESS=/usr/etc/Mac.txt
MAC0="00"
if [ -s $MACADDRESS ]; then
MAC1=$(cut -b1-2 $MACADDRESS)
MAC2=$(cut -b3-4 $MACADDRESS)
MAC3=$(cut -b5-6 $MACADDRESS)
MAC4=$(cut -b7-8 $MACADDRESS)
MAC5=$(cut -b9-10 $MACADDRESS)
else
hexdump -e '"%02x"' -n 5 /dev/urandom > $MACADDRESS
MAC1=$(cut -b1-2 $MACADDRESS)
MAC2=$(cut -b3-4 $MACADDRESS)
MAC3=$(cut -b5-6 $MACADDRESS)
MAC4=$(cut -b7-8 $MACADDRESS)
MAC5=$(cut -b9-10 $MACADDRESS)
fi
ifconfig eth0 hw ether $MAC0:$MAC1:$MAC2:$MAC3:$MAC4:$MAC5
/sbin/ifconfig lo 127.0.0.1 up
/sbin/ifconfig eth0 172.19.190.3 netmask 255.255.255.0 up
/sbin/route add default gw 172.19.190.1
mount -t yaffs /dev/mtdblock/4 /mnt/Nand
cd /mnt/Nand/bject
./StartUp.sh
cd /
syslogd
inetd