Docker virtual machine uses an external machine can not access the port issue

After using the virtual machine starts docker mirror, the external host can not access the specified port services

Host is a, the virtual machine is b. VM no visual interface, start the service on the b docker A discovery can not access

1, troubleshoot firewall firewall-cmd --state

If the output is "not running" is FirewallD is not running, and all protection policies have not started, you can exclude a firewall to block connections of the situation.

If the output is "running", it indicates that the current FirewallD running, turn off the firewall

Two, ip forwarding is not open

Execute sysctl net.ipv4.ip_forward

Net.ipv4.ip_forward = 0 indicates that the display is not open.

cat /proc/sys/net/ipv4/ip_forward0

If the above-mentioned document 0 if IP forwarding is prohibited; If 1, then IP forwarding has been opened,

To open the IP forwarding, you can modify these files directly: echo 1> / proc / sys / net / ipv4 / ip_forward

The contents of the file changes from 0 to 1. Disable IP forwarding put the 1 to 0.

The above command does not save configuration changes on IP forwarding, still uses the original value when you start the next system, in order to permanently modify the IP forwarding, need to be modified

/etc/sysctl.conf file, modify the following line values:

net.ipv4.ip_forward = 1

After modifying the system can be restarted for the changes to take effect, you can execute the following command for the changes to take effect:

sysctl -p /etc/sysctl.conf

After the above configuration, IP forwarding turned on permanently.

Published 10 original articles · won praise 3 · Views 4542

Guess you like

Origin blog.csdn.net/xiaosannimei/article/details/104570016