Ubuntu local IP address does not resolve - linux

I set a Hugo web server, which listen on localhost:30000.
The ubuntu machine has the 192.168.2.137 address.
When i do:
curl http://localhost:30000/ -> OK
curl http://127.0.0.1:30000/ -> OK
but,
curl http://192.168.2.137:30000/ -> curl: (7) Failed to connect to 192.168.2.131 port 30000: Connection refused
What could be the reason for that?
My /etc/netplan/00-installer-config.yaml looks like:
network:
version: 2
renderer: NetworkManager
ethernets:
enp0s3:
dhcp4: false
addresses: [192.168.2.137/24]
gateway4: 192.168.2.1
nameservers:
addresses:
- 8.8.8.8
lo:
renderer: networkd
match:
name: lo
addresses:
- 192.168.2.137/24
I also add an entry to /etc/hosts:
192.168.2.137 localhost

You said that it’s listen on localhost so if you use other interface it won’t work which is normal . You should listen on all interfaces or listen to the interface enp0s3.

Related

Host ping failed Virt-Management failed to get a response

I installed ubuntu-server in Virt-Management.
I cannot get a response using the following command
ubuntu-server ip: 10.0.2.15
my host ip : 192.168.124.10
ping 10.0.2.15
PING 10.0.2.15 (10.0.2.15) 56(84) 字节的数据。
But ubuntu can get a response
Please see the picture below

Remote access to OpenShift Local (CRC) running on Win11

I've got CRC running on Windows 11 and I would like to connect there from a RHEL9 VM.
CRC listening on 127.0.0.1:6443
Port forwarding rule created on Win machine to fwd connections on 192.168.1.156 (local intf) to 127.0.0.1:
$ netsh interface portproxy show v4tov4
Listen on ipv4: Connect to ipv4:
Address Port Address Port
192.168.1.156 9000 127.0.0.1 6443
Added rule in firewall to allow connections to port 9000
From the VM:
[test#workstation ~]$ telnet 192.168.1.156 9000
Trying 192.168.1.156...
Connected to 192.168.1.156.
Escape character is '^]'.
Connection closed by foreign host.
[test#workstation ~]$ oc login -u developer -p developer https://192.168.1.156:9000
The server is using a certificate that does not match its hostname: x509: certificate is valid for 10.217.4.1, not 192.168.1.156
You can bypass the certificate check, but any data you send to the server could be intercepted by others.
Use insecure connections? (y/n): y
Error from server (InternalError): Internal error occurred: unexpected response: 412
Any idea on how I can fix this and be able to connect from my VM towards CRC?
thanks

Connection to MongoDb server hosted on CentOS is failing

Mongo up and running on CentOs Machine
All IPs enabled, no authorization
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
# security: none
# authorization: 'enabled
Port enabled
netstat -tulnp
(No info could be read for "-p": geteuid()=1001 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN -
Connection from the server itself using the IP works fine
mongo --host 10.X.X.16
MongoDB shell version v4.2.2
connecting to: mongodb://10.X.X.16:27017/?compressors=disabled&gssapiServiceName=mongodb
MongoDB server version: 4.2.2
Server has startup warnings:
2020-01-21T15:48:26.297-0800 I CONTROL [initandlisten]
Doing the same thing from a remote Windows Machine
mongo --host 10.X.X.16
MongoDB shell version v4.2.1
connecting to: mongodb://10.X.X.16:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-01-21T15:59:07.563-0800 E QUERY [js] Error: couldn't connect to server 10.65.5.16:27017, connection attempt failed: NetworkTimeout: Error connecting to 10.X.X.16:27017 :: caused by :: Socket operation timed out :
connect#src/mongo/shell/mongo.js:341:17
#(connect):2:6
2020-01-21T15:59:07.571-0800 F - [main] exception: connect failed
2020-01-21T15:59:07.571-0800 E - [main] exiting with code 1
Thanks!
Problem fixed:
I had to disable the firewall for the mongo port
sudo firewall-cmd --zone=public --add-port=27017/tcp --permanent
sudo firewall-cmd --reload

How to SSH from one Raspberry PI to a Raspberry PI running inside VirtualBox

I have a Raspberry PI running on 192.168.1.xx and I'm trying to SSH from this PI to a second PI running inside VirtualBoxVM.
On VM (using NAT) I have port forwarding enabled by:
Host Port -> 2222 Guest Port -> 22
However when I try to ssh from PI1 to PI2:
ssh -p 2222 pi#localhost -vvvv
I get the following error:
debug1: connect to address 127.0.0.1 port 2222: Connection refused
ssh: connect to host localhost port 2222: Connection refused
I can SSH into the PI2 from my MBP (so I know SSH is correctly set up), but cannot from PI1. I can't figure out why PI2 is only refusing connection from PI1?
Running ifconfig on PI2:
eth0 Link encap:Ethernet HWaddr 08:00:27:41:cb:b4
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
You are forwarding port 2222 from your host computer's network interfaces to your VM.
You are attempting to connect to port 2222 on localhost from your other computer.
You need to connect to port 2222 on the host machine, not your other computer.
ssh -p 2222 pi#ip_of_macbook_pro -vvvv

ElasticSearch 1.7.5 doesn't start

I've just download elasticsearch 1.7.5 version. And trying to start it on default settings, it fails with:
java.net.ConnectException: Connection refused: /192.168.0.2:9300
If I setup my custom settings such as
network.bind_host: 192.168.0.1
network.publish_host: 192.168.0.1
network.host: 192.168.0.1
transport.tcp.port: 9300
http.port: 9200
http.enabled: false
It says
{1.7.5}: Startup Failed ...
- BindTransportException[Failed to bind to [9300]]
ChannelException[Failed to bind to: /192.168.0.1:9300]
BindException[Cannot assign requested address]
And I can't see any processes are holding that port
netstat -tulpn | grep 9300
Any ideas? Thanks

Resources