Encountered network configuration traps during centos-ubuntu intercommunication

Requirements: open docker to run mysql on centos, open docker to run tomcat on ubuntu

Require tomcat to use mysql

Two virtual machines, installed centos and ubuntu respectively

Use ifconfig to modify ip: ifconfig ens33 10.151.134.163

If you hit this way, the default netmask will be set, but I didn’t find it.

Later, you have to restart the network card and reset it to have an effect (ifconfig ens33 down, ifconfig ens33 up, ifconfig ens33 10.151.134.163 netmask 255.255.255.0)

By the way, add route route add -net 10.151.134.0 netmask 255.255.255.0 gw 10.151.134.2 or route add defalut gw 10.151.134.2 add default gateway

There is also ping, but telnet shows no route to host. After checking for a long time, it is found that the firewall of centos is not turned on: firewall-cmd --list-port Check the port, firewall-cmd --zone=public --add -port xxxx add firewall (if you want to open it permanently, you can add --permanent parameter)

Worked for an hour, it could be done in ten minutes, to prevent stepping on the pit, record it

Recommended Posts

Encountered network configuration traps during centos-ubuntu intercommunication
CentOS7.0 network configuration
CentOS 7.0 network configuration
Ubuntu 18.04 network card configuration
Network configuration under Ubuntu