Articles of linux networking

将传入的通信量host1.example.com:80路由到端口80绑定到10080的端口容器

我有一个运行Apache2和Docker的Ubuntu 16.04机器(Docker本身正在运行Docker中心的GitLab)。 这个盒子里还有一个Phabricator实例,所以为什么我把GitLab放到它自己的Docker中来分离事物。 同样重要的是要注意,我能够通过两种不同的方式访问服务器:在我公司的专用networking中通过专用IP(10.10.XY)或通过主机名称“gitlab.example.com”指向公共IP 。 从私有networking中,如果我去“10.10.XY:10080”,那么我可以访问GitLab的所有荣耀。 如果我到networking外的“gitlab.example.com:10080”(并在防火墙中打开10080),那么我仍然可以访问GitLab。 但是,我想避免10080打开; 我还希望我的开发人员只需input主机名,而不必包含端口号。 我尝试了几件事情来完成这个无济于事… Apache2 ProxyPass(尝试使用本地主机和docker的IP为ProxyPass / ProxyReverse)。 我已经validation了mod_proxy已启用。 访问URL给我一个错误,说明没有configuration的网站。 如果我将下面的所有代理信息注释掉了,那么就会提供默认的Apache2成功页面(大概是因为它下降到主文档根目录,因为我没有下面的定义)。 <VirtualHost *:80> ProxyPreserveHost On ProxyRequests On ServerName gitlab.example.com ProxyPass / http://172.17.0.2:80/ ProxyPassReverse / http://172.17.0.2:80/ <Proxy *> Order deny,allow Allow from all </Proxy> </VirtualHost> iptables PREROUTING。 我不是iptables的专家,我的大部分networking路由都是通过Barracuda完成的,但是我已经在线阅读了,你应该能够在同一个盒子里从一个端口路由到另一个端口。 我已经尝试了几个命令,但仍然没有运气。 说到iptables,我很迷茫,下面的命令可能会失败。 sudo iptables -A PREROUTING -t nat -s gitlab.example.com -p tcp […]

在VPS上升级到Debian之后,networking将无法工作

我正在使用OVH的VPS服务器。 它运行了一年没有问题。 今天,我从Debian Jessie升级到了Debian Stretch。 一旦升级完成,我重新启动服务器,….我不能ping它,并没有ssh访问了。 我以救援模式重新启动服务器,事情很好。 所以我怀疑networking接口的新命名scheme。 我看在/etc/udev/rules.d/,但我没有一个70-persistent-net.rules文件。 所以我把命令放在/etc/rc.local中,看看附加内容: 1- ifconfig : lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 1 (Boucle locale) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns […]

如何在firewalld上端口监听localhost?

我想问一下关于firewalld转发端口规则的问题。 我正在使用的操作系统是, CentOS Linux release 7.3.1611 (Core) 我的目标 将请求转发给127.0.0.1:80上的httpd监听 [root@development /]# netstat -atunp | grep httpd tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 2601/httpd 问题 我已经设置了firewalld规则如下。 [root@development /]# firewall-cmd –list-all –zone=external external (active) target: default icmp-block-inversion: no interfaces: eth0 sources: services: ssh ports: protocols: masquerade: yes forward-ports: sourceports: icmp-blocks: rich rules: rule family="ipv4" forward-port port="8080" protocol="tcp" […]

如果指定了积压,则Nginx“地址已经在使用”

我正在运行nginx版本:nginx / 1.10.2 我想调整我的默认configuration。 根据https://www.nginx.com/blog/tuning-nginx/我改变了操作系统中的somaxconn参数,并在nginx.conf中指定了相同的 所以我的nginx.conf看起来像 listen 80 backlog=16384; 但是,当我把backlog =放在nginx.conf中的时候,那么nginx不会以类似的错误开始 Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already […]

tcpdump无法从OpenWRT的网桥接口捕获非广播/组播数据包

(本来,我把它发布到StackOverflow,我把它移到networking工程,然后在这里。) 我有TP-LINK WR841N v9路由器并安装OpenWRT固件CHAOS CALMER (15.05.1, r48532) 。 我有/etc/config/network内容: config interface 'lan' option force_link '1' option type 'bridge' option proto 'static' option ipaddr '10.15.252.3' option netmask '255.255.254.0' option gateway '10.15.252.1' option ifname 'eth0 eth1' 这里是ip link ls的输出: 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: […]

尝试查询SNMP服务器时超时

我正在尝试执行查询到snmp服务器,但我总是获得超时错误。 我正在使用SLES 11(OpenSUSE), 防火墙被禁用 。 我执行的查询是: > snmpwalk -mALL -v1 -ccomname localhost system 2 > /dev/null Timeout: No Response from localhost 我已经尝试通过configuration文件hosts.allow和/etc/snmp/snmpd.conf来允许访问snmp。 这些文件如下: hosts.allow文件 snmpd : ALL : ALLOW 的snmpd.conf syslocation Server Room syscontact Sysadmin (root@localhost) # These really aren't meant for production use. They include all MIBS # and can use considerable resources. See […]

通过转发代理redirecttomcat请求

我有一个反向代理,允许我连接到位于内部networking的tomcat上部署的Web应用程序。 问题是tomcat应用程序正在启动对在线数据库的https请求,因此应该通过转发代理redirect。 如何configuration这样的转发代理? 是否可以启用反向/转发httpd代理? 谢谢

如何将stream量从一台主机路由到另一台主机

我有一个虚拟机(主机A)在一个networking的虚拟机pipe理程序,看不到外面的世界。 在另一个可以看到外部世界的虚拟机pipe理程序上有另一个虚拟机(HOST B)。 我可以从主机A ping主机B.我想从主机A路由stream量到主机B,所以我可以到达外面。 主机例如IP:172.17.175.5 主机B示例IP:10.130.128.242 在主机BI已经完成 sysctl net.ipv4.ip_forward=1 iptables -t nat -A POSTROUTING -o ethx -j MASQUERADE 在主机上,AI尝试过 ip route del default ip route add default via IP_of_HOSTA 但我得到RTNETLINK答案networking是无法访问的 在主机A上运行traceroute 10.130.128.242显示 1 172.17.175.1 (172.17.175.1) 0.453 ms 0.877 ms 0.870 ms 2 172.16.1.1 (172.16.1.1) 0.861 ms 0.853 ms 0.844 ms 3 la.la.la.net (172.16.255.254) 2.567 […]

带有QinQ的ICMPv6 RA“IPV6头未find”日志

我正面临着一些 – 我想 – 在Linux主机中使用IPV6和QinQ的奇怪问题,可能是某人面临类似的问题(或者可能提供提示)。 我有一些虚拟机在主机(KVM)中运行,每当有虚拟机发送ICMP6路由器通告时,我们会在syslog中获得以下日志: Aug 10 11:18:36 Hostname kernel: [1722430.045240] IPv6 header not found 对于stream量来说,我使用QinQ(两个标签都是802.1Q),内层标签在tap中设置为OVS,外层设置为vlantypes,方法如下: +——————————————————-+ | +———–+ HOST | | | | Unbuntu 16.04 | | | VM-1 | 4.4.0-62-generic | | | | | +—-+——+ | | | | | |TAG=1 | | +———————–+ | | | OVS | | | […]

“OSError:通过触发器在非套接字上进行套接字操作”

当试图将Flask应用程序部署到我的LAMP服务器时,我发现了一个触发器的错误,一个FastCGI / WSGI网关,它使我的应用程序能够说出FastCGI协议。 〜/最小/ run.py from flask import Flask from flipflop import WSGIServer app = Flask(__name__) @app.route('/') def hello_world(): return 'hello, world' if __name__ == '__main__': WSGIServer(app).run() Apacheconfiguration文件的相关部分,即/etc/httpd/conf/httpd.conf : <VirtualHost *:80> ScriptAlias / /home/apps/minimal/run.py ErrorLog /var/log/httpd/error_log </VirtualHost> Apache / 2.2.15的错误报告: [apps@kernod0 ~]$ sudo head -n 20 /var/log/httpd/error_log [sudo] password for apps: [Wed Aug 16 16:39:16 […]