Connection (offline) to OracleDB on CentOSVM using Vbox doesn't work - oracle

First of all, I am no developer or network specialist, so please keep things simple. Here's my basic situation:
I have a local server (Apache on Ubuntu 20.04) with several vhosts that need to connect to a Oracle-DB that's installed on a VBox CentOS VM. I do a lot of travel, so the IP I use to connect to the internet changes almost daily, and sometimes I have no internet connection at all. A colleague set my system up to be able to connect via static IP, but unfortunately yesterday something happeneded (vBox went into guru-mode and never got out it) and I had to reinstall and set up the whole thing. But it doesn't work.
As the above mentioned colleague isn't available anymore, I need some external help. Here's what I have:
VBox on Ubuntu, with a host-only adapter set up to have a static IP (192.168.56.10), DHCP off and another bridged adapter
VM with CentOS 7 (system for the Oracle DB)
ifcofig of that VM:
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.43.121 netmask 255.255.255.0 broadcast 192.168.43.255
inet6 fe80::5255:9ce9:96c4:7810 prefixlen 64 scopeid 0x20
ether 08:00:27:b2:8b:0d txqueuelen 1000 (Ethernet)
RX packets 43 bytes 4140 (4.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 69 bytes 7329 (7.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.56.5 netmask 255.255.255.0 broadcast 192.168.56.255
inet6 fe80::6408:c9ff:7c9a:dfb0 prefixlen 64 scopeid 0x20
ether 08:00:27:52:35:de txqueuelen 1000 (Ethernet)
RX packets 1 bytes 590 (590.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 38 bytes 5225 (5.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s8 is the one that connects to the host-only adapter, and it's configured to have a static IP (192.168.56.10). Yet, after restarting the VM it shows with another IP.
Regardless of this I can't connect via SQLDeveloper (on the host) other than using the IP of enp0s3, and only while I'm connected to the internet (wireless) and the provider doesn't change the IP. It wouldn't be a grate deal to change that IP everytime I start to work, but I have 4 different DBs and sometimes 3 or 4 local websites that have their own config files to connect to the DBs.
Short: I need a way to connect from my host to the Oracle DB on the VM without having to change the configuration files of my vhosts or SQLDeveloper.
I will gladly post any further information you may need, but I'm a new user and apparently not allowed to post pics/screenshots yet.
Thanks.

Skip all this networking futzing and setup port forwards. You can tell VirtualBox to map port 1521 on your host to port 1521 on the vm, so SQL Developer can simply connect to localhost:1521/database in your connection.
I talk about this in more details here
Disclaimer: I'm the product manager at Oracle for SQL Developer.

Related

Why are there strange IPs when I query Get-NetTCPConnection -LocalPort 3389

I am trying to determine if I am connected through RDP and store the client IP in an environment variable with a scheduled task which runs whenever I log on. My plan is to find the established connection to the 3389 port. However, I am seeing strange IPs which are not even in the subnet of the local address it's accessing. For example:
LocalAddress LocalPort RemoteAddress RemotePort State
------------ --------- ------------- ---------- -----
:: 3389 :: 0 Listen
192.168.1.136 3389 195.78.54.160 57803 Established
192.168.1.136 3389 192.168.1.138 58194 Established
0.0.0.0 3389 0.0.0.0 0 Listen
It does show 192.168.1.138 from which I RDP into the server, but there is also a connection from 195.78.54.160 which I do not recognize at all. When I do this query repeatedly, these strange connections can change from time to time to IPs like 191.96.185.224. Sometimes, there are two such connections at one time. What are these connections? By IP lookup, these IPs are owned by PIA VPN which I had never heard of before (I cannot find it installed anywhere either). What does that have to do with RDP in my local network whatsoever? If they are there by design, how do I filter them out?
Scans of the Internet are commonplace and made by actors of varying degrees of legitimacy, some benign and some not. It would not be unexpected to see such connections on a publicly exposed machine. RDP does not fall in to the category of service that you would want to expose to the whole Internet.
As you state, and the output shows, you machine has a private RFC1918 address. I would check your firewall/router and see if it is doing port forwarding from its public IP address to your private LAN address.

Can't ping broadcast addressed in AWS VPC

I want to find all the existed IPs in my subnet on AWS. I use ping -b in my EC2. But there is no response.
$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 06:8f:a3:06:38:75
inet addr:172.16.33.10 Bcast:172.16.33.255 Mask:255.255.255.0
inet6 addr: fe80::48f:a3ff:fe06:3875/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1
RX packets:54018 errors:0 dropped:0 overruns:0 frame:0
TX packets:39295 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:41673791 (41.6 MB) TX bytes:9891811 (9.8 MB)
$ ping -v -b 172.16.33.255
WARNING: pinging broadcast address
PING 172.16.33.255 (172.16.33.255) 56(84) bytes of data.
I have modified the security group and allowed all traffic. I wonder if AWS forbids the ping -b.
When this answer was originally written in 2017, the AWS VPC network did not have broadcast or multicast capability.
Q. Does Amazon VPC support multicast or broadcast?
No.
https://aws.amazon.com/vpc/faqs/
https://web.archive.org/web/20170717010042/https://aws.amazon.com/vpc/faqs/
In 2022, it is still true that broadcast is not supported, and it seems unlikely that it ever will be...
We do not support broadcast in a VPC
https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html
...however, multicast is now possible using a VPC Transit Gateway to handle the nuts and bolts of actually replicating and delivering the packets. This isn't transparent as it might be within a subnet in a conventional LAN -- you have to statically configure the participating machines or use IGMPv2 -- but it's genuine multicast beyond that.
The Ethernet network in Amazon VPC is not the LAN that it appears to be -- it's a software defined network that rides on an underlying network that is fundamentally point-to-point. Transit Gateway is how AWS decided to implement multicast support.
See Another Day, Another Billion Packets (YouTube, official AWS) for some solid insights into how the network works.

localhost is working but not 127.0.0.1 in windows 7

I am running xampp on windows 7. When I do http://localhost, I get the xampp welcome screen in my web browser but http://127.0.0.1 does not work. In my windows hosts file, I have uncommented 127.0.0.1 localhost but the problem still exists. I have checked to see if firewall is blocking anything but still no good results.
How do I resolve this problem.
Two or three shot in the dark guesses. This is how I would diagnose the issue.
It's possible that your web browser is resolving localhost on your computer to the IPV6 loopback address, ::1. Compare the results of typing http://[::1] and compare the results to http://127.0.0.1 and http://localhost to see if that reveals anything. As to why xampp is working on IPV6, but not IPV4 is another issue.
You might have a web proxy installed on your network and your Internet Options or browser settings is configured to use it. This will bypass DNS and the hosts file and send the request straight to the proxy. And the proxy server probably resolves 127.0.0.1 and localhost differently. This also applies to any sort of local proxy, internet speed-up software, anti-virus scanner, Fiddler, etc... Try going to Control Panel->Internet Options and select the Connections tab. Then select the "LAN settings" button. Make sure all the checkboxes are turned off on this dialog. Run the "Setup" button at the top of the Connections dialog just to be sure. See picture below
Disable the Windows Firewall and/or any other sort of Firewall software you may have. Just so we can rule that out. Any change?
But your BEST option will be to install Wireshark or Netmon and get a trace of http://localhost connection and compare that to the http://127.0.0.1 address. That should reveal something...
netsh http add iplisten 127.0.0.1
This should do the work
What I had to do was:
1) Make sure I had all files located inside of C:\inetpub\wwwroot backed up somewhere, just in case.
2) Go to the windows search OR control panel and openTurn Windows features on or off
3) The box next to Internet Information Services needs to be checked (it will appear as a green square inside of the grey square).
4) Now I can type 127.0.0.1 or http://localhost and get the correct page which should look like this image
5) Profit.
I personally couldn't get 127.0.0.1 working on it's own in the Apache httpd.conf file. So I added a port number at the end. Usually it's just :80.
However, I have Skype running on my machine which causes a conflict so I use port :8080.
Listen 127.0.0.1:8080
Is what I have in the config file and in the browser I enter:
http://localhost:8080
This works and keeps it on local only. You can either type in localhost to find your apache server or your local ip address. You can find your local ip address in cmd with an ipconfig command.
Here is a simple solution taken from here
Increase the priority of IPv4
Microsoft Windows [Version 10.0.19044.1826]
(c) Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>netsh interface ipv6 show prefixpolicies
Querying active state...
Precedence Label Prefix
---------- ----- --------------------------------
50 0 ::1/128
40 1 ::/0
35 4 ::ffff:0:0/96
30 2 2002::/16
5 5 2001::/32
3 13 fc00::/7
1 11 fec0::/10
1 12 3ffe::/16
1 3 ::/96
C:\WINDOWS\system32>
C:\WINDOWS\system32>netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 55 4
Ok.
C:\WINDOWS\system32>
C:\WINDOWS\system32>netsh interface ipv6 show prefixpolicies
Querying active state...
Precedence Label Prefix
---------- ----- --------------------------------
55 4 ::ffff:0:0/96
50 0 ::1/128
40 1 ::/0
30 2 2002::/16
5 5 2001::/32
3 13 fc00::/7
1 11 fec0::/10
1 12 3ffe::/16
1 3 ::/96
Here is the result:
C:\WINDOWS\system32>ping localhost
Pinging Sumonst21 [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\WINDOWS\system32>
Hope this will help someone coming to this thread by 2022 :)
If localhost working and 127.0.0.1 not working
Try 192.168.1.1 or 192.168.1.(your system number)
It should work..

Sending TCP packets over internet (using Ruby)

I am trying to learn how to send TCP packets across the internet to another computer. So say, computer 1 sends data across the internet to computer 2 (using TCP). Assuming that both computer have port forwarding correctly set, how would I go about establishing a TCP connection between the two computers (in Ruby preferably)? I have it working on my LAN, but when I try over the internet, it doesn't seem to work.
My attempt (basically):
Computer 1:
server = TCPServer.new 32500
client = server.accept
Computer 2:
TCPSocket.new PUBLIC_IP_OF_COMPUTER_1, 32500
Problem is that TCPSocket never connects to TCPServer.
I read in the Ruby doc that TCPServer.new's syntax is
new(remote_host, remote_port, local_host=nil, local_port=nil)
What happens if I just leave local_host=nil and local_port=nil (rather than assign them the private IP and port 32500 number on Computer 1)?
If somebody could point me in the right direction, that's be great! I hope I my approach is at least somewhat correct.
You created a server which is listening only on the loopback Interface.
Try this out:
curl ifconfig.me
You will get your external IP address, how it is visible from outside, for example 123.123.123.123
server = TCPServer.new 2000
Now You have a server listening on port 2000
lsof -i :2000
for example:
ruby 37186 wopi 6u IPv4 0xcf0818acc2bdc38d 0t0 TCP *:callbook (LISTEN)
now connect from THE SAME machine to localhost
telnet localhost 2000
this works
telnet 123.123.123.123 2000 # substitute your real external IP address
this will not work
That is why You can't connect from outside.
Checkout how ngrep, netcat and tcpdump are working, invaluable tools for network debugging.

VMware and iptables

Is there a problem using VMware on Windows to host a virtual linux box running iptables? I have a configuration that seems to work on physical hardware but is flaky under VMware.
I'm using VMware to run a virtual linux 2.6.24 machine on a Windows 2003 Server host. The linux application is essentially a NATting router that runs iptables. The rules in the nat table include:
Chain foo_pre
target prot opt in out source destination
LOG all -- * * 0.0.0.0/0 0.0.0.0/0 [options here]
LOG all -- * * 0.0.0.0/0 10.10.1.33 [options here]
DNAT all -- * * 0.0.0.0/0 10.10.1.33 tcp dpt:80 to:192.168.0.33:8080
Chain PREROUTING
target prot opt in out source destination
foo_pre all -- * * 0.0.0.0/0 0.0.0.0/0
I'm seeing the incoming packets to 10.10.1.33:80 using tcpdump, and the first LOG generates messages, but neither the DNAT or the second LOG show the packets registering on their packet counters, the second LOG generates no messages, and tcpdump doesn't show the packets to 192.168.0.33.
The eth0 adapter is on the 10.10.0.0/16 network with a default gateway of 10.10.1.1; it has a secondary address of 10.10.1.33/32. /proc/sys/net/ipv4/config/eth0/forwarding is set to 1.
Is VMware the culprit, or am I missing something? Thanks!
Update: we've simplified the test environment. No NAT rules at all, just a linux VM running under a Win2k3 Server host. Test steps:
VM is bridged to host NIC. VM and host are on the same subnet, with the same default gateway as above.
VM communicates with devices both on and off its subnet: ICMP, TCP, UDP. Communication is bidirectional: it doesn't matter which equipment initiates it.
Engineer power-cycled the default gateway while poking at the system.
VM now communicates only with devices on its subnet. Any attempt to communicate through the gateway to the same equipment from Step 2 fails to put packets on the wire. tcpdump on eth0 on the VM shows outgoing packets with no response; WireShark on the host shows nothing on the physical NIC.
Stopping and restarting the VM does not change its behavior. Stopping the VM and replacing it with a different VM with appropriate IP address, etc. does not change the behavior.
The Win2k3 host continues to communicate normally, both on and off its subnet.
I can only conclude from this that "something happens" between the VM and the host: in the VMware drivers, or in the host's network stacks. I'm off to scour the web again.... it's hard to imagine we're the first to observe this.
Updates as they come. Thanks for your thoughts and discussion.
Your second log line is trying to match packets sent to 10.10.1.33, but you changed the destination address to 192.168.0.33 on the line above it.
I'm not sure why you don't see the outgoing packets in tcpdump yet. I assume you're running tcpdump on the linux VM itself. Is the VM sending packets on the same interface it's receiving, or is there a second virtual ethernet adapter? What machines are the various IP addresses assigned to (other than 10.10.1.33).
Regarding update:
I gather you're not using DHCP (people usually don't bother when using static IP addresses). Also, it sounds like the gateway sees one NIC using two IP addresses. Normally that should be ok, but it's always the details that get you.
Is it possible the gateway will only assign one IP address to the NIC and is ignoring traffic from the VM?
After your edit, I suggest an experiment: on your physical machine, configure your NIC to disable all hardware acceleration.

Resources