# Namespace ``` bigred@alp:~$ ls -l /proc/self/ns/ total 0 lrwxrwxrwx 1 bigred bigred 0 Sep 30 10:45 cgroup -> 'cgroup:[4026531835]' lrwxrwxrwx 1 bigred bigred 0 Sep 30 10:45 ipc -> 'ipc:[4026531839]' lrwxrwxrwx 1 bigred bigred 0 Sep 30 10:45 mnt -> 'mnt:[4026531840]' lrwxrwxrwx 1 bigred bigred 0 Sep 30 10:45 net -> 'net:[4026532000]' lrwxrwxrwx 1 bigred bigred 0 Sep 30 10:45 pid -> 'pid:[4026531836]' lrwxrwxrwx 1 bigred bigred 0 Sep 30 10:45 pid_for_children -> 'pid:[4026531836]' lrwxrwxrwx 1 bigred bigred 0 Sep 30 10:45 time -> 'time:[4026531834]' lrwxrwxrwx 1 bigred bigred 0 Sep 30 10:45 time_for_children -> 'time:[4026531834]' lrwxrwxrwx 1 bigred bigred 0 Sep 30 10:45 user -> 'user:[4026531837]' lrwxrwxrwx 1 bigred bigred 0 Sep 30 10:45 uts -> 'uts:[4026531838]' ``` ## Process ID (pid) ``` ps -aux ``` 是到 /proc 目錄抓 process 的資訊 /Proc 是由 Linux kernel 維運管理 /proc 怎麼來: linux 啟動後,馬上會創造一堆隔離空間,全都位於 memory 中,其中一個叫 pid。 pid 隔離空間內存放所有執行中 process 的資訊 kernel 會將 pid 隔離空間內的資料 mount (掛載)至 /proc 中。 ``` sudo unshare --pid --fork sh ``` `--pid` 幫 sh 產生 pid 的隔離空間 `--fork` ## Network (net) 一樣位於記憶體 Network Namespace(網路隔離空間) Linux系統一啟動,就會產生名為default的net隔離空間 (proc/self/ns/net) 使用ifconfig可以看到default Network Namespace的內容 其中包含lo、eth0
×
Sign in
Email
Password
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