SITCON
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- GA: UA-34467841-15 --- 自己的機房自己蓋! - TsundereChen === <blockquote> 待的社團的機器都有點年紀了,而資源與設備都沒有一個管理的方法 如果想玩機器的話,得自己下去整自己要用的機器、插網路線、進行設定...etc 當然進研究室玩研究室的機器是個好方法,但就得跟教授打交道 嗯... 好吧,只好挽起袖子自己開始整理環境跟想一套管理流程了 這個 Talk 會分享自己動手玩機器、環境設定等等,系統管理與網路管理上的事項 會分享這一年以來踩到的各種雷,希望聽完的會眾以後不會遇到這些問題 </blockquote> ###### tags: `SITCON 2020 共筆` `SITCON 2020` `2020` `共筆` `R1` {%hackmd dTfmj-h3QvSA0myqavKbxg %} > 請從這裡開始 [TOC] # Before we start... :::warning 語速警告 ::: ## $whoami ## NCKU CCNS - 國立成功大學 電腦網路愛好社 - 社團歷史悠久 - 有自己的機房跟workshop - 一個甚麼都有就是沒有人的社團 # Why ## Why? 眼熟嗎? ## 這樣的空間... 未整理前機房 - 舊的電腦充當伺服器 - 通通拿 public ip - 要用電腦前得先取得公用帳號/密碼 - Windows 從不更新 - Ubnutu 都是 Desktop ## 問題? - 舊電腦當伺服器 -> 零件損毀 - 找不到零件 - 通通拿 public ip - 沒有 firewall , fail2ban ,服務直接暴露公網 - 整天收資安通報 - 應改用 NAT port-forwarding - 先取得公用帳號/密碼 - 洩漏出去,駭客就可以一把密碼走天下 - 裝自己的驗證伺服器 / 開帳號給新使用者 - Windows 從不更新 - 如果妳會裝 iOS 更新,那你為什麼不更新 Windows - Ubnutu 都是 Desktop - GUI 消耗資源 ## 可能可以的改善方式 - 買新的 - 找舊商務/工作站 - 前面擋一台路由器做 NAT - 一台一台開帳號 - 用帳號驗證伺服器 - 定時更新 Windows - 改裝 Ubuntu Server # Several aspects ## Several aspects - Computer / Server - 過往使用機器 - Intel Core 2 Quad Q6600 - 2 x DDR2 2GB RAM - 250Gb - 潛在問題 - 單一GbE不夠用 - 買網卡 - 硬碟沒有備援 - 設定 Software raid (mdadm) - 硬體 RAID 卡 - 如果你有預算 - 考慮升級現有設備 - 採購新設備 - 如果沒有預算 - 減少服務數量 - 減少資源使用率 ## Networks - 分兩種情況 - 會動就好 - 想做點網路實驗 ### 會動就好 - 分享器 + 交換器,機器直接皆後面 - 買點好玩的分享器 - 支援第三方韌體 - [DD-WRT](https://dd-wrt.com/) - [OpenWRT](https://openwrt.org/) - [Tomato by Shibby](https://tomato.groov.pl) (有段時間沒維護了) - [Asuswrt-Merlin](https://www.asuswrt-merlin.net/) - 交換機 - 無網管式 ### 想做網路實驗:每個元件只做一件事情 - 路由器 - MikroTik - x86 Router - pfSense - VyOs - 防火牆 - Fortinet - Juniper - 交換器 - L2 or L3 - 撿二手,新的很貴 - 不要 Fast Ethernet Switch - 無線存取點 - 現有的很夠用就不用買了 - Thin-AP - 如空間很大須多個AP ## Storage - 專門儲存用的伺服器 - 定期備份 - 共用儲存 - 供運算伺服器使用 - 你可以 - 找台機器 - 塞滿硬碟 - 買張 multi-port - 跑 RAID - FreeNAS or OpenMediaVault or 自幹 ## Service ### 名詞解釋 - Hypervisor - 虛擬機器監視器 - 執行VM的環境/平台 - Virtual Machine - 虛擬機器 - 在電腦裡再跑一台電腦 - Container - 容器 - 在系統內隔離資源 - Cluster - 叢集,把機器串起來用 ### Hypervisor - VMware vSphere / ESXi - Citirx Hypervisor - Hyper-V 有數台機器,但沒錢買授權 -> ### Proxmox VE - Hypervisor based on Debian Linux - Support KVM & LXC - Support Live Migration - Cluster Management - ZFS built-in - Ceph built-in ### 開服務 - web server - database - dns server ### 使用者驗證 - Microsoft AD - LDAP - Google LDAP - 可以配合 RADIUS 做 WiFi 登入 ### 多的資源 - 架點服務 - stress test - MC Server - 資源就在那裏,看你要怎麼運用他 # My experiences > 睡在公司的美少女工程師是你的同事? > 假的 都是假的 都是你美好的妄想 ## 一開始... 1. 先抓兩台機器裝 PVE 2. 一路點 next 3. 好了更新 4. create cluster 5. Done! > 不需要 VMware/Cirtix 也能輕鬆管理 ## Best Practice - 有數個網路孔 - **ZFS 很好用** ### ZFS - snapshot - scalable > 網卡買買買 ### 再多買一點網卡 沒辦法增加太多效能 ## 其他問題 - 需要不同的 LAN 切服務 - 備份設置 - 權限管理 - 電力 ### 網路管理 - MikroTik Rb750Gr3 - HP 2510G-24 - Router OS 上切 VLAN 打 trunk 到交換器 - 交換器把 trunk 分成 access ### 備份 - PVE 內建備份機制 - ZFS 快照 - 每天備份到Google Drive - Proxmox Backup Server #### [ZFS - auto snapshot](https://github.com/zfsonlinux/zfs-auto-snapshot) #### rclone - 備份到 Google Drive 卻不用使用 Google 的軟體 #### Proxmox backup server - 還在 Beta - 備份很快,可以從快照中撈出單一檔案 - 可以只抽某個檔案 - ### 權限管理 - 一把帳密走天下 - 曾經想自己架 OpenLDAP server - 後來放棄改用 synology LDAP server 最快最方便 - 可能會被 Synology 綁死 > 可以試試 FreeIPA > 感謝建議! > [name=TsundereChen] ### 電力 - 過往都沒有監測用電資訊 - 延長線有點舊 - 電腦電源線需要更換 - PDU - power distribution unit - 機櫃用電源分配裝置 - 用電量指示 - 警示系統 - 兩個電源線標準,採購時須注意 - nema - iec ![](https://i.imgur.com/UDyQS6l.png) ## 服務越多 問題越多 ### 不存在不出事的服務 - 某次得到新主機 決定用到儲存機器上 - 要升級主機 - 從 zpool 拉出來很正常,但把資料放進去的速度卻很慢 - 踩到 [80% rule](https://serverfault.com/questions/734353/zfs-performance-80-rule) ### PCI Passthrough - 希望拿一張顯示卡把 Server 當電腦用 - 剛好有閒置 GPU - N 卡不讓你在虛擬機用 - code 43 error - nvidia card not available in hypervisor - AMD, YES!!! ### 資源不足得買機器 - Q6600 在 2018不夠用 - 後來跑去買 HP Proliant ML350P Gen8 > 才怪 被 HP 氣死 ### 當你夠努力就會有人幫你 - 學長帶著物資來解救社團 ### 耗電量 - 10 台主機 5 台 NAS - 用電 > 15A,上限 20A ## 還沒解決的問題 - 機器性能不足 - Q6600 該淘汰ㄌ - VPN 好慢 - 當時用 Synology VPN Server - 做起來真的會累 (伺服器上架超累的 =.= ### 可遇不可求的機器採購機會 - 企業大量淘汰伺服器,一台400元 - 機架式需要機櫃 - 意外買到 Vibo 的機櫃 ### VPN 速度問題的解 - Wireguard - 測試後 發現是 L2TP/IPsec VPN 的 2 到 3 倍 - 效能出色但沒辦法手動設定 - [algo](https://github.com/trailofbits/algo) 協助管理 Wireguard 的工具 ### 電力異常 - 某天發現服務突然全部下線 - 24hr後就發生一樣的問題 - 再過24hr又跳電一次 - 校方認為是我們的疏失 - 我們認為是施工問題 ## STUIX nctu ncu ncku nthu 與其他私人點 後來裡面的人就去開公司ㄌ ## Review - 現在面臨問題 - 缺少統一的方式管理機器/服務 - 可能可以用 Ansible 管理 - 可是就是要開始寫 - 交接困難 - 內部憑證管理 - 資源盤點 - etc ### 學到什麼 - 整理機器、蓋服務的方法 - 亂點一堆技能 - 雜七雜八的問題 ### 與其他成員的溝通 - 在推新服務/新架構時,總會有人反彈 - 我們真的需要這些新功能嗎 - 為什麼服務常常出問題? - 跟夥伴討論架構、新措施、新想法 :::success 在能力範圍內去幫助學弟妹吧! ::: # Shout-out - CCNS社員/前社員 - 國立成功大學 資訊工程系 蔡孟勳教授 - 某 Y 群 - STUIX 的眾多大大 # Q&A ## 怎麼監控服務 - Grafana - LibreNMS ## 有能力接手的學弟妹越來越少該怎麼解決 - 講者也不知道該怎麽辦 - 歡迎加入 CCNS 很缺人(X ## 實驗室沒有 public ip 又無法更動 switch 規則的情況下,有沒有除了 reverse-ssh 以外連入主機的方式? - zerotier ## 機房vlog - 無法。 > ~~沒人想看肥宅玩機器~~ <!-- 旋轉吧title --> <!-- <style> @keyframes move { 0% { transform: rotate(0deg); } 50% { transform: rotate(360deg); } 100% { transform: rotate(0deg); } } @keyframes fade{ 100%,0%{ color: rgb(0,0,0); } 50% { color: rgb(255,255,255); } } .ui-avatar { animation: move 1000s infinite; } .ui-menu { animation: move .1s infinite; } .navbar-brand > span.hidden-xs { color: transparent; } .navbar-brand > .fa-file-text { display: none; } .navbar-brand > span.hidden-xs:before { background-image: url(https://sitcon.org/2020/img/logo-dark.54871ec0.svg); background-repeat: no-repeat; content: '  '; background-size: contain; } .navbar-brand > span.hidden-xs:after { content: "自己的機房自己蓋!"; color: #4b4645; margin-left: -4em; animation: fade 20s linear; animation-iteration-count: infinite; } .fa-eye { transform: scaleY(-1); } </style> -->

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully