海运的博客

Proxmox下intel i350网卡开启SR-IOV

发布时间:November 11, 2021 // 分类: // No Comments

修改grub添加内核参数:

intel_iommu=on iommu=pt pci=assign-busses

查看支持多少个虚拟网卡:

cat /sys/class/net/enp5s0f1/device/sriov_totalvfs 

开启虚拟数量:

echo 7 > /sys/class/net/enp5s0f0/device/sriov_numvfs

查看网卡名称与pci地址对应:

ls -l /sys/class/net/

列出所有网卡,可见虚拟网卡已识别。
2021-11-11_162738.jpg
创建虚拟机系统选择Q35,后续添加pci网卡时可设置为pcie。
2021-11-11_162518.jpg
CPU类别选择host,可使用AES。
2021-11-11_162547.jpg
创建虚拟机完毕后再添加PCI设备虚拟网卡。
2021-11-11_162641.jpg
LXC虚拟机使用虚拟网卡:

/etc/pve/lxc/100.conf 
lxc.net.1.type: phys
lxc.net.1.link: enp5s0f0v5
lxc.net.1.name: eth1
lxc.net.1.flags: up
lxc.net.1.ipv4.address: 192.168.1.125/24
lxc.net.1.ipv4.gateway: 192.168.1.1

systemd开机设置虚拟网卡数量:

[Unit]
Description=sriov_numvfs
After=network.target
Before=pve-guests.service 

[Service]
ExecStart=/usr/bin/bash -c '/usr/bin/echo 7 > /sys/class/net/enp5s0f0/device/sriov_numvfs'
Type=oneshot

[Install]
WantedBy=multi-user.target

Intel i350网卡开启PXE和WOL

发布时间:November 10, 2021 // 分类: // No Comments

查看网卡信息,发现网卡运行闪存固件的功能被禁用:

tar zxf preboot_26.6.tar.gz 
cd APPS/BootUtil/
chmod +x Linux_x64/bootutil64e 

./Linux_x64/bootutil64e
Port Network Address Location Series  WOL Flash Firmware                Version
==== =============== ======== ======= === ============================= =======
  1   xxx     5:00.0 Gigabit YES FLASH Disabled
  2   xxx     5:00.1 Gigabit N/A FLASH Disabled

查看闪存固件信息,可见固件内包含PXE功能:

 ./Linux_x64/bootutil64e -IMAGEVERSION -nic 1
Flash firmware on port 1
PXE            v1.3.98

启用在端口1上运行闪存固件的功能:

./Linux_x64/bootutil64e -nic=1 -FLASHENABLE

重启系统就可以使用PXE引导了,查看网卡信息:

./Linux_x64/bootutil64e
Port Network Address Location Series  WOL Flash Firmware                Version
==== =============== ======== ======= === ============================= =======
  1   xxx     5:00.0 Gigabit YES PXE                           1.3.98
  2   xxx     5:00.1 Gigabit N/A FLASH Disabled

查看preboot自带BootIMG.FLB固件版本信息:

./Linux_x64/bootutil64e -IMAGEVERSION -FILE BootIMG.FLB 
Image versions in BootIMG.FLB

    Combo Image Version Name 1.3082.0

    Combo Rules                    v4.91.00
    Clp-Loader Option ROM          v3.1.30
    40G Interface Module           v1.0.88
    iSCSI Option ROM               v3.1.80
    iSCSI Setup Option ROM         v3.1.80
    Intel(R) Boot Agent GE         v1.5.89
    Intel(R) Boot Agent XE         v2.4.45
    Intel(R) Boot Agent XE (X550)  v2.4.45
    Intel(R) Boot Agent I40E       v1.1.31
    Intel(R) Boot Agent CL         v0.1.16
    Intel(R) Boot Agent ICE        v2.5.00
    UEFI x64 PCI-E gigabit driver  v9.7.06
    UEFI x64 10 gigabit driver     v8.1.00
    UEFI x64 40 gigabit driver     v4.8.08
    UEFI x64 100 gigabit driver    v3.0.11

更新PXE固件,未经测试。

./Linux_x64/bootutil64e -NIC=1 -up=pxe -FILE=BootIMG.FLB 

开启WOL:

./Linux_x64/bootutil64e -nic 1 -WOLE

参考:
https://www.intel.cn/content/www/cn/zh/support/articles/000005790/software/manageability-products.html
https://maple52046.github.io/posts/enable-pxe-boot-on-intel-nic-under-rhel/

proxmox/debian睡眠网络唤醒后cpu占用很高

发布时间:November 6, 2021 // 分类: // No Comments

占用CPU很高的进程是:

kworker/0:2+kacpid

查找不正常的中断:

grep . -r /sys/firmware/acpi/interrupts/

gpe09非正常中断,禁用暂时解决:

echo "disable" > /sys/firmware/acpi/interrupts/gpe09

恢复到之前备份的bios不再出现此问题。

此内容被密码保护

发布时间:April 4, 2021 // 分类: // No Comments

请输入密码访问

pt torrent种子自动辅种相似度计算

发布时间:March 5, 2021 // 分类:PT // No Comments

torrent解析类使用https://github.com/Rhilip/Bencode,打补丁支持获取种子hash信息。

--- Bencode.php.1       2021-02-24 07:30:41.677067125 +0800
+++ Bencode.php 2021-03-05 17:52:23.803081067 +0800
@@ -26,6 +26,9 @@
  */
 class Bencode
 {
+    public function info_hash($data, $info_hash) {
+      return sha1(substr($data, $info_hash['pos'], $info_hash['length']));
+    }
     /**
      * Decode bencoded data from string
      *
@@ -46,7 +49,15 @@
             $return = [];
             while ($data[$pos] !== 'e') {
                 $key = self::decode($data, $pos);
+                if (!strcmp($key, "info")) {
+                //if ($key === "info") {
+                  $return['info_hash']['pos'] = $pos;
+                }
                 $value = self::decode($data, $pos);
+                if (!strcmp($key, "info")) {
+                //if ($key === "info") {
+                  $return['info_hash']['length'] = ($pos - $return['info_hash']['pos']);
+                }
                 if ($key === null || $value === null) {
                     break;
                 }
@@ -125,6 +136,9 @@
             $return = '';
             $check = -1;
             $list = true;
+            if (isset($data['info_hash'])) {
+              unset($data['info_hash']);
+            }
             foreach ($data as $key => $value) {
                 if ($key !== ++$check) {
                     $list = false;

解析种子torrent所包含的文件名称信息,将名称和文件大小组合排序并计算sha,sha相同则2个种子内容一样可自动辅种。

<?php
require_once './Bencode.php';
require_once './ParseErrorException.php';
$bencode = new Bencode(); 
$str = file_get_contents($filename);
$s = $bencode->decode($str);

if (isset($s['info']["files"])) {
  foreach ($s['info']["files"] as $v) {
    $length = $v["length"];
    $file = end($v["path"]);
    $save[] = $length.$file;
  }
} else {
  $length = $s['info']["length"];
  $file = $s['info']["name"];
  $save[] = $length.$file;
}
if (isset($s["encoding"])) {
  $coding = $s["encoding"];
} else {
  $coding = mb_detect_encoding(implode('', $save), ['UTF-8', 'GB18030', 'GBK', 'GB2312', 'ISO-8859-1']);
  echo 'detect encoding: '.$coding.PHP_EOL;
}
if (!$coding) {
  $coding = 'UTF-8';
}
if ($coding != "UTF-8") {
  foreach ($save as $k => $v) {
    $save[$k] = mb_convert_encoding($v, "UTF-8", $coding);
  }
}
sort($save);
$sha1 = sha1(implode('', $save));
分类
最新文章
最近回复
  • 海运: 不好意思,没有。
  • zongboa: 您好,請問一下有immortalwrt設定guest Wi-Fi的GUI教學嗎?感謝您。
  • 海运: 恩山有很多。
  • swsend: 大佬可以分享一下固件吗,谢谢。
  • Jimmy: 方法一 nghtp3步骤需要改成如下才能编译成功: git clone https://git...
  • 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
  • 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
  • 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...
  • 孤狼: 擦。。。。apcupsd会失联 nut在冲到到100的时候会ONBATT进入关机状态,我想想办...
  • 海运: 网络,找到相应的url编辑重发请求,firefox有此功能,其它未知。
归档