目录
1. Oracle Cloud 配置
1.1. 特别注意
- Oracle cloud 的防火墙
Ingress Rules
配置注意Source Port Range
选择ALL
。 - 如果进去发现没有 instance, 左边
Compartment
选择自己。
1.2. 问题 1: Oracle Cloud SSH 无法远程登录
Oracle Cloud SSH 太坑了, 只支持自家的 Oracle Linux 镜像, 其它的只能使用 terminal 登录。
解决方法: 使用 Oracle Linux 镜像或者使用 terminal 或者使用其它第三方 ssh client。
1.3. 问题 2: Please login as the user “opc” rather than the user “root”.
这是在 .ssh/authorized_keys
里面控制的, 所以要在 .ssh/authorized_keys
里面删除这部分代码。
1.3.1. 第 1 步: 删除 .ssh/authorized_keys
里面的代码
/root/.ssh/authorized_keys
1.3.2. 第 2 步: 编辑 /etc/ssh/sshd_config
文件
PermitRootLogin yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no
1.4. 问题 3: 开启 bbr
现在很多高版本的 Linux 内核不需要重启即可使 bbr 生效。
1.4.1. 检测是否已开启 bbr
uname -a
需要 Linux 4.9.0 以上内核才可以开启 bbr。
sysctl net.ipv4.tcp_available_congestion_control
返回值一般为:
# Run the following command to check available congestion control algorithms.
net.ipv4.tcp_available_congestion_control = bbr cubic reno
# 或者为:
net.ipv4.tcp_available_congestion_control = reno bbr cubic
sysctl net.ipv4.tcp_congestion_control
返回值一般为:
# Run the below command to check the current congestion control algorithm used in your system,
net.ipv4.tcp_congestion_control = bbr
sysctl net.core.default_qdisc
返回值一般为:
net.core.default_qdisc = fq
lsmod | grep bbr
返回值有 tcp_bbr 模块即说明 bbr 已启动。注意: 并不是所有的 VPS 都会有此返回值, 若没有也属正常。
1.4.2. 开启 bbr
如果以上都没有 bbr 说明未开启。可以使用以下方式开启 bbr。
- 编辑
sysctl.conf
vi /etc/sysctl.conf
# 在文件内加入
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
# 使生效
sysctl -p
# 查看 BBR 开启是否成功。或者使用上面的方法。
# 注意没有任何返回不一定没有开启 bbr, 有些 Linux 不返回 bbr 也开启成功了。
# sysctl net.ipv4.tcp_congestion_control 如果有 bbr 那就说明成功了。
lsmod | grep bbr
1.5. Oracle cloud 换 IP
- 进入 instance 详情, 拉到最下方(非常重要, 不是点击中间的那个), 在左边 Resources 下选择 “Attached VNICs”, 再在出现的表格里面点击 “Primary VNIC”;
- 进入后拉到最下方, 左边 Resources 下选择 “IPv4 Addresses”, 在出现的表格里面的右方 “下拉按钮” 处点击 “Edit” 就可以配置 IP 地址了;
- 为了换新 IP 必须先注销当前 IP, 方法是选择 “No public IP” 再 “Update”, 再根据需要选择是 “Ephemeral public IP”(临时 IP) 还是 “Reserved public IP”(固定 IP)。搞科研的话一般临时的就够用了。