MENU
月額300円から使えるゲームサーバー『Agames』がすごい!!(詳しくはここをクリック)

【マイクラ】簡単!BungeeCord/Velocityの建て方&設定方法【BungeeCord/Velocity/Watefall】

ゆるり

こんにちは、ゆるりです!!

今回は、BungeeCord/Velocity/Waterfallの設定方法について細かく紹介していきます。

もくじ

BungeeCord/Velocity/Waterfallとは

『BungeeCord/Velocity/Waterfall(以下中継サーバー)』とは、マイクラサーバー同士を連携することができるソフトウェアです。

中継サーバーを使うことにより「負荷の軽減」や「セキュリティー強化」することができます。

メリット・デメリット

中継サーバーを使うと以下のメリット・デメリットがあります。

メリットデメリット
複数のマイクラサーバーと連携することができる
負荷を分散することができる
サーバーのバージョンと異なっていても接続できる
セキュリティーの強化
高度な設定が必要(知識がないと難しい)

メリットが大きいのでマイクラサーバーをやる方は実装しておくと良いかもしれません。

中継サーバーの建て方

購入に悩んでいる方や記事の質問・要望などあればDiscordに書いてね!(回答するかも)

\サーバー作るのめんどくさい…できない…友達とすぐ遊びたい…こちらから!/
マイクラサーバー(Java/統合版)の構築やります 最短10分以内にマイクラサーバーを建てます!

準備

以下が必要になります。

  • メモリが2GB以上のWindows/VPS/レンタルサーバー
  • 接続するマイクラサーバー
  • Java8以上

中継サーバーは1GBだとメモリが足りず不安定になりやすいため2GB以上推奨です。

\ おすすめVPSはこちらから! /

ゲームサーバー特徴

Xserver VPS(国内最安水準/コスパNo.1)
性能コスパ No.1
Xserver VPS
月額830円から使える!
Minecraftサーバーを5分で作れる!
決済方法が豊富

\ Agamesを詳しく知りたい? /


Conoha VPS(最大1か月無料)
信頼度 No.1
Conoha VPS
最大1か月無料で使える!
信頼度がNo.1(筆者度)
Minecraftサーバーを5分で作れる!

Conoha VPS の購入はこちらから /


Indigo VPS(国内最安297円~)
低価格 No.1
Indigo VPS
297円から使える!(国内最安)
NTTの子会社が運営している

\ Indigo VPS の購入はこちらから /

ソフトウェアのダウンロード・起動

先ほど紹介した中継サーバー(BungeeCord/Velocity/Waterfall)のダウンロード先が異なるので自分が使いたいソフトウェアを選択してダウンロードしてください。

筆者のおすすめは、Waterfallです。

中継サーバーはVPS/レンタルサーバーに置くことを推奨します。
理由としては色々ありますが、1番はDDoS攻撃などのサーバー攻撃を受けた際にプロバイダがネット回線を制限をかける可能性があるためです。

BungeeCordの場合

以下がBungeeCordのやり方です。

Windows

BungeeCord/Waterfallの場合
STEP
公式サイトにアクセスしてダウンロードしよう

以下のサイトにアクセスして、画像の「BungeeCord.jar」か「Waterfall.jar」をクリックしてダウンロードしましょう。

BungeeCord
Waterfall
STEP
フォルダーを作成し、起動

BungeeCord.jar」か「Waterfall???.jar」がダウンロード出来たら、どこかにフォルダーを作りその中に入れてください。

作成が完了したら、自分が選択したソフトウェアを以下から選択しダウンロードしてフォルダーに入れてください。

導入したら「run.bat」をダブルクリックし起動しましょう。

このファイルには以下のような事が書かれています。
個人的にメモリの256Mを自分のスペックで出せるメモリ容量に変えてください。(推奨は2GB以上です。)
(2GBを使用する場合は -Xms2G -Xmx2G または -Xms2048M -Xmx2048M )

※このコードはコピペしないでください!(ダウンロードしたものを使ってください。)※
==BungeeCord用==
@echo off //コンソールログを見やすくする
java -Xms256M -Xmx256M -jar BungeeCord.jar nogui //javaで最小/最大メモリを256MBで設定しBungeeCord.jarをGUIなし(コンソール)で起動する処理
pause //エラーが起きた場合に自動で終了しないようにする処理(キーを押さない限り消えない)

==Waterfall用==
@echo off
set KEYWORD=waterfall //検索キーワード
set FILE_NAME= //ファイル名

for /f "delims=" %%a in ('dir /b /a-d %KEYWORD%*.jar') do (
    set FILE_NAME=%%a //起動した場所の一覧を取得しキーワードが含む物+.jar が最後に付く物をチェックする処理
)

if not "%FILE_NAME%"=="" (
    java -Xms256M -Xmx256M -jar %FILE_NAME% nogui //上の処理でファイルが見つかれば起動する処理
)
pause

起動時に以下の警告が出たら「プライベートネットワーク」にチェックを入れ「アクセスを許可する」を選択

以下の表示が出たら一度バツを押して閉じてください。(Listening on/0.0.0.0:25577まで出ると成功)

Velocityの場合
STEP
公式サイトにアクセスしてダウンロードしよう

以下のサイトにアクセスして、画像の「Velocity」をクリックしてダウンロードしましょう。

STEP
フォルダーを作成し、起動

Velocity???.jar」がダウンロード出来たら、どこかにフォルダーを作りその中に入れてください。

作成が完了したら、自分が選択したソフトウェアを以下から選択しダウンロードしてフォルダーに入れてください。

導入したら「run.bat」をダブルクリックし起動しましょう。

以下の表示が出たら一度バツを押して閉じてください。(Doneまで出ると成功)

Linux(Ubuntu20.04を想定します)

結構上級者向けの為、難しい場合やできない場合はこちらをご検討ください。

購入に悩んでいる方や記事の質問・要望などあればDiscordに書いてね!(回答するかも)

\サーバー作るのめんどくさい…できない…友達とすぐ遊びたい…こちらから!/
マイクラサーバー(Java/統合版)の構築やります 最短10分以内にマイクラサーバーを建てます!
BungeeCord/Waterfallの場合
STEP
以下のリンクをコピーしよう

BungeeCordはそのまま右クリック→「リンクのコピー」で大丈夫です。
Waterfallは、コピーしてサイトにアクセスし青い場所で右クリック→「リンクのコピー」でできます。

STEP
フォルダー作成し、起動

以下のコマンドを入力(コピー)しファイルを生成しそのファイルに移動し、ファイルをダウンロードします。

==BungeeCord用==

mkdir /home/ubuntu/proxy && cd /home/ubuntu/proxy && wget https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar

ファイルのダウンロードが完了したら以下のコマンドを入力します。

java -jar BungeeCord.jar

==Waterfall用==

mkdir /home/ubuntu/proxy && cd /home/ubuntu/proxy && wget waterfallでコピーしたリンク -O Waterfall.jar

ファイルのダウンロードが完了したら以下のコマンドを入力します。

java -jar Waterfall.jar

以下の表示が出たら一度「Ctrl+C」を押して閉じてください。(Listening on/0.0.0.0:25577まで出ると成功)

Velocityの場合
STEP
以下のリンクをコピーしよう

Waterfallは、コピーしてサイトにアクセスし青い場所で右クリック→「リンクのコピー」でできます。

STEP
フォルダー作成し、起動

以下のコマンドを入力(コピー)しファイルを生成しそのファイルに移動し、ファイルをダウンロードします。

mkdir /home/ubuntu/proxy && cd /home/ubuntu/proxy && wget velocityでコピーしたリンク -O velocity.jar

ファイルのダウンロードが完了したら以下のコマンドを入力します。

java -jar velocity.jar

以下の表示が出たら一度「Ctrl+C」を押して閉じてください。(Listening on/0.0.0.0:25577まで出ると成功)

中継サーバーの設定

BungeeCord/Waterfallの場合

BungeeCord/Waterfall」を起動すると「config.yml」が生成されていると思います。

Configファイルは以下の通りです。

config.yml(BungeeCord/Waterfall)※順番が変わっている可能性あり
enforce_secure_profile: false
listeners:
- query_port: 25577
  motd: '&1Another Bungee server'
  tab_list: GLOBAL_PING
  query_enabled: false
  proxy_protocol: false
  forced_hosts:
    pvp.md-5.net: pvp
  ping_passthrough: false
  priorities:
  - lobby
  bind_local_address: true
  host: 0.0.0.0:25577
  max_players: 1
  tab_size: 60
  force_default_server: false
remote_ping_cache: -1
network_compression_threshold: 256
permissions:
  default:
  - bungeecord.command.server
  - bungeecord.command.list
  admin:
  - bungeecord.command.alert
  - bungeecord.command.end
  - bungeecord.command.ip
  - bungeecord.command.reload
  - bungeecord.command.kick
log_pings: true
connection_throttle_limit: 3
server_connect_timeout: 5000
timeout: 30000
stats: 62bd3222-5568-4b78-94d0-0a958cc8ae8a
player_limit: -1
ip_forward: false
groups:
  md_5:
  - admin
remote_ping_timeout: 5000
connection_throttle: 4000
log_commands: false
prevent_proxy_connections: false
online_mode: true
forge_support: false
disabled_commands:
- disabledcommandhere
servers:
  lobby:
    motd: '&1Just another BungeeCord - Forced Host'
    address: localhost:25565
    restricted: false

Configの中の、以下の3つを変更します。

Listenerの設定 ※変更が必要なものだけ書きます。書いてないものは基本変更不要です。

listeners:
- query_port: 25577
  motd: '&1Another Bungee server'
  tab_list: GLOBAL_PING
  query_enabled: false
  proxy_protocol: false
  forced_hosts:
    pvp.md-5.net: pvp
  ping_passthrough: false
  priorities:
  - lobby
  bind_local_address: true
  host: 0.0.0.0:25577
  max_players: 1
  tab_size: 60
  force_default_server: false
名前説明
forced_hosts:Aドメインの割り振りの際にドメインが一致したらそのサーバーに飛ばす設定です。(数字IPの場合不要)
priorities:プレイヤーが初めて参加した際に、どのサーバーから接続するかを設定できます。(順番)
tab_list:[Tabキー]を押した際にプレイヤーの何を表示するかです。基本そのままで大丈夫です。
host:中継サーバーのアドレスです。IP:Portで設定する。 (このIPで中継サーバーに接続できます)
restricted:コマンドで移動する際(./serverなど)に権限が必要かどうかの設定(false:誰でも移動OK/true:権限あり)

Serversの設定

servers:
  lobby:
    motd: '&1Just another BungeeCord - Forced Host'
    address: localhost:25565
    restricted: false
名前説明
servers:サーバーの設定は以下からできるよ。という区切りです。(書き換えたらダメです)
lobby:サーバー管理名を”英語”で決めれます。。基本lobbyは書き換えないでください
motd:マルチプレイ画面に表示される文字を設定できます。(ただほぼ使われないので変更しなくて良い)
address:マイクラサーバー(Spigot/Paperなど)のアドレスです。IP:Portで設定する。
restricted:コマンドで移動する際(./serverなど)に権限が必要かどうかの設定(false:誰でも移動OK/true:権限あり)
servers: # 例です。
  lobby:
    motd: '&1Just another BungeeCord - Forced Host'
    address: localhost:25565
    restricted: false
  survival:
    motd: '&1Just another BungeeCord - Forced Host'
    address: localhost:25567
    restricted: false
  pvp:
    motd: '&1Just another BungeeCord - Forced Host'
    address: localhost:25560
    restricted: false

ip_forwardの設定

ip_forward」とは、プレイヤーのIPプレイヤー名でUUIDを生成してマイクラサーバーに飛ばすかどうかの設定です。
原則:true にしてください。(trueにしない場合は、プレイヤーのBANの処理やネーム変更された場合に問題が発生します)

ip_forward: true

全ての設定が完了したら保存して閉じましょう。

再度「run.bat」を起動し「host」(中継サーバーアドレス)で設定したIPアドレス+Portで接続できるか試してください。
servers:で設定したサーバー(lobbyなど)は、 ./server [サーバー名(例: /server lobby)] などで移動できます。

Velocityの場合

Velocity」を起動すると「velocity.toml」が生成されていると思います。

Configファイルは以下の通りです。

velocity.toml
# Config version. Do not change this
config-version = "2.6"

# What port should the proxy be bound to? By default, we'll bind to all addresses on port 25577.
bind = "0.0.0.0:25577"

# What should be the MOTD? This gets displayed when the player adds your server to
# their server list. Only MiniMessage format is accepted.
motd = "<#09add3>A Velocity Server"

# What should we display for the maximum number of players? (Velocity does not support a cap
# on the number of players online.)
show-max-players = 500

# Should we authenticate players with Mojang? By default, this is on.
online-mode = true

# Should the proxy enforce the new public key security standard? By default, this is on.
force-key-authentication = true

# If client's ISP/AS sent from this proxy is different from the one from Mojang's
# authentication server, the player is kicked. This disallows some VPN and proxy
# connections but is a weak form of protection.
prevent-client-proxy-connections = false

# Should we forward IP addresses and other data to backend servers?
# Available options:
# - "none":        No forwarding will be done. All players will appear to be connecting
#                  from the proxy and will have offline-mode UUIDs.
# - "legacy":      Forward player IPs and UUIDs in a BungeeCord-compatible format. Use this
#                  if you run servers using Minecraft 1.12 or lower.
# - "bungeeguard": Forward player IPs and UUIDs in a format supported by the BungeeGuard
#                  plugin. Use this if you run servers using Minecraft 1.12 or lower, and are
#                  unable to implement network level firewalling (on a shared host).
# - "modern":      Forward player IPs and UUIDs as part of the login process using
#                  Velocity's native forwarding. Only applicable for Minecraft 1.13 or higher.
player-info-forwarding-mode = "NONE"

# If you are using modern or BungeeGuard IP forwarding, configure a file that contains a unique secret here.
# The file is expected to be UTF-8 encoded and not empty.
forwarding-secret-file = "forwarding.secret"

# Announce whether or not your server supports Forge. If you run a modded server, we
# suggest turning this on.
# 
# If your network runs one modpack consistently, consider using ping-passthrough = "mods"
# instead for a nicer display in the server list.
announce-forge = false

# If enabled (default is false) and the proxy is in online mode, Velocity will kick
# any existing player who is online if a duplicate connection attempt is made.
kick-existing-players = false

# Should Velocity pass server list ping requests to a backend server?
# Available options:
# - "disabled":    No pass-through will be done. The velocity.toml and server-icon.png
#                  will determine the initial server list ping response.
# - "mods":        Passes only the mod list from your backend server into the response.
#                  The first server in your try list (or forced host) with a mod list will be
#                  used. If no backend servers can be contacted, Velocity won't display any
#                  mod information.
# - "description": Uses the description and mod list from the backend server. The first
#                  server in the try (or forced host) list that responds is used for the
#                  description and mod list.
# - "all":         Uses the backend server's response as the proxy response. The Velocity
#                  configuration is used if no servers could be contacted.
ping-passthrough = "DISABLED"

# If not enabled (default is true) player IP addresses will be replaced by <ip address withheld> in logs
enable-player-address-logging = true

[servers]
# Configure your servers here. Each key represents the server's name, and the value
# represents the IP address of the server to connect to.
lobby = "127.0.0.1:30066"
factions = "127.0.0.1:30067"
minigames = "127.0.0.1:30068"

# In what order we should try servers when a player logs in or is kicked from a server.
try = [
    "lobby"
]

[forced-hosts]
# Configure your forced hosts here.
"lobby.example.com" = [
    "lobby"
]
"factions.example.com" = [
    "factions"
]
"minigames.example.com" = [
    "minigames"
]

[advanced]
# How large a Minecraft packet has to be before we compress it. Setting this to zero will
# compress all packets, and setting it to -1 will disable compression entirely.
compression-threshold = 256

# How much compression should be done (from 0-9). The default is -1, which uses the
# default level of 6.
compression-level = -1

# How fast (in milliseconds) are clients allowed to connect after the last connection? By
# default, this is three seconds. Disable this by setting this to 0.
login-ratelimit = 3000

# Specify a custom timeout for connection timeouts here. The default is five seconds.
connection-timeout = 5000

# Specify a read timeout for connections here. The default is 30 seconds.
read-timeout = 30000

# Enables compatibility with HAProxy's PROXY protocol. If you don't know what this is for, then
# don't enable it.
haproxy-protocol = false

# Enables TCP fast open support on the proxy. Requires the proxy to run on Linux.
tcp-fast-open = false

# Enables BungeeCord plugin messaging channel support on Velocity.
bungee-plugin-message-channel = true

# Shows ping requests to the proxy from clients.
show-ping-requests = false

# By default, Velocity will attempt to gracefully handle situations where the user unexpectedly
# loses connection to the server without an explicit disconnect message by attempting to fall the
# user back, except in the case of read timeouts. BungeeCord will disconnect the user instead. You
# can disable this setting to use the BungeeCord behavior.
failover-on-unexpected-server-disconnect = true

# Declares the proxy commands to 1.13+ clients.
announce-proxy-commands = true

# Enables the logging of commands
log-command-executions = false

# Enables logging of player connections when connecting to the proxy, switching servers
# and disconnecting from the proxy.
log-player-connections = true

[query]
# Whether to enable responding to GameSpy 4 query responses or not.
enabled = false

# If query is enabled, on what port should the query protocol listen on?
port = 25577

# This is the map name that is reported to the query services.
map = "Velocity"

# Whether plugins should be shown in query response by default or not
show-plugins = false

velocity.tomlの中の、以下の4つを変更します。

bindの設定

bind」とは、中継サーバーのアドレスです。IP:Portで設定する。 (このIPで中継サーバーに接続できます)

# What port should the proxy be bound to? By default, we'll bind to all addresses on port 25577.
bind = "0.0.0.0:25577"

force-key-authentication の設定

force-key-authentication」とは、1.19で追加された機能でプレイヤーの鍵認証したユーザーのみ入れるかの設定です。
バージョンによって接続・できないが発生しやすいのは falseにしましょう。

# Should the proxy enforce the new public key security standard? By default, this is on.
force-key-authentication = false

player-info-forwarding-mode の設定

「player-info-forwarding-mode」とは、プレイヤーのIPアドレスやその他データをマイクラサーバーに転送するかどうかの設定です。
全サーバーバージョンが1.13未満だったら「legacy」それ以上+Paperの場合は「modern」に設定しましょう。
※この設定は、マイクラサーバー側に直接参加できる仕様を無効化する為にあるものです。(特定の条件下で直接接続してOP乗っ取りなど可能になります。)

player-info-forwarding-mode が 「modern」の場合

マイクラサーバー側のpaper.yml の「velocity-support: ‘コード’」を入力してください。
コードは「forwarding.secret」を開くと書いてあります。

# Should we forward IP addresses and other data to backend servers?
# Available options:
# - "none":        No forwarding will be done. All players will appear to be connecting
#                  from the proxy and will have offline-mode UUIDs.
# - "legacy":      Forward player IPs and UUIDs in a BungeeCord-compatible format. Use this
#                  if you run servers using Minecraft 1.12 or lower.
# - "bungeeguard": Forward player IPs and UUIDs in a format supported by the BungeeGuard
#                  plugin. Use this if you run servers using Minecraft 1.12 or lower, and are
#                  unable to implement network level firewalling (on a shared host).
# - "modern":      Forward player IPs and UUIDs as part of the login process using
#                  Velocity's native forwarding. Only applicable for Minecraft 1.13 or higher.
player-info-forwarding-mode = "legacy"

servers の設定

[servers]とは、マイクラサーバーの転送設定です。ここに設定されているサーバーに移動することができます。

[servers]
# Configure your servers here. Each key represents the server's name, and the value
# represents the IP address of the server to connect to.
lobby = "127.0.0.1:30066"
factions = "127.0.0.1:30067"
minigames = "127.0.0.1:30068"

全ての設定が完了したら保存して閉じましょう。

再度「run.bat」を起動し「bind」(中継サーバーアドレス)で設定したIPアドレス+Portで接続できるか試してください。
[servers]で設定したサーバー(lobbyなど)は、 ./server [サーバー名(例: /server lobby)] などで移動できます。

マイクラサーバー側の設定

マイクラサーバー側の設定は以下の2つです。

onlinemode の設定

online-mode」とは、参加してきたプレイヤーをMinecraft側がチェックして問題があれば参加できなくするかの設定です。
BungeeCord/Waterfall/Velocityの仕様上中継サーバーでチェックを行うため不要になります。(2重チェックはできません。)

server.properties」があるのでその中の「online-mode」を false に設定します。
※通常は trueでいいのですが、中継サーバーを経由する場合は falseにする必要があります。

online-mode=false

bungeecord の設定

bungeecord」とは、中継サーバーから来た参加者のプレイヤーIPをマイクラサーバー側にも転送する機能です。

spigot.yml」があるのでその中の「bungeecord」を false に設定します。
※通常は falseでいいのですが、中継サーバーを経由する場合は trueにする必要があります。

bungeecord: true

おまけ(BungeeGuardの紹介)

先ほど説明した中継サーバーですが、実は大きな問題が一つあります。

それは、マイクラサーバー側がオフラインになるということです。
図で見るとわかりやすいですが、この中継の仕組みを理解している人であれば、悪意のある第3者がマイクラサーバー側のIPさえ特定できれば、ウイルス中継を作られて繋げることも可能ということです。

実際に、私自身それによってOPを乗っ取られたりなりすまされた経験が何度かあります。

それを回避する方法を紹介していきます。

回避方法

回避方法としては以下の方法を取るのがベストです。

  • マイクラサーバー側のポートを開放しない。
  • 特定のIP以外の通信を遮断する。
  • BungeeGuardやVelocityのSecretキーで鍵が一致しているか確認する

マイクラサーバー側のポートを開放しない

中継サーバーとマイクラサーバーを一緒の場所に置く場合、ポート開放を中継サーバーのみにしておけばこの問題は起きません。(中継サーバー ⇔ 中継サーバー という接続は仕様的にできません。)

ただし、VPSやレンタルサーバーに中継サーバーを配置して、マイクラサーバーを中継サーバー以外に配置する場合はこの方法は使えません。

特定のIP以外の通信を遮断する

マイクラサーバーをVPS(Linux)などで建てている場合は、中継サーバーのIPだけをマイクラサーバーが置いてあるサーバーのファイアウォールにホワイトリスト登録してそれ以外のIPは遮断すると、この問題は起きません。

プレイヤーも参加できなくなるんじゃないの?という意見もあるかとは思いますが、中継サーバーがマイクラサーバーにプレイヤーのデータ(IP/プレイヤー情報)を送っているだけなので、中継サーバーIPのホワイトリスト登録するだけでOKです。

ただし、ゲームサーバーのみ提供しているサービスや中継サーバー自体のパソコンの権限がないとこの方法は使えません。

BungeeGuardやVelocityのSecretキーで鍵が一致しているか確認する

中継サーバーのプラグインでBungeeGuardというものがありますが、これを使うと中継サーバーとマイクラサーバーの鍵が互いにあっているかをチェックしてくれます。

これをすることにより、鍵があっていない場合は接続を拒否することができ悪意のある中継サーバーが置かれても接続をできなくします。

BungeeGuardの設定方法

STEP
公式サイトからプラグインをダウンロード

下記のサイトにアクセスし、プラグインをダウンロードします。

STEP
プラグインを導入する

ダウンロードが完了したら、マイクラサーバー側と中継サーバーにプラグインを導入します。
「plugins」というフォルダーがあるのでそこに入れましょう。

STEP
サーバーを起動し、設定

中継サーバーを起動すると「plugins」の中に「BungeeGuard」というファイルができるのでそのファイルにアクセスし「token.yml」を開き token: の先を全てコピーしましょう。(画像の赤い場所)

マイクラサーバーを起動すると「plugins」の中に「BungeeGuard」というファイルができるのでそのファイルにアクセスし「config.yml」を開き以下のように設定して保存しましょう。

# BungeeGuard Configuration

# Allowed authentication tokens.
allowed-tokens:
  - "TokenIDを入れる"
STEP
完了したら再起動

中継サーバー/マイクラサーバー側の設定が終わったら再度マイクラサーバーを再起動させて接続できるかチェックしましょう。

参考になったら共有して広めてね
  • URLをコピーしました!
  • URLをコピーしました!

コメント

コメントする

CAPTCHA

もくじ