www 发布的文章
Ubuntu 22.04.1修改DNS服务器
Ubuntu 22.04.1默认采用systemd-resolved
作为DNS维护服务,其生成的/etc/resolv.conf
文件内容如下:
# This is /run/systemd/resolve/resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
#
# This file might be symlinked as /etc/resolv.conf. If you're looking at
# /etc/resolv.conf and seeing this text, you have followed the symlink.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs should typically not access this file directly, but only
# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
# different way, replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 192.168.1.1
search .
如果需要修改DNS服务器,则修改文件/etc/systemd/resolved.conf
中的DNS字段,示例:
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the resolved.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# Use 'systemd-analyze cat-config systemd/resolved.conf' to display the full config.
#
# See resolved.conf(5) for details.
[Resolve]
# Some examples of DNS servers which may be used for DNS= and FallbackDNS=:
# Cloudflare: 1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com
# Google: 8.8.8.8#dns.google 8.8.4.4#dns.google 2001:4860:4860::8888#dns.google 2001:4860:4860::8844#dns.google
# Quad9: 9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net
DNS=223.6.6.6 119.29.29.29
#FallbackDNS=
#Domains=
#DNSSEC=no
#DNSOverTLS=no
#MulticastDNS=no
#LLMNR=no
#Cache=no-negative
#CacheFromLocalhost=no
#DNSStubListener=yes
#DNSStubListenerExtra=
#ReadEtcHosts=yes
#ResolveUnicastSingleLabel=no
再重启服务生效:
sudo systemctl restart systemd-resolved
常用分辨率大小信息汇总
电脑标准 | 分辨率 | 比例 |
---|---|---|
CGA | 320×200 | 16:10 |
QVGA | 320×240 | 4:3 |
WQVGA | 480×272 | 16:9 |
B&W Macintosh/Macintosh LC | 512×384 | 4:3 |
HVGA | 480×320 | 3:2 |
EGA | 640×350 | 约5:3 |
nHD | 640×360 | 16:9 |
VGA 及 MCGA | 640×480 | 4:3 |
HGC | 720×348 | 60:29 |
MDA | 720×350 | 72:35 |
Apple Lisa | 720×360 | 2:1 |
SVGA | 800×600 | 4:3 |
WVGA | 800×480 | 5:3 |
FWVGA | 854×480 | 约16:9 |
qHD | 960×540 | 16:9 |
DVGA | 960×640 | 3:2 |
WSVGA | 1024×600 | 128:75 |
XGA | 1024×768 | 4:3 |
XGA+ | 1152×864 | 4:3 |
HD | 1280×720 | 16:9 |
WXGA | 1280×768 | 15:9 |
WXGA | 1280×800 | 16:10 |
SXGA | 1280×1024 | 5:4 |
WXSGA+ | 1366×768 | 683:384和16:9 |
WXGA+ | 1440×900 | 16:10 |
SXGA+ | 1400×1050 | 4:3 |
WSXGA | 1600×1024 | 25:16 |
WSXGA+ | 1680×1050 | 16:10 |
UXGA | 1600×1200 | 4:3 |
WUXGA | 1920×1200 | 16:10 |
Full HD | 1920×1080 | 16:9 |
QXGA | 2048×1536 | 4:3 |
QHD | 2560×1080 | 21:9 |
WQHD | 2560×1440 | 16:9 |
WQXGA | 2560×1600 | 16:10 |
QSXGA | 2560×2048 | 5:4 |
WQSXGA | 3200×2048 | 约15.6:10 |
QUXGA | 3200×2400 | 4:3 |
QHD | 3440×1440 | 21:9 |
QFHD | 3840×2160 | 16:9 |
4K Ultra HD | 4096×2160 | (256:135和约17:9) |
WQUXGA | 3840×2400 | 16:10 |
HSXGA | 5120×4096 | 5:4 |
WHSXGA | 6400×4096 | 25:16 |
HUXGA | 6400×4800 | 4:3 |
8K Ultra HD | 7680×4320 | 16:9 |
WHUXGA | 7680×4800 | 16:10 |
模拟电视标准 | 分辨率 | |
PAL | 720×576 | 5:4,非正方形的像素 |
PAL VHS | 320×576 | |
NTSC | 720×480 | |
NTSC VHS | 320×482 | 3:2,非正方形的像素 |
数字电视标准 | 分辨率 | |
NTSC(首选格式) | 648×486 | 4:3 |
D-1 NTSC | 720×486 | |
D-1 NTSC (square pixels) | 720×540 | |
PAL | 720×486 | |
D-1 PAL | 720×576 | 4:3 |
D-1 PAL(正方形像素) | 768×576 | |
HDTV 1080i | 1920×1080 | 16:9 |
HDMI | 1366×768 | 16:9 |
HDTV 720p | 1280×720 | 16:9 |
EDTV 480p | 704×480 | |
数字电影标准 | 分辨率 | |
协会标准(2k) | 2048×1536 | 4:3 |
协会标准(4k) | 4096×3072 | 4:3 |
DVD "NTSC" | 720×480 | 3:2,非正方形的像素 |
DVD "PAL" | 720×576 | 5:4,非正方形的像素 |
VCD "NTSC" | 352×240 | 22:15,非正方形的像素 |
VCD "PAL" | 352×288 | 11:9,非正方形的像素 |
LD | 560×360 |
Windows程序以服务形式运行
frps作为服务端,需要在Windows服务器上实现服务后台运行,借助winsw工具快速搞定,记录如下:
- 下载winsw
https://github.com/winsw/winsw/releases
下载对应的版本,如WinSW-x64.exe
填写服务配置文件
配置文件名:WinSW-x64.xml
,注意取名跟所下载的应用程序名WinSW-x64.exe
相同,并放入同一目录下。<service> <!-- 该服务的唯一标识 --> <id>frps</id> <!-- 该服务的名称 --> <name>frp-server</name> <!-- 该服务的描述 --> <description>frp服务器</description> <!-- 要运行的程序路径 --> <executable>C:\bug\frp\frps.exe</executable> <!-- 携带的参数 --> <startargument>-c</startargument> <startargument>C:\bug\frp\frps.toml</startargument> <!-- 第一次启动失败 60秒重启 --> <onfailure action="restart" delay="60 sec"/> <!-- 第二次启动失败 120秒后重启 --> <onfailure action="restart" delay="120 sec"/> <!-- 日志模式 --> <logmode>append</logmode> <!-- 指定日志文件目录(相对于executable配置的路径) --> <logpath>logs</logpath> </service>
安装并启动服务
以管理员权限运行cmd:
WinSW-x64.exe install WinSW-x64.exe start
- 查看log
找到配置文件所在的logs目录查看即可。
Nginx 只允许Cloudflare CDN IP访问
Nginx 只允许Cloudflare CDN IP访问
server {
listen 80;
server_name your_domain.com;
# 允许 Cloudflare 的 IP 地址访问
# 定义允许的 IPv4 地址范围
allow 173.245.48.0/20;
allow 103.21.244.0/22;
allow 103.22.200.0/22;
allow 103.31.4.0/22;
allow 141.101.64.0/18;
allow 108.162.192.0/18;
allow 190.93.240.0/20;
allow 188.114.96.0/20;
allow 197.234.240.0/22;
allow 198.41.128.0/17;
allow 162.158.0.0/15;
allow 104.16.0.0/13;
allow 104.24.0.0/14;
allow 172.64.0.0/13;
allow 131.0.72.0/22;
# 定义允许的 IPv6 地址范围
allow 2400:cb00::/32;
allow 2606:4700::/32;
allow 2803:f800::/32;
allow 2405:b500::/32;
allow 2405:8100::/32;
allow 2a06:98c0::/29;
allow 2c0f:f248::/32;
# 禁止其他 IP 地址访问
deny all;
# 此处添加其他 Nginx 配置,如 location 等
}