一、基礎(chǔ)網(wǎng)絡(luò)知識(shí)
0、tcp/ip 協(xié)議熟悉,L2&L3&L4
1、network namespace :隔離不同的網(wǎng)絡(luò),配置不同的網(wǎng)絡(luò)協(xié)議棧,路由,防火墻等。
2、iptables 核心流程,以及配置

3、route 流程

二、測(cè)試工具準(zhǔn)備
docker:docker 容器管理
ip :配置命名空間,路由,虛擬設(shè)備等
brctl: bridge 設(shè)備配置
ping:測(cè)試聯(lián)通性
nc :tcp/udp 測(cè)試
tcpdump:抓包測(cè)試
ifconfig: ip查看
iptables: nat ,防火墻配置
docker-machine :docker 連接VirtualBox(安裝boot2docker.iso 操作系統(tǒng)鏡像) 工具
VirtualBox :虛擬機(jī)
nsenter : 進(jìn)入網(wǎng)絡(luò)命名空間
lsof:查看啟動(dòng)端口
三、參考資料(推薦閱讀)
如果需要深入理解docker 網(wǎng)絡(luò)需要閱讀鏈接內(nèi)容以及相關(guān)書(shū)籍
書(shū)籍/博文:
- 《TCP/IP 協(xié)議卷1》
- 《深入理解linux 網(wǎng)絡(luò)內(nèi)幕》route & bridge章節(jié)
- network namespace
- docker-network-architecture
- macvlan
- iptables
- linux-virtual-networking
四、測(cè)試環(huán)境說(shuō)明
1、主機(jī)mac OS
2、虛擬機(jī)(docker-machine 創(chuàng)建)
3、網(wǎng)絡(luò)拓?fù)鋱D
VM: eth1<——host-only——> host:vboxnet0 (vm 局網(wǎng))
VM:eth0 <——nat —————> host:en0(vm 連接外網(wǎng))
host-only :vm 不能使用該接口訪問(wèn)外網(wǎng)
nat :vm 接口可以訪問(wèn)外網(wǎng),但是出口的源地址為host:en0地址

相關(guān)內(nèi)容
docker 網(wǎng)絡(luò)-準(zhǔn)備
docker 網(wǎng)絡(luò)-host
docker 網(wǎng)絡(luò)-bridge
docker 網(wǎng)絡(luò)-overlay
docker 網(wǎng)絡(luò)-macvlan