记录下几个命令

然后 慢慢学习一下 得记住这些 神奇的 命令 然后 后面慢慢补文档

iptables

vps 无公网时 可用内网任意一台上网

https://support.huaweicloud.com/usermanual-ecs/ecs_03_0705.html

这些命令 都在 可上网的机器上操作

1
2
iptables -t nat -A POSTROUTING -o eth0 -s 172.16.1.0/24 -j SNAT --to 172.16.1.9
iptables -t nat -D POSTROUTING -o eth0 -s 172.16.1.0/24 -j SNAT --to 172.16.1.9

查看 nat 设置规则

1
iptables -t nat --list

保存 iptables 规则

1
2
apt-get install iptables-persistent
Usage: /usr/sbin/netfilter-persistent (start|stop|restart|reload|flush|save)

文件查看

tail

vi

复制 yy

粘贴 p

设置 hostname

1
hostnamectl set-hostname name

/etc/sysctl.conf

https://oneinstack.com/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
fs.file-max = 1000000
fs.inotify.max_user_instances = 8192
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_tw_reuse = 1
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.route.gc_timeout = 100
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_synack_retries = 1
net.core.somaxconn = 32768
net.core.netdev_max_backlog = 32768
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_max_orphans = 32768