centos7 iptables/firewalld docker open port
here are multiple "hackish" ways to do it:
scan kernel logs, as mentioned by Jiri (but you have to do it right after starting the container, otherwise it gets messy);
check the interface counters (sent/received packets/bytes) in the container, then compare with the interfaces in the host, and find the pair that matches exactly (but with sent and receive directions flipped);
use an iptables LOG rule.
The last option is, IMHO, the more reliable one (and the easiest to use), but it's still very hackish. The idea is very simple:
Add an iptables rule to log e.g. ICMP traffic arriving on the Docker bridge:
sudo iptables -I INPUT -i docker0 -p icmp -j LOG
Send a ping to the container you want to identify:
IPADDR=$(docker inspect -f='{{.NetworkSettings.IPAddress}}' d6ed83a8e282)
ping -c 1 $IPADDR
Check kernel logs:
dmesg | grep $IPADDR
You will see a line looking like this:
[…] IN=docker0 OUT= PHYSIN=vethv94jPK MAC=fe:2c:7f:2c:ab:3f:42:83:95:74:0b:8f:08:00 SRC=172.17.0.79 …
If you want to be fancy, just extract PHYSIN=… with awk or sed.
Remove the iptables logging rule (unless you want to leave it there because you will regularly ping containers to identify them).
iptables -I INPUT -i docker0 -p tcp --dport 9200 -j ACCEPT
centos7 iptables/firewalld docker open port的更多相关文章
- Centos7 iptables firewalld防火墙与selinux配置
一.iptables防火墙 1.基本操作 # 查看防火墙状态 service iptables status # 停止防火墙 service iptables stop # 启动防火墙 service ...
- Linux防火墙配置(iptables, firewalld)
netfilter和底层实现 iptables firealld Linux中的防火墙 RHEL中有几种防火墙共存: iptables firewalld ip6tables ebtables 这些软 ...
- centos7.7下docker与k8s安装(DevOps三)
1.系统配置 centos7.7 docker 1.13.1 centos7下安装docker:https://www.cnblogs.com/pu20065226/p/10536744.html 2 ...
- Linux防火墙(iptables/firewalld)
Linux防火墙(iptables/firewalld) 目录 Linux防火墙(iptables/firewalld) 一.iptables 1. iptables概述 2. netfilter和i ...
- 在centos7上用docker安装宝塔面板
在centos7上用docker安装宝塔面板 1. [root@web01 ~]# systemctl enable docker 2. [root@web01 ~]# docker pull c ...
- Docker - 在CentOS7中安装Docker
在CentOS 7中安装Docker 1-确认系统信息 # cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) # uname - ...
- CentOS7使用firewalld打开关闭防火墙与端口(转载)
1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...
- Centos7下卸载docker
最近发现某台机器上的Docker服务无法开启,报如下错误: [root@localhost ~]# docker ps -a Cannot connect to the Docker daemon. ...
- centos7系统下 docker 环境搭建
运行环境: VMware Workstation Pro 在虚拟机中安装centos7系统, 选择最小安装, 网络连接方式选择的桥接(与宿主机在同一IP段)centos7一定要安装64位, docke ...
随机推荐
- MyEclipse安装EGit插件方法
摘要: 先了解自己的MyEclipse是基于哪个版本的Eclipse优化的,然后到EGit网站找对应的EGit版本,下载压缩包,解压安装. 在网上看到有人说并不是任意版本的EGit插件都能适配你的My ...
- Visual Basic的未来之路
Green首先列出了当时使用VB进行开发的四个基础指导原则: 1.VB和C#共享的通用IDE和平台构建块. 2.共享的“多范式.面向对象.命令式.强类型等”语言 ...
- tiny6410移植opencv
1.错误1, 解决办法:取消一下两个选项: 2.错误2, 解决办法: 原因是找不到pthread链接库,打开文件夹下的CmakeCache.txt进行修改 3.错误3, 解决办法:
- 用cocos2d 2.1制作一个过河小游戏(4): 游戏主逻辑BaseLayer设计
前段时间一直在忙.没有时间更新博客.今天还是抽点时间把最后一小部分游戏的实现放上来吧. BaseLayer.h: #import <GameKit/GameKit.h> #import & ...
- PHP-007(转)
今天安装ecshop的时候最上面出现了一个错误提示:Strict Standards: Only variables should be passed by reference in F:\www.x ...
- locals()
locals() 有两种情况: (1) 如果在函数内部使用 locals(),那么会以字典的形式返回函数内部定义的变量,如下例1(2) 如果在函数外部使用 locals(),那么会以字典的形式返回全局 ...
- HTTP 代理
HTTP 代理: (1) 如果我们一直用同一个IP去爬取同一个网站上的网页,久了之后可能会被该网站服务器屏蔽,因此我们可以使用代理IP来爬取,代理实际上指的就是代理服务器(2) 当我们使用代理IP爬取 ...
- Nginx虚拟主机配置教程
说明:配置之前先把域名解析到服务器IP地址上 站点1:bbs.osyunwei.com 程序所在目录/data/osyunwei/bbs 站点2:sns.osyunwei.com 程序所在目录/d ...
- [分享]方便的 windbg 命令 - !list
Windows 内部的各种结构通常都会由双向链表串起来,用 !list 命令查看这些结构非常方便. 比如查看系统中的所有进程: lkd> !list -t nt!_LIST_ENTRY.Flin ...
- HTTP/2笔记之错误处理和安全
零.前言 这里整理了一下错误和安全相关部分简单记录. 一.HTTP/2错误 1. 错误定义 HTTP/2定义了两种类型错误: 导致整个连接不可使用的错误为连接错误(connection error) ...