概要
用xray做内网穿透
配置
带公网ip的机器上如此配置xray
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"reverse": {
"portals": [
{
"tag": "portal",
"domain": "test.ailitonia.com"
}
]
},
"inbounds": [
{
"tag": "device1", // 内网设备1
"port": 5001, // 访问端口
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1", // 内网ip
"port": 80, // 设备开放端口
"network": "tcp"
}
},
{
"tag": "device2", // 内网设备2
"port": 5002,
"protocol": "dokodemo-door",
"settings": {
"address": "192.168.1.100",
"port": 80,
"network": "tcp"
}
},
{
"tag": "device3", // 内网设备3
"port": 5003,
"protocol": "dokodemo-door",
"settings": {
"address": "192.168.1.200",
"port": 21,
"network": "tcp"
}
},
{
"port": 4096,
"tag": "interconn",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "134b53ca-b0cc-44a7-a28f-4214842c2fd6",
"alterId": 64
}
]
}
}
],
"routing": {
"rules": [
{
"type": "field",
"inboundTag": [ // 前面所有inbound的tag都要写
"device1",
"device2",
"device3"
],
"outboundTag": "portal"
},
{
"type": "field",
"inboundTag": [
"interconn"
],
"outboundTag": "portal"
}
]
}
}
家中某个莫得公网ip的机器上如此配置xray
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"reverse": {
"bridges": [
{
"tag": "bridge",
"domain": "test.ailitonia.com"
}
]
},
"outbounds": [
{
"tag": "bridgeout",
"protocol": "freedom"
},
{
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "portal的IP地址",
"port": 4096,
"users": [
{
"id": "134b53ca-b0cc-44a7-a28f-4214842c2fd6",
"alterId": 64
}
]
}
]
},
"tag": "interconn"
}
],
"routing": {
"rules": [
{
"type": "field",
"inboundTag": [
"bridge"
],
"domain": [
"full:test.ailitonia.com"
],
"outboundTag": "interconn"
},
{
"type": "field",
"inboundTag": [
"bridge"
],
"outboundTag": "bridgeout"
}
]
}
}
interconn可以随便改其他的协议,实测cloudflare+caddy+xhttp是可行的
