文章目录

  • 1.Samba服务器:利用文件传输协议:ftp,http,SMB(Samba)
    • 1.1 隐藏共享和拒绝访问:无法在网上邻居看到我们所共享的文件夹,但是通过unc路径做具体指定,我们可以访问到该文件夹下
    • 1.2 别名:别名配置文件要自己建立
    • 1.3 免登陆名:启用share级别(安全性最低,不需要通过用户名认证)
    • 1.4 linux访问windows共享目录:挂载
  • 2.NFS服务器:linux和linux之间,也可共享给win客户端
    • 2.1 server:改ip和将目录共享
    • 2.2 client-linux:mount
    • 2.3 client-windows:mount
  • 3./etc/ntp.conf:restrict (什么可访问我并可修改我的时间)10.75.92.0 mask 255.255.255.0 nomodify(nomodify不能修改,只能访问同步走)
  • 4.导出log:filenum=$(ls -l | wc -l) ,ls -tr | head -1
  • 5.modprobe:要载入a module,但a module要求系统先载入b module时,直接用insmod挂入通常都会出现错误,modprobe倒是能够知道先载入b module后才载入a module,如此相依性就会满足
  • 6.进入ME刷bios:BIOS是一个程序,驻留在CMOS存储器(重复可擦写),刷写BIOS的过程就是用新版本的BIOS文件通过专门的刷新软件覆盖旧版本的BIOS文件
  • 7.树莓派:是完整个人电脑,功耗非常大(相比于没有soc的单片机),物联网中要性能弱,所以树莓派只用于教学,树莓派4性能更强并有了usb3.0口和千兆网卡,用来做NAS,但做局域网中NAS不需要这么高性能,路由器就行且功耗比树莓派低的多
    • 7.1 系统安装:netstat -antp,arp -a
    • 7.2 花式点亮LED:node red控制

1.Samba服务器:利用文件传输协议:ftp,http,SMB(Samba)

win下更改ip:本地连接右击属性,更改适配器。@market指market组。

如下第一行看本地源是否正常,第二行安装samba。

如下start启动samba。

如下设置开机自启动。


往一个目录中写数据,光有samba权限是不够的,还要结合本地权限来看,如下如果不能完成写入操作,可能不是配置错了,可能和系统本地权限冲突,所以为了使本地权限不受影响,如下第一行就授予本地所有目录完全权限。gpasswd是将用户加入组中。

如下将本地用户转变为samba用户即共享用户。通过如下转变可实现该用户通过客户端访问服务器时提供验证标准了。


如下都是在文件末尾新添加的内容,都是逗号,writeable=no指除了下行外都不能写。[manager]是共享名即对方能看到的网络文件夹名称,comment是可共享目录的描述信息(可加可不加),valid_users指谁可以访问。

如上保存后,如下重启,status查看出running。

如下用管理员账号登录修改任何目录没问题,其他用户登录只能进去或修改自己的文件夹。



1.1 隐藏共享和拒绝访问:无法在网上邻居看到我们所共享的文件夹,但是通过unc路径做具体指定,我们可以访问到该文件夹下

windows里只需在共享文件夹名后面加一个$符号就能实现隐藏共享了。linux的samba中需修改主配置文件。如下将manager目录做一个隐藏。


如下可将win下更改设配器将ip改变,就可访问了。

1.2 别名:别名配置文件要自己建立




1.3 免登陆名:启用share级别(安全性最低,不需要通过用户名认证)


如下guest这行可换成public=yes一样效果。

1.4 linux访问windows共享目录:挂载

如下右击share文件夹属性。

如下点击应用后点击确定。




如上操作后share文件夹就有读写权限了。如下设置win账号,因为默认禁止空密码登录。



如上准备好了文件夹和账户,如下cd /mnt ; mkdir win7,mount通过网络挂载需要加参数,linux挂载后再用mount指令看下。

2.NFS服务器:linux和linux之间,也可共享给win客户端

2.1 server:改ip和将目录共享




如下再ip address看下ip是不是192.168.0.1。



如下192.168.0.*也可以。




如下改完也要restart重启服务。

2.2 client-linux:mount


如下虽说给了nfs完全读写权限,但任何读写还受本身文件系统影响(win下有一个安全选项卡调节权限)。

2.3 client-windows:mount

控制面板-程序-打开或关闭windows功能。

3./etc/ntp.conf:restrict (什么可访问我并可修改我的时间)10.75.92.0 mask 255.255.255.0 nomodify(nomodify不能修改,只能访问同步走)


:%d删除文件整个内容。

如下没有加服务端地址。

如下的服务端地址不能同步。ntp.conf修改后10分钟后才同步,主机器没同步外网,子机器(slaver)不能同步主机器(master)。


ntp服务启动了就不能使用ntpdate。

4.导出log:filenum=$(ls -l | wc -l) ,ls -tr | head -1

# auto_dump.sh
#!/bin/bash
work_path=$(pwd)
conf_file_path="${work_path}/auto_dump.cfg"
dst_dir_path=""
search_path="/var/log"if [ $# -ne 1 ];thenprogram=$(basename "$0")echo "Usage: $program <dst_dir_path>"echo "Examples:$program /root/os_log/"exit
elsedst_dir_path=$1
ficat $conf_file_path | while read conf_path_line
dolast_file_path=$(basename ${conf_path_line})#last_file_path=${conf_path_line##*/}tmp=${conf_path_line%/*}last_dir_path=${tmp##*/}  # network find $search_path -name $last_file_path | while read search_path_linedomkdir -p $dst_dir_pathdst_file_path=$dst_dir_path/tmp/$last_dir_path/mkdir -p $dst_file_pathcp $search_path_line $dst_file_pathdonecd $dst_dir_path/tmp/if [ ! -f $conf_path_line ];thenecho $conf_path_line" not found"fi
done
// auto_dump.cfg
network/ip.log
network/netstate.log
network/route.log
network/arp.log
network/services.log
hardware/dmidecode.log
hardware/cmdline.log
hardware/cpuinfo.log
hardware/meminfo.log
hardware/lsblk.log
hardware/mount.log
hardware/interrupts.log
hardware/lspci.log
hardware/smartctl.log
hardware/modules.log
hardware/version.log
message/alert.log
message/audit.log
message/btmp.log
message/crit.log
message/debug.log
message/dmesg.log
message/err.log
message/info.log
message/messages.log
message/notice.log
message/syslog.log
message/warning.log
message/wtmp.log
if [ -f $dst_dir_path/log.9.tar.gz ];thenrm $dst_dir_path/log.1.tar.gzfor((j=2;j<=$(($dst_dir_path_file_num-1));j++))domv $dst_dir_path/log.$j.tar.gz $dst_dir_path/log.$(($j-1)).tar.gzdonemv $dst_dir_path/log.tar.gz $dst_dir_path/log.9.tar.gz
fiif [ -f $dst_dir_path/log.tar.gz ] && [ ! -f $dst_dir_path/log.9.tar.gz ];thenfor((i=1;i<=$(($dst_dir_path_file_num-1));i++))do    if [ -f $dst_dir_path/log.$i.tar.gz ];thencontinuefimv $dst_dir_path/log.tar.gz $dst_dir_path/log.$i.tar.gzbreakdone
fii=0
filenum=0
for i in $(ls)
doif [ -f $i ]thenlet filenum+=1fiif [ $filenum==10 ];thenrm `ls -tr $(find . -type f -name "log_*") | head -1`breakfi
doneif [ -f $dst_dir_path/log.tar ];thenmv $dst_dir_path/log.tar $dst_dir_path/log_$(date "+%Y-%m-%d_%H:%M:%S")_bak.tar
fi

5.modprobe:要载入a module,但a module要求系统先载入b module时,直接用insmod挂入通常都会出现错误,modprobe倒是能够知道先载入b module后才载入a module,如此相依性就会满足

insmod cpld_hq.ko(ko是kernel module,lsmod cpld_hq,rmmod cpld_hq)生成如下文件夹,sys_cpld在cpld_hq.c里命名,前面路径在内核指定。

# setup.py
#! /usr/bin/python# /sys/bus/i2c/devices/i2c-0/0-0056/eeprom
# driver: 24lc64t。    addr:0x50。   bus:/sys/bus/i2c/devices/i2c-%d。
# bus_number:15。   devdir:0-0056import os, sys, subprocess, stringdef new_device(driver, addr, bus, devdir):if not os.path.exists(os.path.join(bus, devdir)):try:with open("%s/new_device" % bus, "w") as f:f.write("%s 0x%x\n" % (driver, addr))except Exception, e:print "Unexpected error initialize device %s:0x%x:%s: %s" % (driver, addr, bus, e)else:print("Device %s:%x:%s already exists." % (driver, addr, bus))def new_i2c_device(driver, addr, bus_number):bus = '/sys/bus/i2c/devices/i2c-%d' % bus_numberdevdir = "%d-%4.4x" % (bus_number, addr)  # 4.4 = 0.4 = .4  取四位,前面不够补0return new_device(driver, addr, bus, devdir)def baseconfig():print("Initialize EEPROM driver")# tlv eeprom devicenew_i2c_device('24lc64t', 0x56, 0)# Baseboard eeprom devicenew_i2c_device('24lc64t', 0x50, 15)# BMC eeprom devicenew_i2c_device('24lc64t', 0x51, 15)# switchboard eeprom devicenew_i2c_device('24lc64t', 0x52, 15)# SFP+/QSFPDD eepromfor y in range(32):new_i2c_device('optoe1',0x50,37+y)def main():baseconfig()if __name__ == "__main__":sys.exit(main())
# check_port_tx_rx_setup.sh
#!/bin/bash
if [ $# != 1 ] ; thenecho "Please input the retry number"echo "Usage:./check_port_tx_rx_setup.sh 'retry number'"exit 1;
ficd /home/test/Desktop/port_nrz_test/fpga_prog
echo "Checking the Port link status...."
./linkstatus.sh | grep "link is failed" | awk -F ' ' '{print $4}' > tmp
mkdir -p /home/test/Desktop/port_nrz_test/log/link_log
if test -s tmp;thenfor((i=1;i<=$1;i++));do./linkstatus.sh | grep "link is failed" | awk -F ' ' '{print $4}' > tmpcat tmp | while read linedocd /home/test/Desktop/0915/ali_fpga/software/user/cli/devmemecho "Retry to setup the port $line"case $line in1)./0_All_100G_NRZ_RX_ADAPT.sh > /home/test/Desktop/port_nrz_test/log/link_log/0_All_100G_NRZ_RX_ADAPT.log;;2)./1_All_100G_NRZ_RX_ADAPT.sh > /home/test/Desktop/port_nrz_test/log/link_log/1_All_100G_NRZ_RX_ADAPT.log ;;esacdonedone
elseecho "test ok"
fi

i2cset -f -y 0 0x0d 0x40 0x40,写文件SYSCPLD_SYSFS_DIR=“/sys/bus/i2c/devices/0-000d”

6.进入ME刷bios:BIOS是一个程序,驻留在CMOS存储器(重复可擦写),刷写BIOS的过程就是用新版本的BIOS文件通过专门的刷新软件覆盖旧版本的BIOS文件

# BMC_BIOS_change.py# $interface = "1.0"
import time
import sys
import os
import SecureCRTdef boot_os():crt.Screen.WaitForString("localhost login:")crt.Screen.Send("admin" +chr(13))time.sleep (1)crt.Screen.WaitForString("Password: ")crt.Screen.Send("admin" +chr(13))time.sleep (1)crt.Screen.WaitForString("admin@localhost:~$")crt.Screen.Send("sudo su" +chr(13))time.sleep (1)crt.Screen.WaitForString("root@localhost:/home/admin# ")crt.Screen.Send("dmidecode -t 0" +chr(13))  # 查看BIOS信息time.sleep (1)def Checkinfo1():crt.Screen.WaitForString("root@localhost:/home/admin#",1)crt.Screen.Send("lspci |grep -i eth" +chr(13))time.sleep (1)crt.Screen.WaitForString("root@localhost:/home/admin#",1)crt.Screen.Send("lspci |grep -i 07:00.0" +chr(13))time.sleep (2)crt.Screen.WaitForString("root@localhost:/home/admin#")crt.Screen.Send("lsblk |grep -i sda" +chr(13))time.sleep (2)#############切换到BMC下###############crt.Screen.WaitForString("root@localhost:/home/admin#")crt.Screen.Send("\025"+"\022"+"\024"+"1 \r")crt.Screen.SendSpecial("VT_KEYPAD_ENTER")time.sleep (5)# crt.Screen.WaitForString("bmc-oob. login:")# crt.Screen.Send("root" +chr(13))# crt.Screen.WaitForString("Password:")# crt.Screen.Send("0penBmc" +chr(13))crt.Screen.WaitForString("root@bmc-oob:~#")crt.Screen.Send("boot_info.sh all" +chr(13))time.sleep (2)crt.Screen.Send("boot_info.sh reset bios master" +chr(13))crt.Screen.WaitForString("root@bmc-oob:~#")time.sleep (90)#############切换到Sonic下###############crt.Screen.WaitForString("root@bmc-oob:~#")crt.Screen.Send("\025"+"\022"+"\024"+"0 \r")crt.Screen.SendSpecial("VT_KEYPAD_ENTER")time.sleep (1)def Checkinfo2():crt.Screen.WaitForString("root@localhost:/home/admin#",1)crt.Screen.Send("lspci |grep -i eth" +chr(13))time.sleep (1)crt.Screen.WaitForString("root@localhost:/home/admin#",1)crt.Screen.Send("lspci |grep -i 07:00.0" +chr(13))time.sleep (2)crt.Screen.WaitForString("root@localhost:/home/admin#")crt.Screen.Send("lsblk |grep -i sda" +chr(13))time.sleep (2)#############切换到BMC下###############crt.Screen.WaitForString("root@localhost:/home/admin#")crt.Screen.Send("\025"+"\022"+"\024"+"1 \r")crt.Screen.SendSpecial("VT_KEYPAD_ENTER")time.sleep (1)crt.Screen.WaitForString("root@bmc-oob:~#")crt.Screen.Send("boot_info.sh all" +chr(13))time.sleep (2)crt.Screen.Send("boot_info.sh reset bios slave" +chr(13))crt.Screen.WaitForString("root@bmc-oob:~#")time.sleep (90)#############切换到Sonic下###############crt.Screen.WaitForString("root@bmc-oob:~#")crt.Screen.Send("\025"+"\022"+"\024"+"0 \r")crt.Screen.SendSpecial("VT_KEYPAD_ENTER")time.sleep (1)def Checkinfo3():crt.Screen.WaitForString("root@localhost:/home/admin#",1)crt.Screen.Send("lspci |grep -i eth" +chr(13))time.sleep (1)crt.Screen.WaitForString("root@localhost:/home/admin#",1)crt.Screen.Send("lspci |grep -i 07:00.0" +chr(13))time.sleep (2)crt.Screen.WaitForString("root@localhost:/home/admin#")crt.Screen.Send("lsblk |grep -i sda" +chr(13))time.sleep (2)#############切换到BMC下###############crt.Screen.WaitForString("root@localhost:/home/admin#")crt.Screen.Send("\025"+"\022"+"\024"+"1 \r")crt.Screen.SendSpecial("VT_KEYPAD_ENTER")time.sleep (1)crt.Screen.WaitForString("bmc-oob. login:")crt.Screen.Send("root" +chr(13))crt.Screen.WaitForString("Password:")crt.Screen.Send("0penBmc" +chr(13))crt.Screen.WaitForString("root@bmc-oob:~#")crt.Screen.Send("/var/log/./util.sh" +chr(13))  #####################time.sleep (2)def Main():crt.Screen.Synchronous = Truefor i in range (0,200):boot_os()time.sleep (2)Checkinfo1()boot_os()Checkinfo2()Checkinfo3()time.sleep (2)
Main()
# util.sh
#!/bin/sh
i=1
while(( $i<=3 ))
doipmitool -b 1 -t 0x2c raw 0x2e 0xdf 0x57 0x01 0x00 0x01  #进入ME恢复模式ret=$(/usr/bin/ipmitool -b 1 -t 0x2c raw 6 1 | awk -F " " '{print $15}') #查询ME状态if [ "$ret" = "00" ]; thenlogger -p user.info "Enter ME recovery mode successfully"spi_util.sh  write BIOS1 imagebreakfiif [ "$ret" != "00" ]; thenlogger -p user.info "Three times to enter ME recovery mode failed"continuefi
donei=1
while(( $i<=3 ))
doipmitool -b 1 -t 0x2c raw 6 2 #退出ME    ret=$(/usr/bin/ipmitool -b 1 -t 0x2c raw 6 1 | awk -F " " '{print $15}') #查询ME状态if [ "$ret" != "00" ]; thenlogger -p user.info "Exit ME recovery mode successfully"breakfiif [ "$ret" = "00" ]; thenlogger -p user.info "Three times to exit ME recovery mode failed"continuefi
done
exit

7.树莓派:是完整个人电脑,功耗非常大(相比于没有soc的单片机),物联网中要性能弱,所以树莓派只用于教学,树莓派4性能更强并有了usb3.0口和千兆网卡,用来做NAS,但做局域网中NAS不需要这么高性能,路由器就行且功耗比树莓派低的多

7.1 系统安装:netstat -antp,arp -a

1.内存卡插入读卡器再插入电脑的usb接口,将u盘格式化为FAT32格式。如果右击格式化没有FAT32,用格式化fat32工具:http://www.ridgecrop.demon.co.uk/guiformat.exe。树莓派系统官网:https://www.raspberrypi.org/downloads/raspbian/。下载完系统(1.9G),用写盘工具(https://www.balena.io/etcher/或win32diskimager)将系统写入u盘,写完后不要格式化其他盘。

2.树莓派插上内存卡,接上网线或连上wifi(连wifi,eth0信息为空,因为没有连接网线,wlan0显示内网ip)用ifconfig查看网络。service ssh start开启ssh服务,树莓派默认用户名pi,密码raspberry,sudo netstat -antp可查看到当前有22端口即ssh端口被监听,这时可关闭显示器。

3.用自己电脑上的putty/xshell/securecrt新建一个ssh连接,pi@树莓派内网ip,可登录树莓派。如果忘了树莓派内网ip,可用win下cmd中输入arp -a查看局域网下所有ip和mac对应。

4.树莓派网线和要访问的机器网线插在同一个小型交换机上(如果是网口需要先连自己电脑浏览器认证网口)并且树莓派的串口连接机器,本电脑就可以连接树莓派再通过picocom -b 115200 /dev/ttyUSB0连接到机器。如果没有树莓派,本电脑插上机器的串口线(一端USB口,一端网口)后在设备管理器里看到COM号右击添加驱动,下载并安装驱动。serial,comx,115200。

5.如下打开树莓派自带的图像化界面。



win端需安装vnc viewer。

6.如下点击树莓派自带的node red启动。

7.2 花式点亮LED:node red控制



1.如下左边拖进一个gpio和两个inject。inject中选择数字1和0。

如下gpio中选择GPIO04-7管脚。点击右边部署按钮。

2.如下设置闪烁效果,0这个inject也要如下设置。

3.如下通过http接口实现小灯的亮灭。

如下action为on的话赋值为0。

如下点亮小灯,将on改为off,灯熄灭。

【Notes7】Samba/NFS服务器,Ntp,导出log,modprobe,进入ME刷bios,树莓派相关推荐

  1. RHEL6.4上Samba/NFS服务器简单配置

    近期在RHEL6.4上尝试搭建一个NAS,底层使用XFS文件系统,对外主要提供samba协议和NFS协议共享,这里把主要步骤记录下来. 环境:RHEL6.4,IP:192.168.50.117 1.关 ...

  2. linux中查看nfs日志,nfs服务器与日志服务器

    anacron  与cron配合使用  防止计划任务为执行 /etc/cron.deny 中的用户将不能编辑计划任务,不在其中的可以编辑自己的计划任务 /etc/cron.allow 中的用户可以编辑 ...

  3. 如何在Ubuntu 18.04上安装和配置NFS服务器

    网络文件系统(NFS)是一种分布式文件系统协议,使您可以通过网络共享远程目录.使用NFS,您可以在系统上挂载远程目录,并像对待本地文件一样使用远程计算机上的文件. NFS协议默认情况下未加密,并且与S ...

  4. CentOS 8.2上安装部署NFS服务器和客户端

    文章目录 第一步:NFS系统简单概述 第二步:先决条件 第三步:测试环境 第四步:CentOS 8上安装NFS服务器 第五步:客户端系统上设置NFS客户端 广告时间: 第一步:NFS系统简单概述 网络 ...

  5. nfs服务器实现文件共享,NFS服务器及Samba服务配置实现文件共享(示例代码)

    NFS服务器运行原理 实战配置NFS服务器 配置Samba服务器及实现文件共享 (一)NFS器服务端描述 NFS服务器: Network File System,网络文件系统使FreeBSD支持的一种 ...

  6. Linux就该这么学--Samba NFS的配置

    SAMBA文件共享服务 Samba服务程序现在已经成为在Linux系统与Windows系统之间共享文件的选择 1.安装ansible [root@myserver ~]# yum install -y ...

  7. 鸟哥的Linux私房菜(服务器)- 第十三章、文件服务器之一:NFS 服务器

    第十三章.文件服务器之一:NFS 服务器 最近更新日期:2011/07/27 NFS为 Network FileSystem 的简称,它的目的就是想让不同的机器.不同的操作系统可以彼此分享个别的档案啦 ...

  8. 基于corosync和NFS服务器实现LNMP的高可用

    一.实验拓扑 二.实验说明 该试验是基于corosync和NfS服务器实现了LNMP的高可用,当一个节点出现故障时,所有的资源会自动转移到另一节点,从而能够正常提供服务 三.实验准备 1.修改两台主机 ...

  9. 文件服务器之一:NFS 服务器

    http://vbird.dic.ksu.edu.tw/linux_server/0330nfs.php 第十三章.文件服务器之一:NFS 服务器 最近更新日期:2011/07/27 NFS为 Net ...

最新文章

  1. 基于深度学习方法的图像分割,差距不止一点点
  2. 【Flask】Jinja2之模板中使用url_for
  3. 看穿机器学习(W-GAN模型)的黑箱
  4. 经典C语言程序100例之二九
  5. CentOS 程序开机自启动方法总结
  6. NOIP2008 普及组T1 ISBN号码 解题报告-S.B.S.
  7. Yii中设置时间分区
  8. 一整个网站的全部数据,我只能给你这么多了。
  9. 8. Andrénalin ★ Serial
  10. layer.js之回调销毁对话框
  11. 为什么有些程序员明明很努力,但是却回报很低,收益很小,工资始终上不去-出自中华石杉老师
  12. java实现树形菜单_Java构建树形菜单的实例代码(支持多级菜单)
  13. 嵌入式岗位Makefile常见面试题(1)
  14. 11张网络安全思维导图,快收藏!
  15. 初学Python,需要装什么软件?
  16. Postman----打开postman console控制台,查看接口测试打印log
  17. 喜欢的歌,老歌居多,呵呵,怀旧,改不了的毛病
  18. 如何执行 Visual Paradigm 的静默安装丨安装教程
  19. java实现mysql拦截_java分页拦截类实现sql自动分页
  20. node.js 安装,详细步骤教程

热门文章

  1. ios开发瀑布流框架的封装
  2. Android屏幕适配全攻略(最权威的官方适配指导)(转),共大家分享。
  3. 使用 XMLBeans 进行编程 XMLBeans 如何引发数据绑定的巨大变革
  4. 汉拓中国CRM评估报告简介
  5. 计算机软件工作总结,计算机软件培训总结及小结-工作总结
  6. 永恒python怎么强化_永恒python加6_pythontip 挑战python (6-10)
  7. java如何调用网页_如何使用网页开发自己的app,在网页中的按钮与自己的java代码绑定来实现打电话即javascript代码调用java代码,和java代码来调用javascript代码...
  8. 联想小新电脑dns服务器未响应,Lenovo Quick Fix 联想智能解决工具
  9. 解决magento保存产品时耗时很长的问题
  10. quartz 表说明