運用 switch コマンド集

// OPS COMMANDS — 12XS/T48 + 各ホスト OS更新 / 最終更新: 2026-05-14

運用中 よく使うCLIをまとめておく。 そのままコピペで実行

VLAN50 (UPDATE) 封鎖/復旧

VLAN50 はOSアップデート専用。 普段は閉じておいて、 使うときだけ開ける運用。

// 封鎖 (使わないとき) — 12XS
ssh WS-C3850-12XS
configure terminal
interface vlan 50
 shutdown
end
write memory
// 復旧 (使うとき) — 12XS
ssh WS-C3850-12XS
configure terminal
interface vlan 50
 no shutdown
end
write memory
// 確認
# 12XS 側
show ip interface brief | include Vlan50

# 各ホスト側 (例: R640 から)
ping -I R640-UPD -c 3 1.1.1.1
OS アップデート手順 (全ホスト)

各サーバーの apt update / upgrade コマンド。 サービスへの影響を最小化するため、 順番通りに実施すること。

2026-05-14 時点の構成変更: xserver VPS (162.43.8.20) は katuocloud.com 移行完了に伴い 6月末解約予定。 残作業期間中だけ更新対象に残す。
① R640 (katuo) — DMZ Web フロント
ssh katuo@192.168.20.21
sudo apt update && sudo apt upgrade -y
sudo apt autoremove -y

# 再起動が必要な場合
sudo systemctl status nginx
sudo systemctl status perc-watch.timer
sudo systemctl status cert-watch.timer  # cron 形式の場合は crontab -l

! WordPress (katuocloud.com) が乗ってるので、 nginx / php-fpm の再起動でサイト瞬断が起きる。 深夜推奨。

② maguro (Supermicro) — ストレージ + NC + WG + Portal
ssh maguro@192.168.70.30
sudo apt update && sudo apt upgrade -y
sudo apt autoremove -y

# 再起動後の確認
sudo systemctl status wg-quick@wg-clients
sudo systemctl status wg-quick@wg-customers
sudo systemctl status wg-quick@wg-storage
sudo systemctl status supermicro-watch.timer
sudo systemctl status mdadm-watch.timer
sudo systemctl status raid-watch.timer
sudo docker ps  # nextcloud-stack + mikyun-portal の生存確認

! NC (cloud.k2-o.net) + WG (顧客接続) が止まると影響大。 顧客側に予告必要。

③ hirame — Collabora Online (Docker)
ssh hirame@192.168.10.40
sudo apt update && sudo apt upgrade -y
sudo apt autoremove -y

# Docker イメージは OS 更新とは別管理 (現状維持で OK)
sudo docker ps | grep collabora
sudo docker logs --tail 30 collabora
④ xserver VPS (162.43.8.20) — 解約予定
ssh xserver
sudo apt update && sudo apt upgrade -y
sudo apt autoremove -y
注意: 6月末解約予定なので、 緊急セキュリティ更新以外は不要。 解約後はこの項目ごと削除する。
カーネル更新があった場合 (全ホスト共通)
# 再起動要否確認
cat /var/run/reboot-required 2>/dev/null && echo "再起動必要" || echo "再起動不要"

# カーネルパッケージ一覧
dpkg -l | grep linux-image

# 再起動
sudo reboot
再起動後の確認チェックリスト
// R640 (katuo)
sudo systemctl --failed
sudo systemctl status nginx
curl -sI https://katuocloud.com/ | head -5
sudo systemctl status perc-watch.timer
sudo systemctl status cert-watch  # daily cron
sudo systemctl status wp-katuocloud-db-backup  # daily cron 02:30
ls -lt /mnt/data/backup/wp/katuocloud_wp/ | head -3
// maguro
sudo systemctl --failed
sudo docker ps
sudo wg show
sudo systemctl status supermicro-watch.timer mdadm-watch.timer raid-watch.timer
df -h /srv/storage
cat /proc/mdstat | head -10
curl -sI https://cloud.k2-o.net/status.php | head -3
// hirame
sudo systemctl --failed
sudo docker ps | grep collabora
curl -s http://173.0.0.10:9980/hosting/discovery | grep urlsrc | head -1
推奨実施順序
順番ホスト理由
1hirameCollabora は使わなくても他サービスは生きるので最初に試す
2maguroNC + WG が止まるが、 R640 (WP) は影響なし
3R640 (katuo)WP公開サイト。 最後に深夜帯で実施
4xserver VPS解約予定なので緊急時のみ (6月末まで)
便利コマンド集
// 全ホスト共通
# 失敗してる unit を一発で確認
sudo systemctl --failed

# 最近のエラー (boot 以降)
sudo journalctl -p err -b --no-pager | tail -50

# ディスク使用率
df -h | awk '$5+0 > 80 {print}'

# load average
uptime
// 証明書チェック (全ドメイン)
# R640
sudo certbot certificates 2>/dev/null | grep -E "Certificate Name|Expiry"

# maguro
sudo certbot certificates 2>/dev/null | grep -E "Certificate Name|Expiry"
// WG 状態 (maguro のみ)
sudo wg show wg-clients
sudo wg show wg-customers
sudo wg show wg-storage
監視のおさらい: R640 と maguro には Telegram通知付きの timer/cron が走ってる。 アラート来てないなら 99% 正常。 詳しくは「Telegram通知システム」「運用・保守」ページ参照。