作者存档

grafana与prometheus安装部署

2020-01-16

1、prometheus安装
# 新建用户,下载GO语言的2进制执行软件包
useradd prometheus; passwd prometheus
wget https://github.com/prometheus/prometheus/releases/download/v2.15.2/prometheus-2.15.2.linux-amd64.tar.gz
wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
tar -xvzf prometheus*.tar.gz
tar -xvzf node_exporter*.tar.gz

# 编辑监控本机自启动配置文件
vi /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/home/prometheus/node_exporter/node_exporter

[Install]
WantedBy=multi-user.target

# 设置成为自启动
systemctl enable node_exporter

————————-
# 文件尾部添加node_exporter本机监控模块
vi home/prometheus/prometheus.yml
– job_name: ‘node_exporter’
scrape_interval: 15s
static_configs:
– targets: [‘localhost:9100’]

# 编辑时序DB自启动配置文件
vi /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus Monitoring
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/home/prometheus/prometheus/prometheus \
–config.file /home/prometheus/prometheus/prometheus.yml \
–storage.tsdb.path /home/prometheus/prometheus/ \
–web.console.templates=/home/prometheus/prometheus/consoles \
–web.console.libraries=/home/prometheus/prometheus/console_libraries
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

# 设置成为自启动
systemctl enable prometheus

2、安装Grafana
# 编辑源
vi /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt

# 在线安装
yum install grafana

# 设置成为自启动
systemctl enable grafana-server.service

# 添加数据源
点击Grafana logo打开侧边栏
点击 “Data Sources”
选择 “Add New”
选择 “Prometheus” 作为数据源
设置Prometheus服务的URL (例如本机: http://localhost:9090/)
点击 “Add” 测试连通性并保存数据源

pacman使用技巧

2020-01-09

查询已安装的软件包
pacman -Qs

显示软件包的详尽的信息
pacman -Si

获取已安装软件包所包含文件的列表
pacman -Ql

查询远程库中软件包包含的文件
pacman -Fl

显示软件包的依赖树
pactree

检查一个安装的软件包被那些包依赖
whoneeds

检查一个安装的软件包被那些包依赖
whoneeds
pactree -r

清除未安装软件包的缓存,会保留软件包的当前有效版本
pacman -Sc

清理所有缓存。除非空间不足,否则不应这么做
pacman -Scc

默认会删除近3个版本前的软件包
paccache -r

下载包而不安装它
pacman -Sw

安装一个本地包(不从源里下载)
pacman -U /path/xxx.pkg.tar.xz

同步文件数据库
pacman -Fy
查询包含某个文件的包名
pacman -Fs pacman

将所有软件包按占用空间大小排序
expac -H M ‘%m\t%n’ | sort -h

递归删除孤立软件包
pacman -Rs $(pacman -Qtdq)
如果没有孤立软件包,将显示错误 error: no targets specified. 这个是正常的,因为 pacman -Rns 没有收到任何参数.

删除孤立软件包
pacman -Rns xxx

删除base软件包组以外的所有软件包
pacman -Rs $(comm -23 <(pacman -Qeq|sort) <((for i in $(pacman -Qqg base); do pactree -ul $i; done)|sort -u|cut -d ' ' -f 1))

避免过度清理缓存
vi /etc/pacman.conf的[options]段
CleanMethod = KeepCurrent

备份已安装软件包列表
comm -23 <(pacman -Qeq|sort) pkglist

安装列表中所有软件包
pacman -S $(< pkglist)

要是备份的软件包列表包含非官方软件包(从AUR或其他什么地方下载的),就得使用下面这个吓人的命令了,不然pacman会出错:
pacman -S –needed $(diff <(cat badpkglist|sort) <(diff <(cat badpkglist|sort) <(pacman -Slq|sort)|grep \<|cut -f2 -d' ')|grep \<|cut -f2 -d' ')

要是你的系统遭到了大规模破坏(比如rm -rf什么的),可以通过pacman重新安装所有软件包来挽救。
pacman -Qeq | pacman -S –
pacman -Qdq | pacman -S –asdeps –
如果安装了外来软件包,使用上面的命令会出错。下面的命令先生成所有软件包列表,再用pacman -Qmq剔除外来软件包,即重新安装所有仓库中可以找到的软件包,同时保留依赖安装、手动安装标志:
comm -23 <(pacman -Qeq) <(pacman -Qmq) | pacman -S –
comm -23 <(pacman -Qdq) “$db”

find /bin /etc /lib /sbin /usr \
! -name lost+found \
\( -type d -printf ‘%p/\n’ -o -print \) | sort > “$fs”

comm -23 “$fs” “$db”

要生成不属于任何软件包的文件列表:
pacman-disowned.sh > non-db.txt

递归删除孤立软件包:
pacman -Rs $(pacman -Qtdq)

列出所有不属于base或base-devel的已安装软件包
comm -23 <(pacman -Qeq|sort) <(pacman -Qgq base base-devel|sort)

———————–
回滚
cd /var/cache/pacman/pkg/
pacman -U networkmanager-qt-5.63.0-1-x86_64.pkg.tar.xz

以后不再更新此不稳定的软件组
vi /etc/pacman.conf
IgnoreGroup = networkmanager

添加第三方源
vi /etc/pacman.conf
[archlinuxcn]
Server = https://repo.archlinuxcn.org/$arch
倒入PGP密钥
sudo pacman -Syy && sudo pacman -S archlinuxcn-keyring

————————-
升级时遇到问题: "file exists in filesystem"(conflicting files)!
pacman -Qo 文件的完整路径 检查哪个软件包提供了文件

Signature from "User ” is unknown trust, installation failed
更新已知密钥
pacman-key –refresh-keys
手动升级archlinux-keyring软件包
pacman -Sy archlinux-keyring && pacman -Su

“failed to commit transaction (invalid or corrupted package” 错误
find /var/cache/pacman/pkg/ -iname “*.part” -exec rm {} \;

“error: failed to init transaction (unable to lock database)” 错误
rm /var/lib/pacman/db.lck

升级系统重启后,出现”unable to find root device”错误,无法登陆
如果系统可以启动,运行如下命令可以生产原始内核 linux 的 initramfs:
# mkinitcpio -p linux
如果上面方法不行,请下载最新的安装程序进行启动,执行:
# mount /dev/sdxY /mnt #Your root partition.
# mount /dev/sdxZ /mnt/boot #If you use a separate /boot partition.
# arch-chroot /mnt
# pacman -Syu mkinitcpio systemd-tools linux
重新安装内核(linux 软件包)将会自动运行 mkinitcpio -p linux 重新生成 initramfs 镜像,不需要单独生成。
之后建议执行 exit, umount /mnt/{boot,} 然后 reboot.
Note: 如果无法进入 arch-chroot 或 chroot 环境,但是需要重新安装软件包,可以使用 pacman -r /mnt -Syu foo bar

PowerpillError: aria2c exited with 8
powerpill -Syyu

===========================
https://wiki.archlinux.org/index.php/Pacman
https://wiki.archlinux.org/index.php/Pacman/Tips_and_tricks

CentOS7部署PXE服务器

2019-12-23

1、安装必须的软件包
yum -y install httpd xinetd syslinux tftp-server system-config-kickstart dhcp

2、将LINUX和ESXI的ISO镜像拷贝进/mnt/iso目录
mkdir -p /mnt/iso

3、挂载去apache里展示的目录
mkdir -p /var/www/html/centos75
mkdir -p /var/www/html/esxi67u3a
mkdir -p /var/www/html/clonezilla264
mkdir -p /var/www/html/gparted1005
mkdir -p /var/www/html/ks
mount -o loop /mnt/iso/CentOS-7-x86_64-DVD-1804.iso /var/www/html/centos75
mount -o loop /mnt/iso/VMware-VMvisor-Installer-6.7.0.update03-14320388.x86_64.iso /var/www/html/esxi67u3a
mount -o loop /mnt/iso/clonezilla-live-2.6.4-10-amd64.iso /var/www/html/clonezilla264
mount -o loop /mnt/iso/gparted-live-1.0.0-5-amd64.iso /var/www/html/gparted1005

4、创建PXE启动目录
mkdir /var/lib/tftpboot/pxelinux.cfg
cd /var/lib/tftpboot/pxelinux.cfg
mkdir centos75
mkdir esxi67u3a
mkdir clonezilla264
mkdir gparted1005
mkdir partedmagic2013
cp /usr/share/syslinux/{pxelinux.0,gpxelinux.0} /var/lib/tftpboot/
cp /var/www/html/centos75/isolinux/vesamenu.c32 /var/lib/tftpboot/
cp /var/www/html/centos75/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/centos75/
cp /var/www/html/centos75/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
cp /var/www/html/esxi67u3a/efi/boot/{boot.cfg,bootx64.efi} /var/lib/tftpboot/esxi67u3a/
ln -s /var/www/html/esxi67u3a/efi/boot/bootx64.efi /var/www/html/esxi67u3a/efi/boot/mboot.efi
cp /var/www/html/esxi67u3a/mboot.c32 /var/lib/tftpboot/esxi67u3a/
cp /var/www/html/clonezilla264/live/{vmlinuz,initrd.img} /var/lib/tftpboot/clonezilla264/
cp /var/www/html/gparted1005/live/{vmlinuz,initrd.img} /var/lib/tftpboot/gparted1005/
cp /mnt/iso/pmagic_2013_06_14_i586.iso /var/lib/tftpboot/partedmagic2013
mkdir -p /tmp/iso
mount /mnt/iso/pmagic_2013_06_14_i586.iso /tmp/iso
cp /tmp/iso/boot/syslinux/memdisk /var/lib/tftpboot/partedmagic2013

5、编辑启动文件
vi /var/lib/tftpboot/pxelinux.cfg/default
label 1
menu label ^Install CentOS 7.5mini
menu default
kernel centos75/vmlinuz
append initrd=centos75/initrd.img ks=http://172.16.10.1/ks/centos75.cfg

label 2
menu label ^Install esxi67u3a
kernel esxi67u3a/mboot.c32
append -c esxi67u3a/boot.cfg
ipappend 2

label 3
MENU LABEL Clonezilla Live
kernel clonezilla264/vmlinuz
append initrd=lonezilla264/initrd.img boot=live union=overlay live-config noswap nolocales edd=on nomodeset ocs_live_run=”ocs-live-general” ocs_live_extra_param=”” keyboard-layouts= ocs_live_batch=”no” locales= vga=788 nosplash fetch=http://172.16.10.1/clonezilla264/live/filesystem.squashfs

label 4
menu label Parted Magic
#kernel partedmagic2013/bzImage
#append initrd=partedmagic2013/initrd.img fetch=http://172.16.10.1/partedmagic2013/pmagic/pmodules/PMAGIC_2013_06_14.SQFS
linux partedmagic2013/memdisk
initrd partedmagic2013/pmagic_2013_06_14_i586.iso
append iso

label 5
MENU LABEL GParted Live
kernel gparted1005/vmlinuz
append initrd=gparted1005/initrd.img boot=live config components union=overlay username=user noswap noeject ip= vga=788 fetch=http://172.16.10.1/gparted1005/live/filesystem.squashfs

# 去掉boot.cfg里面的/符号
sed -i ‘s/\///g’ /var/lib/tftpboot/esxi67u3a/boot.cfg

修改vsphere网络安装需要的引导内容
vi /var/lib/tftpboot/esxi67u3a/boot.cfg
prefix=http://172.16.10.1/esxi67u3a
kernelopt=ks=http://172.16.10.1/ks/esxi67u3a.cfg

6、开启tftp
vi /etc/xinetd.d/tftp
将disable = yes 改成 no

7、配置DHCP,使用 HTTP (IPv4) 引导。例如PXE服务器IP为172.16.10.1
cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
vi /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
subnet 172.16.10.0 netmask 255.255.255.0 {
range 172.16.10.100 172.16.60.200;
option domain-name-servers 172.16.10.1;
option domain-name “localhost.local”;
option routers 172.16.10.1;
option broadcast-address 172.16.10.255;
allow booting;
allow bootp;
option client-system-arch code 93 = unsigned integer 16;
class “pxeclients” {
match if substring(option vendor-class-identifier, 0, 9) = “PXEClient”;
next-server 172.16.10.1;
if option client-system-arch = 00:07 or option client-system-arch = 00:09 {
if exists user-class and option user-class = “iPXE” {
# Instruct iPXE to load mboot.efi as secondary bootloader
filename = “mboot.efi”;
} else {
# Load the snponly.efi configuration of iPXE as initial bootloader
filename = “snponly.efi”;
}
} else {
filename “gpxelinux.0″;
}
}

8、配置Kickstart文件
vi /var/www/html/ks/entos75.cfg
#version=DEVEL
# X Window System configuration information
#xconfig –startxonboot
# License agreement
eula –agreed
# System authorization information
auth –enableshadow –passalgo=sha512
# Use CDROM installation media
#cdrom
# Use network installation
url –url=”http://172.16.10.1/centos75&#8243;
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot –enable
ignoredisk –only-use=sda
# Keyboard layouts
keyboard –vckeymap=cn –xlayouts=’cn’
# System language
lang zh_CN.UTF-8

# Network information
network –bootproto=dhcp –device=eth0 –onboot=on –ipv6=auto –no-activate
network –hostname=localhost.localdomain

# Root password
rootpw –iscrypted $6$N5iv1YnS1Y4rEIxd$pjbmVlcFmxX8oz81iF1VG71.g5QFZ2Yo4GPKkFFGjMbJ1
# System services
services –enabled=”chronyd” –disable auditd,cups,atd
# 屏蔽selinux
selinux –disabled
# System timezone
timezone Asia/Shanghai –isUtc
# System bootloader configuration
bootloader –location=mbr –boot-drive=sda
autopart –type=lvm
# Partition clearing information
zerombr
clearpart –all –initlabel
# Disk partitioning information
#part /boot –fstype=”xfs” –size=1024
#part pv.157 –fstype=”lvmpv” –size=999999999 –grow
#volgroup centos –pesize=4096 pv.157
#logvol / –fstype=”xfs” –size=99999999 –name=root –vgname=centos –grow
#logvol swap –fstype=”swap” –size=8064 –name=swap –vgname=centos

%packages
@^minimal
@core
chrony
lrzsz
net-tools
sysstat

%end

%addon com_redhat_kdump –disable –reserve-mb=’auto’

%end

%anaconda
pwpolicy root –minlen=6 –minquality=1 –notstrict –nochanges –notempty
pwpolicy user –minlen=6 –minquality=1 –notstrict –nochanges –emptyok
pwpolicy luks –minlen=6 –minquality=1 –notstrict –nochanges –notempty
%end

—————–
vi /var/www/html/ks/esxi67u3a.cfg
# /etc/vmware/weasel/ks.cfg
# Accept the VMware End User License Agreement 按受VMware协议
vmaccepteula

# Set the root password for DCUI 设置密码sha512加密openssl passwd -1 yourPASSWORD
rootpw –iscrypted $6$N5iv1YnS1Y4rEIxd$pjb1VG71.g5QFZ2Yo4GPKkFFGjMbJ1

# Install on the first local disk available on machine 将ESXi安装在系统中的第一个磁盘上
install –firstdisk –overwritevmfs

# Set the keyboard
keyboard ‘US Default’

# Management Network Setting 配置IP地址
#network –bootproto=static –ip=192.168.0.22 –netmask=255.255.255.0 –gateway=192.168.0.1 –hostname=ESXi01 –nameserver=192.168.0.1 –addvmportgroup=1
network –bootproto=dhcp –device=vmnic0

# reboot the host after installation is completed
reboot

9、设置开机自动启动
systemctl enable {httpd,dhcpd,xinetd}

PS:
https://docs.vmware.com/cn/VMware-vSphere/6.7/com.vmware.esxi.install.doc/GUID-91E32FD0-A33C-4302-9FAB-B52B8A5CEFBC.html#GUID-91E32FD0-A33C-4302-9FAB-B52B8A5CEFBC

CentOS自动打重要安全补丁

2019-11-27

# 安装自动打补丁软件
yum install yum-cron yum-plugin-security

————
CentOS7

vi /etc/yum/yum-cron.conf
# 只适用于风险级别Critical
update_cmd = minimal-security-severity:Critical
# 自动打补丁
apply_updates = yes
# 主机名
system_name = centos7
# 邮件发送源/收件人地址
email_from = root@localhost
email_to = root

systemctl enable yum-cron && systemctl start yum-cron

———–
CentOS6

vi /etc/sysconfig/yum-cron
# 只适用于风险级别Critical
YUM_PARAMETER=”–sec-severity=Critical update-minimal”
# 邮件收件人
MAILTO=root
# 主机名
SYSTEMNAME= centos6

chkconfig yum-cron on && servie yum-cron start

====================
PS:
default 默认的更新,类似yum upgrade
security 安全更新, 类似yum –security upgrade
security-severity:Critical 重要的安全更新,类似yum –sec-severity=Critical upgrade
minimal 最小化更新,类似yum –bugfix update-minimal
minimal-security 最小化安全更新,类似yum –security update-minimal
minimal-security-severity:Critical 最小化重要安全更新,类似yum –sec-severity=Critical update-minimal

arch用Deepin桌面,无线网卡无法连接WIFI问题

2019-11-11

vi /etc/NetworkManager/NetworkManager.conf
[device]
wifi.scan-rand-mac-address=no

特别坑,莫名其妙的powerpill -Syu以后无线网卡就不停的尝试重连WIFI。只能换回有线网卡用,看报错日志,百思不得其解。原来是DEEPIN的BUG。

https://wiki.archlinux.org/index.php/Deepin_Desktop_Environment

备份和还原 vCenter Server Appliance 5.x vPostgres 数据库

2019-11-05

1.去5480端口开启VCENTER的远程ssh连接登陆.(以 root 用户身份登录。默认密码为 vmware)

2.停止 VMware vCenter Server 服务:
service vmware-vpxd stop

3.进入vPostgres 程序目录:
cd /opt/vmware/vpostgres/current/bin

4.查看 vPostgres 数据库配置文件:
cat /etc/vmware-vpx/embedded_db.cfg

5.备份 vCenter Server 数据库:(请注意磁盘空间是否够用)
./pg_dump EMB_DB_INSTANCE -U EMB_DB_USER -Fp -c > VCDBBackupFile
在 EMD_DB_INSTANCE 和 EMB_DB_USER 中填入 embedded_db.cfg 里面的配置信息。在 VCDBBackupFile 中填入要生成的位置和文件名,例如:
./pg_dump VCDB -U vc -Fp -c > /tmp/VCDBackUp
注意:如果出现提示,输入 EMB_DB_PASSWORD 密码。

———-以下开始还原vPostgres 数据库
6.显示新的 vPostgres 数据库配置文件
cat /etc/vmware-vpx/embedded_db.cfg

7.进入vPostgres 程序目录:
cd /opt/vmware/vpostgres/current/bin

8.停止 VMware vCenter Server 服务:
service vmware-vpxd stop

9.还原 vCenter Server vPostgres 数据库
PGPASSWORD=’EMB_DB_PASSWORD’ ./psql -d EMB_DB_INSTANCE -U postgres -f VCDBBackupFile
在 EMD_DB_INSTANCE 和 EMB_DB_PASSWORD 中填入 embedded_db.cfg 里面的配置信息。 在 VCDBBackupFile 中填入要使用的位置和文件名,例如:
PGPASSWORD=’g<T4EuybGsA=kG$G' ./psql -d VCDB -U postgres -f /tmp/VCDBackUp
注意:用单引号 (') 将密码括起来

10.重新启动 VMware vCenter Server 服务以使数据库还原生效
service vmware-vpxd start

备份和还原vCenter Server Appliance (VCSA) Inventory Service 数据库

2019-11-05

1.去5480端口开启VCENTER的远程ssh连接登陆.

2.停止 vCenter Inventory Service:
service vmware-inventoryservice stop

3.进入备份脚本目录:
cd /usr/lib/vmware-vpx/inventoryservice/scripts/

4.备份 vCenter Inventory Service 数据库:
./backup.sh -file /tmp/InventoryServiceDB.DB
成功的 vCenter Inventory Service 数据库导出将显示类似于以下内容的输出:
Opening Inventory Service data files
Inventory Service data files opened
Backing up data…
Backup completed successfully

———以下开始还原
5.还原 vCenter Inventory Service 数据库
上传备份文件InventoryServiceDB.DB至VCENTER的/tmp目录

6.停止 vCenter Inventory Service:
service vmware-inventoryservice stop

7.进入还原脚本目录:
cd /usr/lib/vmware-vpx/inventoryservice/scripts/

8.还原 vCenter Inventory Service 数据库
./restore.sh -backup /tmp/InventoryServiceDB.DB
成功的 vCenter Inventory Service 数据库导出将显示类似于以下内容的输出:
Restoring from backup: /tmp/InventoryServicedb.DB
Restoring…
Attempting to save existing data to /storage/db/inventoryservice/data-1382478584969.old
Saved existing data to /storage/db/inventoryservice/data-1382478584969.old
Restore completed successfully

9.启动 vCenter Inventory Service
service vmware-inventoryservice start

=================
还原完成后,登录到 vSphere Web Client(默认 URL 为 https://VCSA_FQDN:9443)以验证 Inventory Service 是否可以正常运行。执行以下检查:
确保虚拟机和模板视图和主机和群集视图中列出了所有虚拟机。
确保已还原环境中已配置的任何标记。

纪念wzr-hp-g300nh

2019-11-04

G300NH从2008年购买行货到现在有7年了(Atheros ar9132/RAM 64 MB/FLASH 32 MB)。2011年的时候刷机变砖还更换过一次G300NH

buffalo后来批次的G300NH质量不如此款产品刚上市的时候,明显感觉到信号强度减弱。时而还能被干扰的没有了信号。实在不想忍耐了,再让客服更换一部的时候,G300NH停产了,只有G300NH2能换了=。=V2版本的硬件配置严重缩水啊,索性淘汰给父母使用了

昨天G300NH的openwrt开始掉线,无线+有线都莫名其妙的不正常,顺便再升级Backfire为Barrier Breaker

总结下心路历程:

1、原厂buffalo固件:wzrg300nh_original.bin(1.65)、wzrhpg300nh-176、wzrhpg300nh-179
2、原厂dd-wrt固件:wzrhpg300nh-pro-v24sp2-17798-alpha、wzrhpg300nh-pro-v24sp2-14998b
3、dd-wrt:v24 presp2[beta]build: 14896
4、openwrt:Backfire 10.03.1-rc6、Barrier Breaker 14.07
5、gargoyle:gargoyle_1.4.7、gargoyle_1.5.6

最稳定的固件:gargoyle、buffalo原厂固件
定制方便的固件:openwrt(linux爱好者的最爱,就是无线模块有兼容性问题。某些设备连不上WIFI,刷不同的版本与固定WIFI信道解决)
不稳定的固件:dd-wrt和原厂dd-wrt固件。(路由器会假上网,需要随机性重启路由,懒得再不停的刷不同的版本号固件当小白鼠了)

刷机的简要介绍,几乎忘光,再重新拾起记忆:(tomato固件无法支持Atheros芯片)
1、原厂buffalo到DD-WRT:从192.168.11.1网页直接升级
http://www.dd-wrt.com/site/support/router-database
找Buffalo WZR-HP-G300NH: Special File for initial flashing buffalo_to_ddwrt_webflash-MULTI.bin
———–
另一种命令行方法
cd /tmp
wget http://download1.dd-wrt.com/dd-wrtv2/downloads/others/eko/BrainSlayer-V24-preSP2/2014/12-22-2014-r25697/buffalo_wzr-hp-g300nh/buffalo_to_ddwrt_webflash-MULTI.bin
write buffalo_to_ddwrt_webflash-MULTI.bin linux
再用“硬复位”方法重置路由器

2、原厂buffalo到原厂dd-wrt:从192.168.11.1网页直接升级
http://buffalo.jp/support_ap/support/products/wzr_hp_g300nh.html

3、DD-WRT到openwrt:ssh 192.168.1.1到路由器上(openwrt的固件带factory字样是适合在原厂固件的基础上刷的固件,带sysupgrade固件是适合在已经刷了openwrt的固件的基础上升级用)
cd /tmp
wget https://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/openwrt-ar71xx-generic-wzr-hp-g300nh-squashfs-sysupgrade.bin
mtd -r write openwrt-ar71xx-generic-wzr-hp-g300nh-squashfs-sysupgrade.bin linux
————-
刷好是没有图形界面的哦,需要ssh 192.168.1.1登录root/password,更改passwd root,配置网口,先上路由拨号上网,或者接上上级路由,上INTERNET,升级并安装图形界面。不安装图形界面也一样用,就是无法远程指挥父母去路由器的配置调整了。
vi /etc/config/network
config ‘interface’ ‘loopback’
option ‘ifname’ ‘lo’
option ‘proto’ ‘static’
option ‘ipaddr’ ‘127.0.0.1’
option ‘netmask’ ‘255.0.0.0’

config ‘interface’ ‘lan’
option ‘ifname’ ‘eth0’
option ‘type’ ‘bridge’
option ‘proto’ ‘static’
option ‘ipaddr’ ‘192.168.1.1’
option ‘netmask’ ‘255.255.255.0’

config ‘interface’ ‘wan’
option ‘ifname’ ‘eth1’
option ‘proto’ ‘pppoe’
option ‘username’ ‘你的ADSL账号’
option ‘password’ ‘密码’

config ‘switch’ ‘eth0’
option ‘enable_vlan’ ‘1’

config ‘switch_vlan’
option ‘device’ ‘eth0’
option ‘vlan’ ‘1’
option ‘ports’ ‘0 1 2 3 4’

————–
升级并按照WEB界面
opkg update
opkg install luci
启动WEB服务
/etc/init.d/uhttpd enable
/etc/init.d/uhttpd start

4、openwrt到gargoyle:ssh 192.168.1.1到路由器上
cd /tmp
wget http://www.gargoyle-router.com/downloads/images/ar71xx/gargoyle_1.4.4-ar71xx-wzr-hp-g300nh-squashfs-sysupgrade.bin
mtd -e linux -r write gargoyle_1.3.14-ar71xx-wzr-hp-g300nh-squashfs-sysupgrade.bin linux

======================
30/30/30 (硬复位)【即插电30秒 断电30秒 再插电30秒】

按住路由器后部的复位按钮30秒,保持按住的状态拔掉电源30秒,然后同样保持按住的状态重新插上路由器。此操作将重置 nvram,确保您在纯净的环境下载入固件。”恢复出厂默认设置” 功能并不总是清理整个 nvram 区段。

替代方法:
ssh 登录至路由器,执行以下命令:
erase nvram
reboot

=======================
恢复BUFFALO原厂固件(http://www.box.net/shared/1edtrud64v):ssh 192.168.1.1
cd /tmp
wget http://www.example.org/original_firmware.bin
mtd -r write /tmp/original_firmware.bin firmware

====================
以上编辑于2015年3月8日,一直未发布.

昨日20191103发现
http://buffalo.jp/support_ap/support/products/wzr_hp_g300nh.html
有一个V24-SP2 build r30356是18年3月26发布的新固件,心血来潮刷了一下,发现N信号只支持到150Mb,客户端信号最大30Mb/s,更过分的是玩在线手机游戏会断流!!!被坑死.狗日的垃圾官方固件.只能刷回buffalo1.76.为啥不用1.79版本?因为N信号也是150Mb的网速.

G300NH的DDWRT,OPENWRT固件都是各有各的问题,例如:断线/与手机无线不兼容/降速/假死….最后还是gargoyle、buffalo固件稳定.

怀念往事,怀念当年心爱的穿墙路由器.仅以此文作为留念.linksys e4200 ea6700依旧坚挺,只是信号强度确实不如野路子厂商.

使用Powerpill并发下载提升pacman更新速度

2019-10-18

1.安装
sudo pacman -S powerpill

2.系统升级pacman -Syu换成
powerpill -Syu

3.安装软件
powerpill -S packagename1 packagename2

=========================
已知报错:
In case you get an [err] for .db.sig files:

b5d7d7|ERR | 0B/s|/var/lib/pacman/sync/extra.db.sig
899e91|ERR | 0B/s|/var/lib/pacman/sync/multilib.db.sig
8fcc32|ERR | 0B/s|/var/lib/pacman/sync/core.db.sig
85eb3d|ERR | 0B/s|/var/lib/pacman/sync/community.db.sig

解决办法:
sudo vi /etc/pacman.conf
注释掉此行
#SigLevel = Optional TrustedOnly
新添加此行
SigLevel = PackageRequired

arch升级kernel为lts版

2019-10-16

sudo pacman -S linux-lts linux-lts-headers
sudo pacman -Rsn linux linux-headers
sudo grub-mkconfig -o /boot/grub/grub.cfg
reboot

====================
开启BBR
sudo sysctl net.ipv4.tcp_congestion_control=bbr

永久开启BBR
# Load the BBR kernel module.
echo “tcp_bbr” > /etc/modules-load.d/modules.conf

# Set the default congestion algorithm to BBR.
echo “net.core.default_qdisc=fq” > /etc/sysctl.d/bbr.conf
echo “net.ipv4.tcp_congestion_control=bbr” >> /etc/sysctl.d/bbr.conf