亚马逊EC2添加多网卡络接口*多IP,及x-ui端口分流设置教程

本教程采用aws的ec2服务器,添加多个网络接口,配置多个IP,并利用x-ui实现不同端口访问不同的落地IP。

详细视频教程在YouTube频道:https://youtu.be/fzOtQG3SNuo

这里是一键添加IP到不同网卡到脚本,请修改自己的内网IP和网络接口,不要用公网IP。

echo -e '[Unit]
Description=Add multiple IP addresses to network interfaces at startup
After=network.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c "ip addr add 172.31.166.50/20  dev ens5; \
ip addr add 172.31.166.60/20  dev ens5; \
ip addr add 172.31.166.70/20  dev ens5; \
ip addr add 172.31.166.80/20  dev ens5; \
ip addr add 172.31.166.90/20  dev ens5; \
\
ip addr add 172.31.162.100/20 dev ens6; \
ip addr add 172.31.162.110/20 dev ens6; \
ip addr add 172.31.162.120/20 dev ens6; \
ip addr add 172.31.162.130/20 dev ens6; \
ip addr add 172.31.162.140/20 dev ens6; \
\
ip addr add 172.31.167.100/20 dev ens7; \
ip addr add 172.31.167.110/20 dev ens7; \
ip addr add 172.31.167.120/20 dev ens7; \
ip addr add 172.31.167.130/20 dev ens7; \
ip addr add 172.31.167.140/20 dev ens7;"
RemainAfterExit=true

[Install]
WantedBy=multi-user.target' > /etc/systemd/system/add-multiple-ips.service && \
systemctl enable add-multiple-ips.service && \
systemctl start add-multiple-ips.service

下面是安装x-ui以后的配置文件,按自己的IP个数需求修改内网IP和端口。

{
  "api": {
    "services": [
      "HandlerService",
      "LoggerService",
      "StatsService"
    ],
    "tag": "api"
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 62789,
      "protocol": "dokodemo-door",
      "settings": {
        "address": "127.0.0.1"
      },
      "tag": "api"
    }
  ],

  "outbounds": [
   {
      "tag": "ip1",
      "sendThrough": "172.31.4.185",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "ip2",
      "sendThrough": "172.31.4.100",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "ip3",
      "sendThrough": "172.31.4.110",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "ip4",
      "sendThrough": "172.31.0.51",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "ip5",
      "sendThrough": "172.31.0.60",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "ip6",
      "sendThrough": "172.31.11.36",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "ip7",
      "sendThrough": "172.31.11.50",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "protocol": "freedom",
      "settings": {}
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "policy": {
    "system": {
      "statsInboundDownlink": true,
      "statsInboundUplink": true
    }
  },

  "routing": {
    "rules": [
   {
        "inboundTag": [
          "Inbound-20001","inbound-20001"
        ],
        "outboundTag": "ip1",
        "type": "field"
      },
      {
        "inboundTag": [
          "Inbound-20002","inbound-20002"
        ],
        "outboundTag": "ip2",
        "type": "field"
      },
      {
        "inboundTag": [
          "Inbound-20003","inbound-20003"
        ],
        "outboundTag": "ip3",
        "type": "field"
      },
      {
        "inboundTag": [
          "Inbound-20004","inbound-20004"
        ],
        "outboundTag": "ip4",
        "type": "field"
      },
      {
        "inboundTag": [
          "Inbound-20005","inbound-20005"
        ],
        "outboundTag": "ip5",
        "type": "field"
      },
      {
        "inboundTag": [
          "Inbound-20006","inbound-20006"
        ],
        "outboundTag": "ip6",
        "type": "field"
      },
      {
        "inboundTag": [
          "Inbound-20007","inbound-20007"
        ],
        "outboundTag": "ip7",
        "type": "field"
      },
      {
        "inboundTag": [
          "api"
        ],
        "outboundTag": "api",
        "type": "field"
      },
      {
        "ip": [
          "geoip:private"
        ],
        "outboundTag": "blocked",
        "type": "field"
      },
      {
        "outboundTag": "blocked",
        "protocol": [
          "bittorrent"
        ],
        "type": "field"
      }
    ]
  },
  "stats": {}
}

以上脚本请结合视频仔细设置,白嫖不要来问我

付费搭建500rmb/80USDT一次,wavelength的5G住宅18个IP一次1000RMB/150USDT。不接受勿扰,很忙。付费添加微信:809086699或者电报:@imbaoge

© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容