東川印記

一本東川,笑看爭龍斗虎;寰茫兦者,度橫佰昧人生。

oracle上 ubuntu20 架 docker tomcat9 & v2ray4

2022年3月16日星期三



前面建了centos

再研究研究ubuntu

直接创建,这次创建就没有转圈很久,很顺利的打开了页面

然后选ubuntu

复用了之前的网络设置,直接创建成功,ssh登录。

然后发现没有ipv6地址,创建的时候找了半天也没有启用ipv6的选项,看来还得手动添加上。。。。

因为是复用了存在的网络设置,所以步骤上省了很多事。。。。

只需要 实例 -> 实例详细信息 -> 附加的VNIC -> VNIC详细信息 -> IPv6 -> 分配就好了。。。。



然后在ssh 里直接就有了 ipv6地址

ubuntu@instance-2nd:~$ ping6 google.com
PING google.com(nrt12s22-in-x0e.1e100.net (2404:6800:4004:80c::200e)) 56 data bytes
64 bytes from nrt12s22-in-x0e.1e100.net (2404:6800:4004:80c::200e): icmp_seq=1 ttl=59 time=34.7 ms
64 bytes from nrt12s22-in-x0e.1e100.net (2404:6800:4004:80c::200e): icmp_seq=2 ttl=59 time=33.9 ms

--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 33.859/34.255/34.651/0.396 ms
ubuntu@instance-2nd:~$


然后,部署docker网站,配置域名解析指向

设置docker 开机自启

ubuntu@instance-2nd:~$ sudo systemctl enable docker
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker
ubuntu@instance-2nd:~$ sudo systemctl status

设置docker里的容器自启动

ubuntu@instance-2nd:~$ docker update --restart=always 3a70c2adeec3(这是容器名或者容器ID)
3a70c2adeec3
ubuntu@instance-2nd:~$

restart 后 自动启动。。。。


研究了半天gost + shadowsocks,最终改折腾v2ray....

以前shadowsocks的文档一大堆,现在变成v2ray的文档一大堆了。。。。

源码 github.com/v2fly/v2ray-core

官方介绍 www.v2fly.org

编写一个config.json

ubuntu@instance-2nd:~$ pwd
/home/ubuntu
ubuntu@instance-2nd:~$ cat v2/config.json
{
    "inbounds": [
        {
            "port": 1734, // 服务器监听端口
            "protocol": "vmess",
            "settings": {
                "clients": [
                    {
                        "id": "3bbb2a16-80e9-40e5-xxxx-xxxxxxxxxxxx"
                    }
                ]
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom"
        }
    ]
}ubuntu@instance-2nd:~$

安装docker版 v2ray

ubuntu@instance-2nd:~$ docker pull v2fly/v2fly-core

ubuntu@instance-2nd:~$ sudo docker run -d --name v2ray -v /home/ubuntu/v2:/etc/v2ray -p 1734:1734 v2fly/v2fly-core v2ray -config=/etc/v2ray/config.json
ba7facdd14c781ba432494117d74c86fecaa899e0942e6e0a80e650bf792548e
ubuntu@instance-2nd:~$ docker ps
CONTAINER ID   IMAGE                        COMMAND                  CREATED         STATUS             PORTS                                       NAMES
ba7facdd14c7   v2fly/v2fly-core             "v2ray -config=/etc/…"   5 seconds ago   Up 3 seconds       0.0.0.0:1734->1734/tcp, :::1734->1734/tcp   v2ray
3a70c2adeec3   dcjz/tomcat-clock:df-clock   "catalina.sh run"        2 hours ago     Up About an hour   0.0.0.0:1740->8080/tcp, :::1740->8080/tcp   tomcat-clock
ubuntu@instance-2nd:~$ sudo docker container logs v2ray
V2Ray 4.44.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.17.3 linux/amd64)
A unified platform for anti-censorship.
2022/03/11 10:21:43 [Info] main/jsonem: Reading config: /etc/v2ray/config.json
2022/03/11 10:21:43 [Warning] V2Ray 4.44.0 started
ubuntu@instance-2nd:~$

本地客户端连接不上。。。。

ubuntu@instance-2nd:~$ docker exec -it ba7facdd14c7 /bin/sh

~ # cat /etc/v2ray/config.json

~ # uname -a
Linux ba7facdd14c7 5.11.0-1028-oracle #31~20.04.1-Ubuntu SMP Wed Jan 26 14:17:34 UTC 2022 x86_64 Linux

~ # v2ray -version
V2Ray 4.44.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.17.3 linux/amd64)
A unified platform for anti-censorship.

~ # v2ray --test --config /etc/v2ray/config.json
V2Ray 4.44.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.17.3 linux/amd64)
A unified platform for anti-censorship.
2022/03/11 10:51:08 [Info] main/jsonem: Reading config: /etc/v2ray/config.json
Configuration OK.
~ #


一直不行,增加日志配置重建试试

{
   "log":{
      "access":"/var/log/v2ray/access.log",
      "error":"/var/log/v2ray/error.log",
      "loglevel":"info"
   },
   "inbounds":[
      {
         "port":1734,
         "protocol":"vmess",
         "settings":{
            "clients":[
               {
                  "id":"3bbb2a16-80e9-40e5-xxxx-xxxxxxxxxxxx",
                  "level":1,
                  "alterId":64
               }
            ]
         }
      }
   ],
   "outbounds":[
      {
         "protocol":"freedom",
         "settings":{
            
         }
      }
   ]
}

新建一个带日志的

ubuntu@instance-2nd:~$ docker run --name=v2ray01 --net=host -v /home/ubuntu/v2/config.json:/etc/v2ray/config.json -v /home/ubuntu/v2/log:/var/log/v2ray -i -t -d  v2fly/v2fly-core:latest
6fe5f0dd39981951874fa999400d97810db7bbbc48521170eb387028d30e6611
ubuntu@instance-2nd:~$

难道是ip问题

#  netstat -apn | grep v2ray
tcp        0      0 :::1734                 :::*                    LISTEN      1/v2ray
~ #

root@instance-2nd:/home/ubuntu# ufw status verbose
Status: inactive
root@instance-2nd:/home/ubuntu# netstat -apn | grep v2ray
tcp6       0      0 :::1734                 :::*                    LISTEN      34996/v2ray         
root@instance-2nd:/home/ubuntu#

对比同样是docker的1740端口服务

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 0.0.0.0:1740            0.0.0.0:*               LISTEN      1128/docker-proxy  
tcp6       0      0 :::1734                 :::*                    LISTEN      34996/v2ray         
tcp6       0      0 :::1740                 :::*                    LISTEN      1133/docker-proxy

跑到Oracle后台删了ipv6地址试试。。。。

删了ipv6一样的效果,启动了之前那个v2ray发现1734的两个地址都是存在的。。。。

启动了之前的v2ray变成了

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:1734            0.0.0.0:*               LISTEN      1572/docker-proxy   
tcp        0      0 0.0.0.0:1740            0.0.0.0:*               LISTEN      1149/docker-proxy   
tcp6       0      0 :::1734                 :::*                    LISTEN      1578/docker-proxy   
tcp6       0      0 :::1740                 :::*                    LISTEN      1155/docker-proxy

然后进入docker,发现地址是有连接的。。。。

~ # netstat -apn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 :::1734                 :::*                    LISTEN      1/v2ray
tcp        0      0 ::ffff:172.17.0.3:1734  ::ffff:117.107.1.1:47198 ESTABLISHED 1/v2ray
tcp        0      0 ::ffff:172.17.0.3:1734  ::ffff:117.107.1.1:47202 ESTABLISHED 1/v2ray
tcp        0      0 ::ffff:172.17.0.3:1734  ::ffff:117.107.1.1:47206 ESTABLISHED 1/v2ray
tcp        0      0 ::ffff:172.17.0.3:1734  ::ffff:117.107.1.1:47194 ESTABLISHED 1/v2ray
tcp        0      0 ::ffff:172.17.0.3:1734  ::ffff:117.107.1.1:54630 ESTABLISHED 1/v2ray
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node PID/Program name    Path
~ #


netstat 状态

CLOSED:无连接是活动的或正在进行
LISTEN:服务器在等待进入呼叫
SYN_RECV:一个连接请求已经到达,等待确认
SYN_SENT:应用已经开始,打开一个连接
ESTABLISHED:正常数据传输状态
FIN_WAIT1:应用说它已经完成
FIN_WAIT2:另一边已同意释放
ITMED_WAIT:等待所有分组死掉
CLOSING:两边同时尝试关闭
TIME_WAIT表示处理完毕,等待超时结束的请求数。
LAST_ACK:等待所有分组死掉

证书签署 cerbot



--
senRsl
2022年03月11日16:11:08

没有评论 :

发表评论