sudoDockerps查看正在運行的容器的id等信息
”sudo docker inspect 容器id“可以查看到容器的相關(guān)信息
“docker inspect --format '{{ .NetworkSettings.IPAddress }}' 容器id”可以查看容器的具體IP地址,如果輸出是空的說明沒有配置IP地址
ifconfig查看主機上的網(wǎng)絡(luò)
cat /etc/hosts查看主機內(nèi)部IP映射表
cat /etc/resolv.conf查看主機dns服務(wù)器配置
cat /etc/nsswitch.conf查看主機名字服務(wù)配置婆赠,這個配置文件用來在/etc/hosts文件中查找主機名和IP地址绵脯,如果在hosts文件中沒有找到給定的主機的話,就會和DNS服務(wù)器通訊休里。
其他可能的名字服務(wù)會聯(lián)系LDAP蛆挫,NIS和NIS+等。
ip addr show查看主機IP地址
ip route show查看主機轉(zhuǎn)發(fā)信息
netstat -nr查看主機當(dāng)前IP轉(zhuǎn)發(fā)表詳細信息
在容器內(nèi)可以查看網(wǎng)絡(luò)相關(guān)的信息
ifconfig查看容器內(nèi)的網(wǎng)絡(luò)
cat /etc/hosts查看容器內(nèi)內(nèi)部IP映射表
cat /etc/resolv.conf查看容器內(nèi)dns服務(wù)器配置
cat /etc/nsswitch.conf查看容器名字服務(wù)配置
ip addr show查看容器IP地址
ip route show查看容器轉(zhuǎn)發(fā)信息
netstat -nr查看容器當(dāng)前IP轉(zhuǎn)發(fā)表詳細信息
查看iptables:
sudo iptables -L -v
如果沒有裝iptables:
sudo apt-get install iptables
另外還有一些其他輔助命令:
參考http://www.tecmint.com/Linux-network-configuration-and-troubleshooting-commands/
hostwww.baidu.com
host -t any baidu.com
ping baidu.com
/usr/sbin/traceroutewww.baidu.com
whois baidu.com
digwww.tecmint.com; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6 <<>>www.tecmint.com
nslookupwww.tecmint.com
arp -e
ethtool eth0
iwconfig [interface]
cat /etc/sysconfig/network