页面“Ufw on debian”与“Vps”之间的差异

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
 
 
第1行: 第1行:
[[category:ops]]  [[category:debian]] 
 
  
=线上一般的结合操作=
 
<pre>
 
apt  install ufw
 
ufw enable
 
  
sudo ufw default allow outgoing
+
=免费升级=
sudo ufw default deny incoming
 
  
ufw  allow ssh
+
==vultr ==
ufw  allow  www
+
servers -->settings -->change plan
  
etc
+
== digitalocean==
 +
--> resize -->Disk, CPU and RAM
  
 +
<pre> #150这个样子
 +
evan@bsd-latop:~ % ping linuxchina.net
 +
PING linuxchina.net (138.197.220.125): 56 data bytes
 +
64 bytes from 138.197.220.125: icmp_seq=0 ttl=51 time=154.269 ms
 +
64 bytes from 138.197.220.125: icmp_seq=1 ttl=51 time=153.722 ms
 +
64 bytes from 138.197.220.125: icmp_seq=2 ttl=51 time=153.646 ms
 +
64 bytes from 138.197.220.125: icmp_seq=3 ttl=51 time=153.907 ms
 +
64 bytes from 138.197.220.125: icmp_seq=4 ttl=51 time=153.740 ms
 +
64 bytes from 138.197.220.125: icmp_seq=5 ttl=51 time=152.701 ms
 +
64 bytes from 138.197.220.125: icmp_seq=6 ttl=51 time=153.862 ms
  
正常返回如下
 
 
ufw  status
 
Status: active
 
 
To                        Action      From
 
--                        ------      ----
 
SSH                        ALLOW      Anywhere                 
 
80/tcp                    ALLOW      Anywhere                 
 
SSH (v6)                  ALLOW      Anywhere (v6)           
 
80/tcp (v6)                ALLOW      Anywhere (v6) 
 
  
 +
在HK的机器好一点点
 
</pre>
 
</pre>
  
=*  install=
+
[https://www.zhihu.com/question/25529727 DigitalOcean 选择 Region 的问题?]
  
apt  install ufw
 
  
=* Configuration=
+
[https://digitalocean.youhuima.cc/digitalocean%e5%93%aa%e4%b8%aa%e6%9c%ba%e6%88%bf%e5%bf%ab%e5%92%8c%e7%a8%b3%e5%ae%9a.html Digitalocean哪个机房快和稳定]
<pre>
 
ufw enable
 
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
 
Firewall is active and enabled on system startup
 
  
  
UFW’s defaults are to deny all incoming connections and allow all outgoing connections.
+
https://digitalocean.youhuima.cc/
  
要确定ufw  status 后有没有规则可见
+
这些不错, 过有点小贵
 +
http://www.ehostidc.cn
  
可见 这两个不要手工执行了 默认就有的 现执行就可以连ssh都上不去了
+
国内到韩国的网络线路,应该是最好的,甚至可以媲美中国国内的双线机房。
ufw default deny incoming
 
ufw default allow outgoing
 
  
ufw status verbose
+
<pre>北京联通 ping zyan.cc:
</pre>
+
root@linaro-alip:~# ping zyan.cc
 +
PING zyan.cc (27.255.71.186) 56(84) bytes of data.
 +
64 bytes from 27.255.71.186: icmp_req=1 ttl=50 time=68.3 ms</pre>
  
=* Firewall Rules=
+
=aws and cloud.google=
<pre>
 
  ufw app list
 
   
 
  
ufw  allow 'SSH'
+
==防火墙配置==
ufw  allow  22/tcp
+
GCE 默认开启了防火墙且不能关闭,只能允许你自己指定的协议和端口的流量;经过我自己的实际测试,GCE 能够自动过滤相当的 DDOS 攻击流量。
ufw  allow WWW #其实就是80
 
  
+
由于防火墙不能关闭,所以不能配置类似 IPv6 Tunnel 的服务,所以导致目前的 GCE 是不能够支持 IPv6 的,不过相信以后 Google 还是会启用 IPv6 支持。
 
ufw allow 'Nginx HTTP'
 
  
 +
在 “网络” 里,可以找到 [https://console.cloud.google.com/networking/firewalls/list 防火墙规则],然后可以 [https://console.cloud.google.com/networking/firewalls/add 添加防火墙规则]。
  
ufw allow 53/tcp </pre>
+
默认已经允许了 SSH 和 ICMP 等(以 default 开头的)
  
 +
=Billing=
 +
2018年 04月 30日 星期一 就算为5月一号  $10
  
 +
2018年 09月 03日 星期一 10:18:48 CST $10 就是 70+70 rmb
  
==** Port Ranges ==
+
2018年 11月 02日  2019年 01月 02日 星期三
<pre>
+
2019年3.1  5.1给10刀
Port ranges may also be specified, a simple example for tcp would be:
+
Mon Jul  1 13:37:10 UTC 2019
  
  ufw allow 1000:2000/tcp
+
2019年 9月 1日 星期日 13时19分13秒 CST 只先给了5刀
  
and for udp:
+
Wed 06 Nov 2019
 +
digita
 +
$3.33  Remaining
  
  ufw allow 1000:2000/udp</pre>
+
用了 $7.36 应该可以到12月才 给钱
  
==** IP address==
+
2019年12月 1日
<pre>An IP address may also be used:
 
  
ufw allow from 111.222.333.444</pre>
 
  
=* Deleting Rules=
+
2020年 1月28日 星期二  digio 5刀 ;  vultr没理
<pre>
 
Rules may be deleted with the following command:
 
  
ufw delete allow ssh
+
=ec2=
 +
aws web用firefox打开 不然好慢
 +
=google=
 +
cloud.google.com
  
ufw reset
+
2019.02.06 过期
  
 +
=SEE ALSO=
  
</pre>
+
[https://guozeyu.com/2016/10/asia-google-compute-engine/ Google Compute Engine 新手教程]
 
 
=开启/禁用相应端口或服务举例=
 
<pre>
 
sudo ufw allow 80 #允许外部访问80端口
 
sudo ufw delete allow 80 #禁止外部访问80 端口
 
sudo ufw allow from 192.168.1.1 #允许此IP访问所有的本机端口
 
sudo ufw deny smtp #禁止外部访问smtp服务,#以服务名代表端口,可以使用less /etc/services列出所有服务信息, 其中包括该服务使用了哪个端口和哪种协议
 
sudo ufw delete allow smtp #删除上面建立的某条规则,或者sudo ufw delete allow 80/tcp,如果出现无法删除,可以用序号:sudo ufw status numbered,然后通过序号删除sudo ufw delete 1
 
sudo ufw deny proto tcp from 10.0.0.0/8 to 192.168.0.1 port 22 #要拒绝所有的TCP流量从10.0.0.0/8 到192.168.0.1地址的22端口
 
#可以允许所有RFC1918网络(局域网/无线局域网的)访问这个主机(/8,/16,/12是一种网络分级):
 
sudo ufw allow from 10.0.0.0/8
 
sudo ufw allow from 172.16.0.0/12
 
sudo ufw allow from 192.168.0.0/16
 
</pre>
 
=troubleshooting=
 
<pre>
 
 
 
openssh都连接上去
 
 
 
这个导致上不了的
 
ufw default deny incoming
 
 
 
 
 
确定了 不是这个问题  是
 
ufw  status verbose
 
Status: active
 
Logging: on (low)
 
Default: deny (incoming), allow (outgoing), disabled (routed)
 
New profiles: skip
 
 
 
To                        Action      From
 
--                        ------      ----
 
22/tcp (SSH)              ALLOW IN    Anywhere                 
 
80/tcp (WWW)              ALLOW IN    Anywhere                 
 
22/tcp (SSH (v6))          ALLOW IN    Anywhere (v6)           
 
80/tcp (WWW (v6))          ALLOW IN    Anywhere (v6) 
 
没有东西 
 
 
 
linode 文档得了
 
 
 
如何确定在 ssh这后再deny incoming 呢  参考iptalbes ?
 
 
 
 
 
 
 
</pre>
 
  
=* see also=
+
[https://blog.51cto.com/wzlinux/2382381 国外 VPS 购买列表]
https://wiki.debian.org/Uncomplicated%20Firewall%20%28ufw%29
 
  
https://www.linode.com/docs/security/firewalls/configure-firewall-with-ufw/
 
  
 +
[https://github.com/wuyao721/51docs/blob/master/it/aws-ec2-price.org 亚马逊EC2收费笔记]
  
https://help.ubuntu.com/community/UFW
+
[https://cloud.google.com/compute/docs/instances/connecting-to-instance#standardssh 连接到 Linux 实例]
  
https://www.digitalocean.com/community/tutorials/how-to-setup-a-firewall-with-ufw-on-an-ubuntu-and-debian-cloud-server
+
[https://cloud.google.com/compute/pricing?hl=zh_CN&_ga=2.171515555.-221994790.1518005746 Google Compute Engine 价格]
  
[https://zhuanlan.zhihu.com/p/36646621 ubuntu ufw 防火墙]
+
[[category:ops]] [[category:linux]]

2020年2月28日 (五) 07:28的版本


免费升级

vultr

servers -->settings -->change plan

digitalocean

--> resize -->Disk, CPU and RAM

 #150这个样子
evan@bsd-latop:~ % ping linuxchina.net
PING linuxchina.net (138.197.220.125): 56 data bytes
64 bytes from 138.197.220.125: icmp_seq=0 ttl=51 time=154.269 ms
64 bytes from 138.197.220.125: icmp_seq=1 ttl=51 time=153.722 ms
64 bytes from 138.197.220.125: icmp_seq=2 ttl=51 time=153.646 ms
64 bytes from 138.197.220.125: icmp_seq=3 ttl=51 time=153.907 ms
64 bytes from 138.197.220.125: icmp_seq=4 ttl=51 time=153.740 ms
64 bytes from 138.197.220.125: icmp_seq=5 ttl=51 time=152.701 ms
64 bytes from 138.197.220.125: icmp_seq=6 ttl=51 time=153.862 ms


在HK的机器好一点点 

DigitalOcean 选择 Region 的问题?


Digitalocean哪个机房快和稳定


https://digitalocean.youhuima.cc/

这些不错, 过有点小贵 http://www.ehostidc.cn

国内到韩国的网络线路,应该是最好的,甚至可以媲美中国国内的双线机房。

北京联通 ping zyan.cc:
root@linaro-alip:~# ping zyan.cc
PING zyan.cc (27.255.71.186) 56(84) bytes of data.
64 bytes from 27.255.71.186: icmp_req=1 ttl=50 time=68.3 ms

aws and cloud.google

防火墙配置

GCE 默认开启了防火墙且不能关闭,只能允许你自己指定的协议和端口的流量;经过我自己的实际测试,GCE 能够自动过滤相当的 DDOS 攻击流量。

由于防火墙不能关闭,所以不能配置类似 IPv6 Tunnel 的服务,所以导致目前的 GCE 是不能够支持 IPv6 的,不过相信以后 Google 还是会启用 IPv6 支持。

在 “网络” 里,可以找到 防火墙规则,然后可以 添加防火墙规则

默认已经允许了 SSH 和 ICMP 等(以 default 开头的)

Billing

2018年 04月 30日 星期一 就算为5月一号 $10

2018年 09月 03日 星期一 10:18:48 CST $10 就是 70+70 rmb

2018年 11月 02日 2019年 01月 02日 星期三 2019年3.1 5.1给10刀 Mon Jul 1 13:37:10 UTC 2019

2019年 9月 1日 星期日 13时19分13秒 CST 只先给了5刀

Wed 06 Nov 2019 digita $3.33 Remaining

用了 $7.36 应该可以到12月才 给钱

2019年12月 1日


2020年 1月28日 星期二 digio 5刀 ; vultr没理

ec2

aws web用firefox打开 不然好慢

google

cloud.google.com

2019.02.06 过期

SEE ALSO

Google Compute Engine 新手教程

国外 VPS 购买列表


亚马逊EC2收费笔记

连接到 Linux 实例

Google Compute Engine 价格