resolv.conf, search, domain, nameserver, DNS

‘resolv.conf, search, domain, nameserver, DNS’ http://www.ttlsa.com/linux/resolv-conf-desc/ resolv.conf 是 resolver 类库使用的配置文件, 每当一个程序需要通过域名来访问 internet 上面的其它主机时, 需要利用该类库将域名转换成对应的IP, 然后才可进行访问. resolv.conf 文件的配置选项不多, 从 man 文档中看了半天,不理解 domain 和 search 使用来干嘛的。 这里做个解释, 防止以后忘了 (环境: ubuntu12.04) : nameserver x.x.x.x 该选项用来制定 DNS 服务器的, 可以配置多个 nameserver 指定多个 DNS。 domain mydomain.com 这个用来指定本地的域名, 在没有设置 search 的情况下, search 默认为 domain 的值。 这个值可以随便配, 目前在我看来, domain 除了当 search 的默认值外, 没有其它用途。也就说一旦配置 search, 那 domain 就没用了。 search google.com baidu.com 该选项可以用来指定多个域名,中间用空格或tab键隔开。它是干嘛的呢? 如: 在没有配置该选项时,执行 ping new sping: unknown host news ...

2018-09-25 · 1 min · 169 words · -

裴讯N1

裴讯N1 斐讯N1折腾记: 降级及刷入官改 https://forum.khadas.com/t/burning-tools-for-linux-pc/1832 https://github.com/khadas/utils

2018-09-25 · 1 min · 5 words · -

centos audit.log

centos audit.log ansible all -m yum -a 'name=audit state=present' ansible all -m yum -a 'name=audit-libs state=present' ansible all -m service -a 'name=auditd state=restarted'

2018-09-25 · 1 min · 23 words · -

Execute bash script from URL

Execute bash script from URL bash <(curl -s http://mywebsite.com/myscript.txt) curl -s https://myurl.com/script.sh | bash /dev/stdin param1 param2 Directly run bash scripts in Github Gists locally in Terminal. Get the raw version of it and copy the link. Now we are going to curl that link to get the content in the file and then pass that content to bash. https://stackoverflow.com/questions/5735666/execute-bash-script-from-url

2018-09-24 · 1 min · 60 words · -

redis docker

redis docker podman run \ -d \ --name redis \ -p 6379:6379 \ -v /etc/localtime:/etc/localtime:ro \ redis docker run -it --rm redis redis-cli -c -h 192.168.1.xxx #创建并启动容器 sudo docker run --name redis-x -p 6379:6379 -d redis #启动 sudo docker start redis-x sudo docker exec -it redis-x redis-cli http://www.runoob.com/docker/docker-install-redis.html

2018-09-21 · 1 min · 48 words · -

tomcat autoDeploy="false" deployOnStartup="false"

’tomcat autoDeploy=“false” deployOnStartup=“false”' https://stackoverflow.com/questions/26884335/tomcat-deploy-only-manager-on-startup From the Apache 6 documentation: https://tomcat.apache.org/tomcat-6.0-doc/config/context.html in the Attributes section of Context, the documentation for the path attribute specifies: This attribute must only be used when statically defining a Context in server.xml. In all other circumstances, the path will be inferred from the filenames used for either the .xml context file or the docBase. Even when statically defining a Context in server.xml, this attribute must not be set unless either the docBase is not located under the Host’s appBase or both deployOnStartup and autoDeploy are false. If this rule is not followed, double deployment is likely to result. ...

2018-09-19 · 1 min · 126 words · -

Archlinux, Pixelbook, chromeos, Crostini

Archlinux, Pixelbook, chromeos, Crostini https://wiki.archlinux.org/title/Chromebook_Pixel_2 https://wiki.archlinux.org/index.php/Chrome_OS_devices/Crostini Enabling Linux support Settings > Linux > Enable Delete the Debian container (optional) vmc destroy termina vmc start termina Install an Arch linux container Open a new terminal in Chrome (Ctrl + Alt + T) vmc container termina arch https://us.images.linuxcontainers.org archlinux/current vsh termina lxc list lxc exec arch -- bash passwd $(grep 1000:1000 /etc/passwd|cut -d':' -f1) pacman -S sudo visudo # Uncomment this line: %wheel ALL=(ALL) ALL usermod -aG wheel $(grep 1000:1000 /etc/passwd|cut -d':' -f1) exit lxc console arch # enter user name root ip -4 a show dev eth0 # config arch pacman mirror # install yay yay -S cros-container-guest-tools-git sudo pacman -S wayland sudo pacman -S xorg-server-xwayland # 第一次执行如果报错,尝试停掉container重启 lxc stop arch lxc start arch systemctl --user enable sommelier@0 systemctl --user enable sommelier-x@0 systemctl --user start sommelier@1 systemctl --user start sommelier-x@1 systemctl --user status sommelier@0 systemctl --user status sommelier@1 systemctl --user status sommelier-x@0 systemctl --user status sommelier-x@1 lxc stop --force arch lxc stop --force penguin lxc rename penguin debian lxc rename arch penguin lxc start penguin https://tedyin.com/posts/archlinux-on-pixelbook/ ...

2018-09-08 · 2 min · 274 words · -

dnsmasq config 配置

‘dnsmasq config 配置’ DNSmasq是一个小巧且方便地用于配置DNS和DHCP的工具,适用于小型网络。它提供了DNS功能和可选择的DHCP功能可以取代dhcpd(DHCPD服务配置)和bind等服务,配置起来更简单,更适用于虚拟化和大数据环境的部署。 检查一下no-hosts前面是不是已经有了#号,默认的情况下是有的,dnsmasq 会首先寻找本地的 hosts 文件再去寻找缓存下来的域名, 最后去上游dns 服务器寻找。 install ubuntu apt install dnsmasq docker docker run \ --name dnsmasq \ -d \ -p 30053:53/udp \ -p 35380:8080 \ -v dnsmasq-config:/etc/dnsmasq.conf \ --log-opt "max-size=100m" \ -e "HTTP_USER=foo" \ -e "HTTP_PASS=bar" \ --restart always \ jpillora/dnsmasq docker run \ -d \ --name dnsmasq \ --cap-add=NET_ADMIN \ -p 53:53/udp \ -v /etc/localtime:/etc/localtime:ro \ -v dnsmasq-config:/etc/dnsmasq.d \ --restart=always \ andyshinn/dnsmasq mkdir /etc/dnsmasq.d echo 'conf-dir=/etc/dnsmasq.d' >> /etc/dnsmasq.conf http://debugo.com/dnsmasq/ dhcp服务 其中一些关键的配置如下,配置文件/etc/dnsmasq.conf 中的注释已经给出了非常详细的解释。 vim /etc/dnsmasq.conf # 配置上游服务器地址 # resolv-file配置Dnsmasq额外的上游的DNS服务器,如果不开启就使用Linux主机默认的/etc/resolv.conf里的nameserver。 # 通过下面的选项指定其他文件来管理上游的DNS服务器 resolv-file=/etc/resolv.dnsmasq.conf # 服务监听的网络接口地址 # If you want dnsmasq to listen for DHCP and DNS requests only on # specified interfaces (and the loopback) give the name of the # interface (eg eth0) here. # Repeat the line for more than one interface. #interface= # Or you can specify which interface _not_ to listen on #except-interface= # Or which to listen on by address (remember to include 127.0.0.1 if # you use this.) listen-address=192.168.97.1,127.0.0.1 # dhcp动态分配的地址范围 # Uncomment this to enable the integrated DHCP server, you need # to supply the range of addresses available for lease and optionally a lease time dhcp-range=192.168.97.10,192.168.97.20,48h # dhcp服务的静态绑定 # Always set the name and ipaddr of the host with hardware address # dhcp-host=00:0C:29:5E:F2:6F,192.168.1.201 # dhcp-host=00:0C:29:5E:F2:6F,192.168.1.201,infinite 无限租期 dhcp-host=00:0C:29:5E:F2:6F,192.168.97.201,os02 dhcp-host=00:0C:29:15:63:CF,192.168.97.202,os03 vim /etc/resolv.dnsmasq.conf nameserver 223.5.5.5 nameserver 223.6.6.6 DNSMasq支持泛域名,比如在hosts中需要配2000条 apple app store ...

2018-09-07 · 2 min · 324 words · -

archlinux clean

archlinux clean # pacman 缓存 目录 /var/cache/pacman/pkg # 查看缓存目录大小 du -sh /var/cache/pacman/pkg # remove cached packages that are not currently installed pacman -Sc # remove all files from the cache pacman -Scc # 定时删除 pacman 缓存 pacman -S pacman-contrib # dry run paccache -d # 软件包保留最近的两个版本 paccache -dk2 paccache -rk2 # 删除已经卸载的软件包 paccache -ruk0 # 启用 paccache timer 每周清理 systemctl enable paccache.timer pacman -Qtdq du -sh ~/.cache du -sh ~/.config du -sh ~/.local/share # clean Trash pacman -S rmlint rmlint /home/wiloon # 命令行的磁盘空间管理工具 pacman -S ncdu # 图形化的磁盘空间管理工具 pacman -S filelight https://bynss.com/linux/471439.html ...

2018-09-03 · 1 min · 122 words · -

vscode basic,vscode, visual studio code

vscode basic,vscode, visual studio code linux vscode 配置 echo "--enable-features=UseOzonePlatform --ozone-platform=wayland" >> ~/.config/code-flags.conf debian install visual studio code install from repo https://linuxize.com/post/how-to-install-visual-studio-code-on-debian-9/ download deb https://code.visualstudio.com/# vscode 列编辑 Alt+Shift+鼠标左键拖动, 选中拖动的区域内容 https://blog.csdn.net/u011127019/article/details/74039598 vscode remote ssh, A> ssh> B A 安装插件 “Remote - SSH” 在 B 主机上配置ssh 公钥 私钥放在 C:\Users\user0\.ssh 里 A, 点击 vscode左下角,选择 remote-ssh: connect to host 字体 打开 VSCode,Windows 下按 Ctrl + ,,macOS 下按 Cmd + ,,进入设定。在上方搜索框搜索 editor.fontFamily,在 Editor: Font Family Controls the font family. 下方的框框填入 font-family 即可。 ...

2018-09-01 · 2 min · 302 words · -

输出重定向 Linux Shell 1>/dev/null 2>&1

输出重定向 Linux Shell 1>/dev/null 2>&1 https://blog.csdn.net/sunboy_2050/article/details/9288353 shell中可能经常能看到: echo log > /dev/null 2>&1 命令的结果可以通过 “>” 的形式来定义输出 /dev/null 代表空设备文件 > > : 代表重定向到哪里,例如: echo "123" > /home/123.txt 1 : 表示 stdout 标准输出, 系统默认值是1, 所以 >/dev/null 等同于 1>/dev/null 2 : 表示 stderr 标准错误 & : 表示等同于的意思, 2>&1, 表示 2 的输出重定向等同于 1 1 > /dev/null 2>&1 语句含义: 1 > /dev/null : 首先表示标准输出重定向到空设备文件,也就是不输出任何信息到终端,说白了就是不显示任何信息。 2>&1 : 接着,标准错误输出重定向 (等同于) 标准输出,因为之前标准输出已经重定向到了空设备文件,所以标准错误输出也重定向到空设备文件。 实例解析: cmd >a 2>a 和 cmd >a 2>&1 为什么不同? ...

2018-08-31 · 2 min · 263 words · -

Perf

Perf 从2.6.31内核开始,linux内核自带了一个性能分析工具perf,能够进行函数级与指令级的热点查找。 Perf 是用来进行软件性能分析的工具。 通过它,应用程序可以利用 PMU,tracepoint 和内核中的特殊计数器来进行性能统计。它不但可以分析指定应用程序的性能问题 (per thread),也可以用来分析内核的性能问题,当然也可以同时分析应用代码和内核,从而全面理解应用程序中的性能瓶颈。 最初的时候,它叫做 Performance counter,在 2.6.31 中第一次亮相。此后他成为内核开发最为活跃的一个领域。在 2.6.32 中它正式改名为 Performance Event,因为 perf 已不再仅仅作为 PMU 的抽象,而是能够处理所有的性能相关的事件 从2.6.31内核开始,linux内核自带了一个性能分析工具perf,能够进行函数级与指令级的热点查找。 perf Performance analysis tools for Linux. Performance counters for Linux are a new kernel-based subsystem that provide a framework for all things performance analysis. It covers hardware level (CPU/PMU, Performance Monitoring Unit) features and software features (software counters, tracepoints) as well. Perf是内置于Linux内核源码树中的性能剖析(profiling)工具。 它基于事件采样原理,以性能事件为基础,支持针对处理器相关性能指标与操作系统相关性能指标的性能剖析。 常用于性能瓶颈的查找与热点代码的定位。 CPU周期(cpu-cycles)是默认的性能事件,所谓的CPU周期是指CPU所能识别的最小时间单元,通常为亿分之几秒, 是CPU执行最简单的指令时所需要的时间,例如读取寄存器中的内容,也叫做clock tick。 ...

2018-08-31 · 7 min · 1307 words · -

ID Mapper, idmapper, fs.nfs.idmap_cache_timeout

ID Mapper, idmapper, fs.nfs.idmap_cache_timeout Id mapper is used by NFS to translate user and group ids into names, and to translate user and group names into ids. Part of this translation involves performing an upcall to userspace to request the information. fs.nfs.idmap_cache_timeout 设置idmapper缓存项的最大寿命,单位是秒 https://www.kernel.org/doc/Documentation/filesystems/nfs/idmapper.txt https://www.cnblogs.com/tolimit/p/5065761.html

2018-08-29 · 1 min · 45 words · -

epoll, kqueue

epoll, kqueue epoll 通过使用红黑树(RB-tree)搜索被监视的文件描述符(file descriptor)。 用户空间与内核空间 现在操作系统都是采用虚拟存储器,那么对32位操作系统而言,它的寻址空间 (虚拟存储空间) 为4G (2的32次方) 。操作系统的核心是内核,独立于普通的应用程序,可以访问受保护的内存空间,也有访问底层硬件设备的所有权限。为了保证用户进程不能直接操作内核 (kernel) ,保证内核的安全,操心系统将虚拟空间划分为两部分,一部分为内核空间,一部分为用户空间。针对linux操作系统而言,将最高的1G字节 (从虚拟地址0xC0000000到0xFFFFFFFF) ,供内核使用,称为内核空间,而将较低的3G字节 (从虚拟地址0x00000000到0xBFFFFFFF) ,供各个进程使用,称为用户空间。 进程切换 为了控制进程的执行,内核必须有能力挂起正在CPU上运行的进程,并恢复以前挂起的某个进程的执行。这种行为被称为进程切换。因此可以说,任何进程都是在操作系统内核的支持下运行的,是与内核紧密相关的。 从一个进程的运行转到另一个进程上运行,这个过程中经过下面这些变化: 保存处理机上下文,包括程序计数器和其他寄存器。 更新PCB信息。 把进程的PCB移入相应的队列,如就绪、在某事件阻塞等队列。 选择另一个进程执行,并更新其PCB。 更新内存管理的数据结构。 恢复处理机上下文。 进程的阻塞 正在执行的进程,由于期待的某些事件未发生,如请求系统资源失败、等待某种操作的完成、新数据尚未到达或无新工作做等,则由系统自动执行阻塞原语(Block),使自己由运行状态变为阻塞状态。可见,进程的阻塞是进程自身的一种主动行为,也因此只有处于运行态的进程 (获得CPU) ,才可能将其转为阻塞状态。当进程进入阻塞状态,是不占用CPU资源的。 缓存 I/O 缓存 I/O 又被称作标准 I/O,大多数文件系统的默认 I/O 操作都是缓存 I/O。在 Linux 的缓存 I/O 机制中,操作系统会将 I/O 的数据缓存在文件系统的页缓存 ( page cache ) 中,也就是说,数据会先被拷贝到操作系统内核的缓冲区中,然后才会从操作系统内核的缓冲区拷贝到应用程序的地址空间。 缓存 I/O 的缺点: 数据在传输过程中需要在应用程序地址空间和内核进行多次数据拷贝操作,这些数据拷贝操作所带来的 CPU 以及内存开销是非常大的。 IO模式 刚才说了,对于一次IO访问 (以read举例) ,数据会先被拷贝到操作系统内核的缓冲区中,然后才会从操作系统内核的缓冲区拷贝到应用程序的地址空间。所以说,当一个read操作发生时,它会经历两个阶段: 等待数据准备 (Waiting for the data to be ready) 将数据从内核拷贝到进程中 (Copying the data from the kernel to the process) 正式因为这两个阶段,linux系统产生了下面五种网络模式的方案。 ...

2018-08-28 · 6 min · 1237 words · -

Shell 逐行处理文本文件

Shell 逐行处理文本文件, shell 读文件 https://www.cnblogs.com/dwdxdy/archive/2012/07/25/2608816.html read命令 read命令接收标准输入,或其他文件描述符的输入,得到输入后,read命令将数据放入一个标准变量中. 用read读取文件时,每次调用read命令都会读取文件中的"一行"文本. 当文件没有可读的行时, read命令将以非零状态退出. #!/bin/bash cat data.dat | while read line; do echo "File:${line}" done while read line; do echo "File:${line}" done <data.dat 2.使用awk命令完成 awk是一种优良的文本处理工具,提供了极其强大的功能. 利用awk读取文件中的每行数据,并且可以对每行数据做一些处理,还可以单独处理每行数据里的每列数据. 1 cat data.dat | awk ‘{print $0}’ 2 cat data.dat | awk ‘for(i=2;i<NF;i++) {printf $i} printf “\n”}’ 第1行代码输出data.dat里的每行数据,第2代码输出每行中从第2列之后的数据. 如果是单纯的数据或文本文件的按行读取和显示的话,使用awk命令比较方便. 3.使用for var in file 命令完成 for var in file表示变量var在file中循环取值.取值的分隔符由$IFS确定. 复制代码 1 for line in $(cat data.dat) 2 do 3 echo “File:${line}” 4 done 6 for line in cat data.dat ...

2018-08-28 · 1 min · 94 words · -

RCU

RCU RCU是read-copy-update的简称,翻译为中文有点别扭"读-复制-更新"。它是是一种同步机制,有三种角色或者操作: 读者、写者和复制操作,我理解其中的复制操作就是不同CPU上的读者复制了不同的数据值,或者说拥有同一个指针的不同拷贝值,也可以理解为: 在读者读取值的时候,写者复制并替换其内容 (后一种理解来自于RCU作者的解释) 。它于2002年10月引入Linux内核。 RCU允许读操作可以与更新操作并发执行,这一点提升了程序的可扩展性。常规的互斥锁让并发线程互斥执行,并不关心该线程是读者还是写者,而读/写锁在没有写者时允许并发的读者,相比于这些常规锁操作,RCU在维护对象的多个版本时确保读操作保持一致,同时保证只有所有当前读端临界区都执行完毕后才释放对象。RCU定义并使用了高效并且易于扩展的机制,用来发布和读取对象的新版本,还用于延后旧版本对象的垃圾收集工作。这些机制恰当地在读端和更新端并行工作,使得读端特别快速。在某些场合下 (比如非抢占式内核里) ,RCU读端的函数完全是零开销。 https://cloud.tencent.com/developer/article/1006226 https://cloud.tencent.com/developer/article/1006236 https://blog.csdn.net/juS3Ve/article/details/78447574

2018-08-28 · 1 min · 12 words · -

SysRq

SysRq https://blog.csdn.net/jasonchen_gbd/article/details/79080576 SysRq是Linux提供的一个"Magic System Request Key", 它可以在系统出现故障的时候协助恢复和调试系统。只要你的虚拟终端或串口还可以接收键盘输入 (系统还能响应键盘的按键中断), SysRq 就可用, 你可以借助它来查看当时的内存、进程状态等信息,而不是直接强行拔掉电源重启系统。 SysRq能做的事情看HELP就知道了: SysRq : HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u) show-blocked-tasks(w) dump-ftrace-buffer(z) SysRq的用法 2.1 启用SysRq 首先要确保内核打开了CONFIG_MAGIC_SYSRQ配置项,这样SysRq的底层处理才可用。 另外内核中有一个宏定义SYSRQ_DEFAULT_ENABLE,表示系统默认情况下是否启用SysRq功能键。当然,不管这个值是不是yes,你都可以通过proc文件系统来开启或关闭SysRq键: 查看当前SysRq是否被开启 (0表示关闭), archlinux 默认开启 cat /proc/sys/kernel/sysrq 开启SysRq: echo 1 > /proc/sys/kernel/sysrq 也可以使用sysctl命令: sysctl -w kernel.sysrq=1 kernel.sysrq = 1 实际上sysctl这条命令就是通过修改/proc/sys/kernel/sysrq来生效的。可以把"kernel.sysrq = 1"设置到/etc/sysctl.conf中,使SysRq在下次系统重启仍生效。 上面说0表示完全关闭SysRq,1表示使能SysRq的所有功能,还可以设置成其他数字来选择开启部分功能,可参考内核里的Documentation/sysrq.txt。 SysRq支持的所有功能列表及相应的handler见drivers/tty/sysrq.c中静态数组sysrq_key_table[]的定义,当然,也可以通过下面提到的SysRq的help信息了解到。 2.2 使用SysRq 我们可以直接通过按键的方式或者通过写/proc/sysrq-trigger的方式来触发SysRq的操作。SysRq支持的操作可参考下面的HELP输出: echo > /proc/sysrq-trigger [16037.132214] SysRq : HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u) show-blocked-tasks(w) dump-ftrace-buffer(z) ...

2018-08-27 · 1 min · 132 words · -

rclone mount google drive, webdav, onedrive

rclone mount google drive, webdav, onedrive install rclone # install rclone sudo pacman -S rclone sudo pacman -S fuse config fuse sudo vim /etc/fuse.conf # uncomment user_allow_other user_allow_other google drive # config rclone rclone config # n, new config # name? name-foo, a name # 11, google drive # client id, leave blank # client secret, leave blank # 1, full access # root_folder_id, get from https://drive.google.com/drive/folders/ # service_account_file, leave blank # Edit advanced config? (y/n) n # auto config? y # team drive? y # y) Yes this is OK, y # q) Quit config, q rclone mount name-foo:path/to/files /path/to/local/mount --allow-other --vfs-cache-mode writes rclone lsl foo: rclone dedupe --dedupe-mode newest $name # linux mount google drive rclone mount foo: /path/to/mount/point --allow-other --vfs-cache-mode writes # windows mount google drive rclone.exe mount foo:/ x: --cache-dir C:\path\to\cache\dir --vfs-cache-mode writes # foo: google drive rclone name # x: 挂载到的系统盘符 # --cache-dir C:\path\to\cache\dir, 缓存目录 mount webdav rclone config n name0 # enter name 24 #webdav, see help at https://rclone.org/webdav/ #enter webdav url #列出目录内容 # 注意: rclone 挂载点名字后面有冒号 rclone lsl mount via systemd uid=1000, gid=2000 ...

2018-08-26 · 3 min · 445 words · -

Awk/Unix group by

Awk/Unix group by $ awk -F, 'NR>1{arr[$1]++}END{for (a in arr) print a, arr[a]}' file.txt joe 1 jim 1 mike 3 bob 2 EXPLANATIONS -F, splits on , NR>1 treat lines after line 1 arr[$1]++ increment array arr (split with ,) with first column as key END{} block is executed @ the end of processing the file for (a in arr) iterating over arr with a key print a print key , arr[a] array with a key ...

2018-08-25 · 1 min · 77 words · -

sysctl

sysctl archlinux systemd-sysctl 服务在启动时会加载 /etc/sysctl.d/*.conf, 配置内核参数 /etc/sysctl.conf 不起作用 sysctl 命令被用于在内核运行时动态地修改内核的运行参数, 可用的内核参数在目录 /proc/sys 中。它包含一些 TCP/ip 堆栈和虚拟内存系统的高级选项,用sysctl可以读取设置超过五百个系统变量。 CentOS 5 supported the placement of sysctl directives in files under /etc/sysctl.d/ . The code is within /etc/init.d/functions sysctl [options] [variable[=value] …] -a: 打印所有内核参数 -n: 打印时只打印值,不打印参数名称; -e: 忽略未知关键字错误; -N: 打印时只打印参数名称,不打印值; -w: 设置参数的值 -p: 从配置文件 "/etc/sysctl.conf" 加载内核参数设置 -A: 以表格方式打印所有内核参数变量。 查看变量 # 查看 sysctl net.ipv4.ip_forward cat /proc/sys/net/ipv4/ip_forward # 查看变量, 打印所有参数并过滤 sysctl -a | grep tcp_syn_retrie sudo sysctl -a | egrep "rmem|wmem|adv_win|moderate" 设置内核参数 临时设置 重启之后会恢复为默认值。 ...

2018-08-24 · 7 min · 1458 words · -