Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一台VPS多个IP,VLESS+TCP+XTLS怎么配置多入口和多出口?下面这个配置一直无法重启,怎么排查? #49

Closed
sky-chy opened this issue Dec 21, 2021 · 9 comments

Comments

@sky-chy
Copy link

sky-chy commented Dec 21, 2021

{
  "inbounds": [
    {
      "port": 443,
      "listen": "104.168.134.33",
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "4sfr7wyh-xd01-5lsr-l7s2-47hji8uxy9fw",
            "flow": "xtls-rprx-direct",
            "level": 0
          }
        ],
        "decryption": "none",
        "fallbacks": [
          {
            "alpn": "http/1.1",
            "dest": 80
          },
          {
            "alpn": "h2",
            "dest": 81
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "xtls",
        "xtlsSettings": {
          "serverName": "xxx.chyblog.cn",
          "alpn": [
            "http/1.1",
            "h2"
          ],
          "certificates": [
            {
              "certificateFile": "/usr/local/etc/xray/xxx.chyblog.cn.pem",
              "keyFile": "/usr/local/etc/xray/xxx.chyblog.cn.key"
            }
          ]
        }
      },
      "tag": "10416813433-in"
    },
    {
      "port": 443,
      "listen": "104.168.143.206",
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "c8zxteq0-nsoj-gji5-ma5f-fjgr1esuyovb",
            "flow": "xtls-rprx-direct",
            "level": 0
          }
        ],
        "decryption": "none",
        "fallbacks": [
          {
            "alpn": "http/1.1",
            "dest": 80
          },
          {
            "alpn": "h2",
            "dest": 81
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "xtls",
        "xtlsSettings": {
          "serverName": "xxx.chyblog.cn",
          "alpn": [
            "http/1.1",
            "h2"
          ],
          "certificates": [
            {
              "certificateFile": "/usr/local/etc/xray/xxx.chyblog.cn.pem",
              "keyFile": "/usr/local/etc/xray/xxx.chyblog.cn.key"
            }
          ]
        }
      },
      "tag": "104168143206-in"
    }
  ],
  "routing": {
    "rules": [
      {
        "type": "field",
        "inboundTag": "10416813433-in",
        "outboundTag": "10416813433-out"
      },
      {
        "type": "field",
        "inboundTag": "104168143206-in",
        "outboundTag": "104168143206-out"
      }
    ]
  },
  "outbounds": [
    {
      "sendThrough": "104.168.134.33",
      "protocol": "freedom",
      "settings": {
        "domainStrategy": "UseIP"
      },
      "tag": "10416813433-out"
    },
    {
      "sendThrough": "104.168.143.206",
      "protocol": "freedom",
      "settings": {
        "domainStrategy": "UseIP"
      },
      "tag": "104168143206-out"
    }
  ]
}

systemctl错误如下:

# systemctl status xray
● xray.service - Xray Service
     Loaded: loaded (/etc/systemd/system/xray.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2021-12-21 17:16:33 CST; 2min 23s ago
       Docs: https://github.com/xtls
             https://hijk.art
    Process: 152806 ExecStart=/usr/local/bin/xray run -config /usr/local/etc/xray/config.json (code=exited, status=23)
   Main PID: 152806 (code=exited, status=23)

Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com systemd[1]: Started Xray Service.
Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com xray[152806]: Xray 1.5.0 (Xray, Penetrates Everything.) Custom (go1.17.2 linux/amd64)
Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com xray[152806]: A unified platform for anti-censorship.
Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com xray[152806]: 2021/12/21 17:16:33 [Info] infra/conf/serial: Reading config: /usr/local/etc/xray/con>
Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com xray[152806]: Failed to start: main: failed to load config files: [/usr/local/etc/xray/config.json]>
Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com systemd[1]: xray.service: Main process exited, code=exited, status=23/n/a
Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com systemd[1]: xray.service: Failed with result 'exit-code'.

日志文件的记录如下:

Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com systemd[1]: Started Xray Service.
-- Subject: A start job for unit xray.service has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit xray.service has finished successfully.
-- 
-- The job identifier is 3607.
Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com xray[152806]: Xray 1.5.0 (Xray, Penetrates Everything.) Custom (go1.17.2 linux/amd64)
Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com xray[152806]: A unified platform for anti-censorship.
Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com xray[152806]: 2021/12/21 17:16:33 [Info] infra/conf/serial: Reading config: /usr/local/etc/xray/config.json
Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com xray[152806]: Failed to start: main: failed to load config files: [/usr/local/etc/xray/config.json] > encoding/hex: invalid byte: U+006E 'n'
Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com systemd[1]: xray.service: Main process exited, code=exited, status=23/n/a
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit xray.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 23.
Dec 21 17:16:33 hwsrv-917454.hostwindsdns.com systemd[1]: xray.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit xray.service has entered the 'failed' state with result 'exit-code'.

我只看到[/usr/local/etc/xray/config.json] > encoding/hex: invalid byte: U+006E 'n',请问一下,这种错误要怎么排查?

@sky-chy
Copy link
Author

sky-chy commented Dec 21, 2021

初步排查到是inbounds[settings][clients]中的id有问题,难道这个id有一定的规则?

@sky-chy
Copy link
Author

sky-chy commented Dec 21, 2021

最终根据以下网址确定确实是ID的问题

https://xtls.github.io/config/inbounds/vless.html#clientobject

XTLS/Xray-core#158

@rianwg
Copy link

rianwg commented Jan 7, 2022

帅哥,后来你怎么解决的,方便给个QQ或者微信什么的吗..

@sky-chy
Copy link
Author

sky-chy commented Jan 7, 2022

帅哥,后来你怎么解决的,方便给个QQ或者微信什么的吗..

我的问题就是出在clients的id那里,那个id需要遵循UUIDv5的标准去生成了,但是不知道你的ID是不是自己随便写的?

@sky-chy
Copy link
Author

sky-chy commented Jan 7, 2022

帅哥,后来你怎么解决的,方便给个QQ或者微信什么的吗..

如果你的id是确定没问题的,直接照搬我上面那份文件,修改port、listen、serverName、certificates和tag下面的内容,
然后你有多少个IP,就写多少个inbounds节点和outbounds节点,然后把ip都替换到listen那里,
最后在routing的rules对它们两两绑定就好了

我上面那个配置是vless+xtls+tcp的配置

@rianwg
Copy link

rianwg commented Jan 11, 2022

用的是一健安装脚本,这样运行不了.
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbounds": [
{
"port": 31080,
"listen":"156.226.00.00",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "30f44380-f373-42c3-90f6-f9bea054dcb6",
"level": 1,
"alterId": 0
}
]
},
"streamSettings": {
"network": "tcp"
},
"tag": "164-in"
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
,
{
"port": 31081,
"listen":"156.253.00.00",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "30f44380-f373-42c3-90f6-f9bea054dcb7",
"level": 1,
"alterId": 0
}
]
},
"streamSettings": {
"network": "tcp"
},
"tag": "59-in"
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
},

    "routing":{
    "rules":[
        {
            "type":"field",
            "inboundTag":"164-in",
            "outboundTag":"164-out"
        },
        {
            "type":"field",
            "inboundTag":"59-in",
            "outboundTag":"59-out"
        },
    ]
},

"outbounds": [
	{
		"sendThrough":"156.226.00.000",
		"protocol": "freedom",
		"settings": {},
		"tag": "164-out"
	},
	{
		"sendThrough":"156.253.00.00",
		"protocol": "freedom",
			"settings": {},
		"tag": "59-out"
	},	
	
	{
		"protocol": "blackhole",
		"settings": {},
		"tag": "blocked"
    },
	{
		"protocol": "mtproto",
		"settings": {},
		"tag": "tg-out"
	}

],
"dns": {
	"servers": [
		"https+local://8.8.8.8/dns-query",
		"8.8.8.8",
		"1.1.1.1",
		"localhost"
	]
},
"routing": {
	"domainStrategy": "IPOnDemand",	
	"rules": [
		{
			"type": "field",
			"ip": [
				"0.0.0.0/8",
				"10.0.0.0/8",
				"100.64.0.0/10",
				"127.0.0.0/8",
				"169.254.0.0/16",
				"172.16.0.0/12",
				"192.0.0.0/24",
				"192.0.2.0/24",
				"192.168.0.0/16",
				"198.18.0.0/15",
				"198.51.100.0/24",
				"203.0.113.0/24",
				"::1/128",
				"fc00::/7",
				"fe80::/10"
			],
			"outboundTag": "blocked"
		},
		{
			"type": "field",
			"inboundTag": ["tg-in"],
			"outboundTag": "tg-out"
		}
		,
		{
			"type": "field",
			"domain": [
				"domain:epochtimes.com",
				"domain:epochtimes.com.tw",
				"domain:epochtimes.fr",
				"domain:epochtimes.de",
				"domain:epochtimes.jp",

@sky-chy
Copy link
Author

sky-chy commented Jan 13, 2022

用的是一健安装脚本,这样运行不了. { "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "warning" }, "inbounds": [ { "port": 31080, "listen":"156.226.00.00", "protocol": "vmess", "settings": { "clients": [ { "id": "30f44380-f373-42c3-90f6-f9bea054dcb6", "level": 1, "alterId": 0 } ] }, "streamSettings": { "network": "tcp" }, "tag": "164-in" "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] } } , { "port": 31081, "listen":"156.253.00.00", "protocol": "vmess", "settings": { "clients": [ { "id": "30f44380-f373-42c3-90f6-f9bea054dcb7", "level": 1, "alterId": 0 } ] }, "streamSettings": { "network": "tcp" }, "tag": "59-in" "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] } },

    "routing":{
    "rules":[
        {
            "type":"field",
            "inboundTag":"164-in",
            "outboundTag":"164-out"
        },
        {
            "type":"field",
            "inboundTag":"59-in",
            "outboundTag":"59-out"
        },
    ]
},

"outbounds": [
	{
		"sendThrough":"156.226.00.000",
		"protocol": "freedom",
		"settings": {},
		"tag": "164-out"
	},
	{
		"sendThrough":"156.253.00.00",
		"protocol": "freedom",
			"settings": {},
		"tag": "59-out"
	},	
	
	{
		"protocol": "blackhole",
		"settings": {},
		"tag": "blocked"
    },
	{
		"protocol": "mtproto",
		"settings": {},
		"tag": "tg-out"
	}

],
"dns": {
	"servers": [
		"https+local://8.8.8.8/dns-query",
		"8.8.8.8",
		"1.1.1.1",
		"localhost"
	]
},
"routing": {
	"domainStrategy": "IPOnDemand",	
	"rules": [
		{
			"type": "field",
			"ip": [
				"0.0.0.0/8",
				"10.0.0.0/8",
				"100.64.0.0/10",
				"127.0.0.0/8",
				"169.254.0.0/16",
				"172.16.0.0/12",
				"192.0.0.0/24",
				"192.0.2.0/24",
				"192.168.0.0/16",
				"198.18.0.0/15",
				"198.51.100.0/24",
				"203.0.113.0/24",
				"::1/128",
				"fc00::/7",
				"fe80::/10"
			],
			"outboundTag": "blocked"
		},
		{
			"type": "field",
			"inboundTag": ["tg-in"],
			"outboundTag": "tg-out"
		}
		,
		{
			"type": "field",
			"domain": [
				"domain:epochtimes.com",
				"domain:epochtimes.com.tw",
				"domain:epochtimes.fr",
				"domain:epochtimes.de",
				"domain:epochtimes.jp",

你这个我看着好乱啊,不过,有类似“156.226.00.00”这些IP的吗?恕我孤陋寡闻了,你看看日志里面报什么错吧,盲猜不一定正确

@ojdev
Copy link

ojdev commented Jun 24, 2022

的确你的Id是不对的,这个地方是Guid也叫UUID,里面的字符只能是0到9和A到F不区分大小写是16进制数字,其他的都是无效的。

@yuhan6665
Copy link
Member

close as solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants