I'm running the following command expecting to get an ipv4 address, but getting an ipv6 instead:
[dummyhost]# ruby -rsocket -e 'p IPSocket.getaddress("google.com")'
"2404:6800:4006:811::200e"
nslookup is returning both ipv4 and ipv6:
[dummyhost]# nslookup google.com
Server: 232.159.207.1
Address: 232.159.207.1#53
Non-authoritative answer:
Name: google.com
Address: 142.250.67.14
Name: google.com
Address: 2404:6800:4006:811::200e
Any idea why ipv6 is returned? and how can I get it to return ipv4 instead? Ruby version below :
[dummyhost]# ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
Thanks
J
Related
I'm running an Ubuntu VM with multipass hyperkit do run microk8s. Within the VM all things checkout and available with skaffold/kubectl port forwarding. For instance:
$ multipass list
Name State IPv4 Image
microk8s-vm Running 192.168.64.2 Ubuntu 20.04 LTS
10.0.1.1
172.17.0.1
10.1.254.64
Port forwarding service/my-app in namespace default, remote port 80 -> 127.0.0.1:4503
Within the VM:curl localhost:4503 ✅
From the host: curl 192.168.64.2:4503🛑
I know the VM is reachable on port 80 because curl 192.168.64.2 returns default ngnix not found page. FWIW I never installed ngnix and the service doesn't seem to be running /cannot turn it off.
I've been at this for a day and I'm stumped. I even tried the Vbox driver and manually configured a bridge adapter. I even created my own adapter...
$ multipass exec -- microk8s-vm sudo bash -c "cat > /etc/netplan/60-bridge.yaml" <<EOF
network:
ethernets:
enp0s8: # this is the interface name from above
dhcp4: true
dhcp4-overrides: # this is needed so the default gateway
route-metric: 200 # remains with the first interface
version: 2
EOF
$ multipass exec microk8s-vm sudo netplan apply
How can I reach this VM from the host?
You cant access your pod ip /portlike this.
If you want to access your pods port over the nodes ip address, you need to define a service type NodePort and then use ipaddressOfNode:NodePort.
curl http://ipaddressOfNode:NodePort
With port-forward you must use the localhost of your host system.
kubectl port-forward svc/myservice 8000:yourServicePort
then
curl http://localhost:8000
I can't connect to ElasticSearch on my Digital Ocean droplet using my local machine's IP Address.
I got the IP Address by: Terminal > ipconfig getifaddr en0
- With that result, let's say: 100.888.777.99
I logged into my droplet by running: ssh username#111.222.3.444
Updated my UFW Rules by running: sudo ufw allow 9200 from 100.888.777.99
From my local machine I ran: curl -X GET 'http://111.222.3.444:9200'
And received: curl: (7) Failed to connect to 111.222.3.444 port 9200: Operation timed out
What am I doing wrong?
Things I've tried:
Changing the network.host variable in elasticsearch/elasticsearch.yml
network.host: 0.0.0.0 (also this a security risk since ip addresses are allowed )
Restarting the server
sudo /etc/init.d/elasticsearch restart
Adding more varibles to elasticsearch/elasticsearch.yml
transport.host: localhost
transport.tcp.port: 9300
http.port: 9200
I found that when I changed the UFW Rules to allow all connection to port 9200, I was able to connect to ElasticSearch from my local machine, but without that, it would not connect.
sudo ufw allow 9200
After some deep diving I found the issue was that the IP address that was returned by Terminal wasn't the correct one to use. I had to use the Public IP Address which I got from https://www.whatismyip.com/, you can also get this by:
Terminal > curl ifconfig.me
So when I removed the old UFW rule: 9200 ALLOW IN 100.888.777.99
And used the Public IP Address: sudo ufw allow 9200 from Public_IP_Address it connected.
I'm still not sure why my machine's IP Address doesn't work though...
My timing database influx sets the listening port 8088 to address 127.0.0.1, and the spring boot listens to the same port 8088 to any addresses, as shown below.
~ lsof -nP -i:8088
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
influxd 420 zyx 3u IPv4 0xf4af94bc970b15e9 0t0 TCP 127.0.0.1:8088 (LISTEN)
java 34029 zyx 171u IPv6 0xf4af94bc9a0d12e9 0t0 TCP *:8088 (LISTEN)
When I try to access spring boot restful using url localhost:8088/api, I get the right result. But when I use url 127.0.0.1:8088/api, I get error java.net.SocketException: Connection reset.I guess it is caused by mapping to influd instead of spring boot.
But why localhost can get the right result? As far as I konw, localhost will resolve to 127.0.0.1.
I run my program on Mac 2019.
~ nslookup localhost
Server: 192.168.15.1
Address: 192.168.15.1#53
Name: localhost.cluster.peidan.me
Address: 127.0.0.1
I installed IBM-Cloud-private-ce by following the guide https://www.ibm.com/support/knowledgecenter/SSBS6K_1.2.0/installing/install_containers_CE.html
But after I ran docker run -e LICENSE=accept --net=host -t -v "$(pwd)":/installer/cluster ibmcom/cfc-installer:1.2.0 install, I got the following error messages
task path: /installer/playbook/roles/check/tasks/main.yaml:78
fatal: [a.b.c.d] => Hostname should be resolved to a valid IP address
fatal: [a.b.c.e] => Hostname should be resolved to a valid IP address
I put the ip address as [a.b.c.d] just for confidential. Actually they are numbers here. These IP address are reachable.
By checking the ansible file, I noticed the following code
- name: Checking Hostname is resolvable
shell: ping -c 1 $(hostname) | awk -F'[()]' '{print $2;exit}'
args:
executable: /bin/bash
register: ip_out
- name: Validating Hostname is resolvable
fail: msg="Hostname should be resolved to a valid IP address"
when: ip_out.stdout in ['', '127.0.0.1', '127.0.1.1']
I found I cannot ping in the container as the image hasn't ping in it.
Is this the reason why I got the message? I appreciate if anyone could help on it.
Updated the question. Thanks #SBERENS
I tried on the 2.1.0 version and met the same issue: (for confidential reason, I used a.b.c.d as the IP address, actually the IP address are reachable)
My /etc/hosts is like the following:
127.0.0.1 localhost
127.0.1.1 e1.xx.yy.com e1
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
#puppet:
a.b.c.a puppet.xx.yy.com puppet
a.b.c.d e1.xx.yy.com e1
a.b.c.e e2.xx.yy.com e2
The cluster/hosts is like:
[master]
a.b.c.d
[worker]
a.b.c.e
[proxy]
a.b.c.e
#[management]
#4.4.4.4
The link you posted seems to be for older 1.2 level.
Please check that you are following the correct most updated installation instructions.
Latest version ICP 2.1 - CE are here:
https://www.ibm.com/support/knowledgecenter/SSBS6K_2.1.0/installing/install_ce.html
Can you please post your /etc/hosts file and the cluster/hosts file contents?
Your issue will occur in either 1.2 or 2.1.
The error is that the hostname e1.xx.yy.com resolves to a.b.c.d and 127.0.1.1. When this happens, the installer is enforcing the resolved IP to be something which is externally routable.
Is there a reason why you have the machine hostname defined on the local address in addition to a separate network IP?
Suggest removal of the line:
127.0.1.1 e1.xx.yy.com e1
from /etc/hosts. This can cause DNS confusion esp on Ubuntu.
I was going through chef, and when this part came where search queries can be put inside the recipe files, I am facing a problem when I try to fetch the secondary IP addresses of a node.
When I try to get the primary IP address, I can get is as
>> knife node show web1 -a ipaddress
web1:
ipaddress: 10.0.2.15
But when I try to fetch the secondary IP address, I could see that the key itself is the secondary IP.
>> knife node show web1 -a network.interfaces.eth0.addresses
web1:
network.interfaces.eth0.addresses:
08:00:27:6E:B1:DB:
family: lladdr
192.168.10.43:
broadcast: 192.168.10.255
family: inet
netmask: 255.255.255.0
prefixlen: 24
scope: Global
fe80::a00:27ff:fe6e:b1db:
family: inet6
prefixlen: 64
scope: Link
tags:
How can I extract the secondary IP field directly in this case, which comes as 192.168.10.43 ?
knife search and knife node show display the full object data and are not intended for scripting. We offer knife exec for simple Ruby scripts or libraries like chef-api or PyChef for more complex things.