sudo docker ps查看正在运行的容器的id等信息 ”sudo docker inspect 容器id“可以查看到容器的相关信息 “docker inspect –format ‘{ { .NetworkSettings.IPAddress }}’ 容器id”可以查看容器的具体IP地址,如果输出是空的说明没有配置IP地址
ifconfig查看主机上的网络 cat /etc/hosts查看主机内部IP映射表 cat /etc/resolv.conf查看主机dns服务器配置 cat /etc/nsswitch.conf查看主机名字服务配置,这个配置文件用来在/etc/hosts文件中查找主机名和IP地址,如果在hosts文件中没有找到给定的主机的话,就会和DNS服务器通讯。 其他可能的名字服务会联系LDAP,NIS和NIS+等。 ip addr show查看主机IP地址 ip route show查看主机转发信息 netstat -nr查看主机当前IP转发表详细信息
ifconfig查看容器内的网络 cat /etc/hosts查看容器内内部IP映射表 cat /etc/resolv.conf查看容器内dns服务器配置 cat /etc/nsswitch.conf查看容器名字服务配置 ip addr show查看容器IP地址 ip route show查看容器转发信息 netstat -nr查看容器当前IP转发表详细信息
sudo iptables -L -v 如果没有装iptables: sudo apt-get install iptables
参考http://www.tecmint.com/linux-network-configuration-and-troubleshooting-commands/ host www.baidu.com host -t any baidu.com ping baidu.com /usr/sbin/traceroute www.baidu.com whois baidu.com dig www.tecmint.com; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6 <<>> www.tecmint.com nslookup www.tecmint.com arp -e ethtool eth0 iwconfig [interface] cat /etc/sysconfig/network
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/109554.html原文链接:https://javaforall.cn