You can ping outside from centOS
[root @ 7971df01d10c /] # ping google.com PING google.com (18.104.22.168) 56 (84) bytes of data. 64 bytes from nrt12s23-in-f14.1e100.net (22.214.171.124): icmp_seq = 1 ttl = 37 time = 36.2 ms 64 bytes from nrt12s23-in-f14.1e100.net (126.96.36.199): icmp_seq = 2 ttl = 37 time = 59.0 ms 64 bytes from nrt12s23-in-f14.1e100.net (188.8.131.52): icmp_seq = 3 ttl = 37 time = 29.0 ms 64 bytes from nrt12s23-in-f14.1e100.net (184.108.40.206): icmp_seq = 4 ttl = 37 time = 717 ms 64 bytes from nrt12s23-in-f14.1e100.net (220.127.116.11): icmp_seq = 5 ttl = 37 time = 60.6 ms
You can also ping locally
[root @ 7971df01d10c /] # ping 172.17.0.2 PING 172.17.0.2 (172.17.0.2) 56 (84) bytes of data. 64 bytes from 172.17.0.2: icmp_seq = 1 ttl = 64 time = 0.043 ms 64 bytes from 172.17.0.2: icmp_seq = 2 ttl = 64 time = 0.062 ms 64 bytes from 172.17.0.2: icmp_seq = 3 ttl = 64 time = 0.062 ms 64 bytes from 172.17.0.2: icmp_seq = 4 ttl = 64 time = 0.042 ms 64 bytes from 172.17.0.2: icmp_seq = 5 ttl = 64 time = 0.062 ms 64 bytes from 172.17.0.2: icmp_seq = 6 ttl = 64 time = 0.063 ms
It looks like this when you hit ip a
[root @ 7971df01d10c /] # ip a 1: lo:<LOOPBACK, UP, LOWER_UP>mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00: 00: 00: 00: 00: 00 brd 00: 00: 00: 00: 00: 00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: tunl0 @ NONE:<NOARP>mtu 1480 qdisc noop state DOWN group default qlen 1 link/ipip 0.0.0.0 brd 0.0.0.0 3: ip6tnl0 @ NONE:<NOARP>mtu 1452 qdisc noop state DOWN group default qlen 1 link/tunnel6 :: brd :: 6: eth0 @ if7:<BROADCAST, MULTICAST, UP, LOWER_UP>mtu 1500 qdisc noqueue state UP group default link/ether 02: 42: ac: 11: 00: 02 brd ff: ff: ff: ff: ff: ff link-netnsid 0 inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0 valid_lft forever preferred_lft forever
When you try to connect ssh from outside, it looks like this
ssh: connect to host 172.17.0.2 port 22: Network is unreachable
Ping from outside
ping 172.17.0.2 PING 172.17.0.2 (172.17.0.2): 56 data bytes Request timeout for icmp_seq 0 Request timeout for icmp_seq 1 36 bytes from 18.104.22.168: Destination Host Unreachable Vr HL TOS Len ID Flg off TTL Pro cks Src Dst 4 5 00 5400 46e1 0 0000 3c 01 7c24 10.13.204.27 172.17.0.2
Answer # 1
When connecting from the host to the container, the port will be forwarded, so the destination IP should be 127.0.0.1 instead of 172.17.0.2.
I tried to build a development environment with Docker for Mac. did. Another reason is that the IP address was not set with the "nmtui" command.
In the first place, the purpose of SSH connection was that it was necessary to create one server as a team.
I'm sorry for the delay. The question became unclear when I was a beginner of server construction and I didn't know what to do. I'm sorry for the inconvenience to the respondents. Thank you for your answer.
Answer # 2
Hmm, where should I explain?
Assumes that the following conditions are met:
22.214.171.124 is the host OS address where Docker is running.
You can log in to 126.96.36.199 from the Internet side with ssh.
Ssh is set appropriately on the Docker side (running or key pair is set properly)Raise Docker with port fowarding enabled
First, start SSH (TCP/21) running on the Docker container to port forward to an appropriate port of the host OS (eg TCP/7021).
Create an ssh tunnel from the Internet environment to 188.8.131.52
$docker run --name hogehoge -d -p 7021: 21 containar_name
For the tunnel just created ssh
$ssh -L 9999: localhost: 7021 184.108.40.206
$ssh -p 9999 localhost
There is no relationship between ping and ssh.
Please read appropriately per address.
Since 172.17.0.2 is a private address, it has no meaning outside the LAN.
Hmm, Docker is not related at all.
- can't connect to mysql launched by docker
- i cannot connect to linux (centos7) installed on virtulbox from the host machine by ssh
- i want to connect to postgresql installed on centos7 from an external pgadmin4
- linux - i want to install docker but i don't have administrator privileges
- linux - failed to open port on centos7
- linux - i want to use a hyphen as a character string in centos7 shell script
- linux - i want to count up variables in a centos7 shell script
- linux - when connecting different nws to multiple nics with centos7, is it correct to set the gateway for each nic?
- linux - please tell me what happens if docker is installed in this system
- i want to connect to mysql from the app inside the docker container
- kubernetes on docker desktop (win) wants to connect to localhost of host machine from pod
- linux - [docker] after creating a debian container, it is not displayed by ls
- linux red hat78 i can't connect to the internet
- linux - can't find docker command
- Linux centos7 detailed process of building mysql5729
- linux - what's easier with docker and vagrant? (for server side engineers)
- Linux (CentOS7) tutorial for installing mysql 8011 using RPM
- linux - i installed centos8 on vmware but can't connect to the external network
- linux - can't connect to local centos8 via ffftp
- Linux offline docker installation process (one-click installation)
- linux - i want to boot centos 8 using virtualbox
- linux : To connect to a host that automatically performs an interactive installation when connecting with Ansible
- python - i want to calculate the total value and maximum value for each time zone that is pandas
- how to intentionally create a zombie process in php
- i installed tomcat on linux (centos8), but the top page of the cat is not displayed
- linux - pxe boot says /dev/root does not exist and installation fails
- linux - how to download centos
- linux - i get an error when vagrant up
- linux - please tell me how to install centos on virutul box on windows 10 connected by wireless lan
- about automatic startup of linuxos telnet