月度归档:2020年04月

IPv6 ONLY VPS访问IPv4资源

DNS64是与NAT64搭配使用的,原理很简单,修改你的DNS到DNS64提供者的DNS,当你发出向解析到IPv4的域名的请求后,DNS会将IPv4地址按照一定格式嵌入IPv6地址中;这个返回IPv6地址会指向NAT64的服务器,NAT64网关会按照它包含的信息获取IPv4的数据并转发给你,这样一来你就能够直接访问IPv4的网站了。

提供DNS64的服务商很多,比如谷歌等,但是它们并不提供配套的NAT64,需要你自己在内网搭建一个NAT64网关。当然欧洲有一些公益组织提供免费的DNS64+NAT64服务,比如下面这两个。

方式一:DNS64

# http://www.trex.fi/2011/dns64.html
nameserver 2001:67c:2b0::4
nameserver 2001:67c:2b0::6

# https://go6lab.si/current-ipv6-tests/nat64dns64-public-test/
nameserver 2001:67c:27e4:15::6411
nameserver 2001:67c:27e4::64

# https://nat64.level66.network
nameserver 2a09:11c0:f1:bbf0::70

一般修改/etc/resolv.confnamesever值即可,不过部分系统想要永久修改需要编辑一些其他的参数,大家就自行查阅资料吧

DNS64的好处是配置十分方便,足以满足大部分的调试需求。当然弊端也十分明显,服务商会记录你三天的浏览记录以防止用于不法用途,且NAT64服务器到你的服务器速度未必非常理想。

方式二:代理

选择一个IPv4/IPv6双栈的VPS,安装上代理程序,并在本地指向代理,那么就可以通过这个跳板访问IPv4的网站了。

如果你实在没有双栈的VPS,可以参考这一篇给自己有IPv4的VPS加个Tunnel

配置服务端

笔者在这里选的是V2ray(点击前往),服务端的安装不再赘述,为了性能考虑默认的TCP传输即可,服务端无需过多配置


配置客户端

客户端由于是纯IPv6安装,手动的就不细讲了,把安装脚本脚本下载的代码删掉,去GitHub下载对应的软件包放在/tmp/v2ray/v2ray.zip运行脚本即可

最简单的当然是临时改一下DNS64装一下不就得了

编辑/etc/v2ray/config.json,按照你的服务端修改一下配置信息重启v2ray即可(其他的加密方式你看着inbound改就是了)

{
  "log":{},
  "dns":{},
  "stats":{},
  "inbounds":[
    {
      "port":"1081",     //HTTP方式监听本地1081端口
      "protocol":"http",
      "settings":{},
      "tag":"in-0"
    }
  ],
  "outbounds":[
    {
      "protocol":"vmess",
      "settings":{
        "vnext":[
          {
            "address":"2001:2001::1",                      //服务端IP()
            "port":2333,                                   //服务端端口
            "users":[
              {
                "id":"1c07df9c-xxxx-xxxx-xxxx-xxxxxxxxxxxx", //验证身份的UUID
                "alterId":64
              }
            ]
          }
        ]
      },
      "tag":"out-0",
      "streamSettings":{
        "network":"tcp",
        "security":"none",
        "tcpSettings":{}
      }
    },
    {
      "tag":"direct",
      "protocol":"freedom",
      "settings":{}
    },
    {
      "tag":"blocked",
      "protocol":"blackhole",
      "settings":{}
    }
  ],
  "routing":{
    "domainStrategy":"IPOnDemand",
    "rules":[
      {
        "type":"field",
        "ip":[
          "geoip:private"
        ],
        "outboundTag":"direct"
      }
    ]
  },
  "policy":{},
  "reverse":{},
  "transport":{}
}

系统指向本地HTTP代理

编辑/etc/profile.d/v2.sh,将以下变量指向http代理Shell

export proxy="127.0.0.1:1081"
export http_proxy=$proxy
export https_proxy=$proxy
export no_proxy="archive.ubuntu.com, 127.0.0.1, ::1"

如果不需要代理了可以直接rm -rf /etc/profile.d/v2.sh,重启即可。no_proxy是指定不通过代理的,因为镜像站支持IPv6没必要走代理,我就加进去了,有需求自己加就行了。


当然这种方式也是只代理了HTTP和HTTPS请求

2a04:4e42::133 assets-cdn.github.com
2a04:4e42::133 camo.githubusercontent.com
2a04:4e42::133 cloud.githubusercontent.com
2a04:4e42::133 gist.githubusercontent.com
2a04:4e42::133 avatars.githubusercontent.com
2a04:4e42::133 avatars0.githubusercontent.com
2a04:4e42::133 avatars1.githubusercontent.com
2a04:4e42::133 avatars2.githubusercontent.com
2a04:4e42::133 avatars3.githubusercontent.com
2a04:4e42::133 marketplace-images.githubusercontent.com
2a04:4e42::133 user-images.githubusercontent.com
2a04:4e42::133 raw.githubusercontent.com

2606:4700::6810:1723 registry.npmjs.org

Https://mirror.freepbx.org is not working

From the command line I’ve tried this.

fwconsole setting MODULE_REPO https://mirror.freepbx.org
##Changing "MODULE_REPO" from [https://mirror.freepbx.org] to [https://mirror.freepbx.org]

Then tried updating the module

fwconsole ma -R https://mirror.freepbx.org upgrade framework
Getting Remote Repo list...Done
No such repo: [https://mirror.freepbx.org], skipping
No repos specified, using: [commercial,standard,extended] from last GUI settings

Starting framework download..
The following error(s) occured:
 - Retrieved Module XML Was Empty
fwconsole setting MODULE_REPO http://asterisk.thapana.ga

Changing “MODULE_REPO” from [https://mirror.freepbx.org] to [http://asterisk.thapana.ga]

fwconsole setting MODULE_REPO http://mirror1.freepbx.org,http://mirror2.freepbx.org

wordpress隐藏文章的部分内容,需要注册登录网站后可见

这种方式适合VIP会员,会员要注册登录才能访问,而注册需要邀请码,可以出售邀请码,就变成了VIP会员可以访问隐藏的内容。

// 添加只允许登录后查看  
 
add_shortcode( 'members_only', 'members_only_shortcode' );
 
function members_only_shortcode( $atts, $content = null ) {
 
if ( is_user_logged_in() && !empty( $content ) && !is_feed() )    {
 
return $content;
 
}
 
$a= '<center><span>
<div style="text-align:center;border:1px dashed #FF9A9A;padding:8px;margin:10px auto;color:green;">要查看更多文章内容,请您先<a href="http://daaa.ga/wp-login.php" target="_blank">登录/注册</a>
</div>
</span></center>';
 
return $a;
 
}

在主题模板函数 functions.php的<?php下边添加代码实现。

[members_only]

这里的内容只为已登录的用户显示的

[/members_only]

How To Fix ERR_SSL_VERSION_INTERFERENCE Chrome Error

Pro Tip – Disable TLS 1.3

Disabling TLS 1.3 in Chrome can also be a savior if you are getting ERR_SSL_VERSION_INTERFERENCE error while accessing a website. Here are the steps to do so:

Step 1: Open a new tab in Chrome, and in the address bar, type chrome://flags/ and press Enter key. This will open the flags options in Chrome.

Step 2: Now, in the flag search box, type TLS. You will get the TLS 1.3 option on the screen. From its dropdown menu, which would be set to Default, select the Disable option. As soon as you select the option, you will get the Relaunch Now option on screen to restart Chrome; click on it.