I'm a vagrant newbie trying to configure his first instance. But wherever I look on Vagrantfiles configuring PostgreSQL they're always using port forwarding to the host.
config.vm.network :forwarded_port, host: 5432, guest: 5432
What is the point of forwarding database's port to the host?
Shouldn't the database be operating inside the box?
Or is it just a practice to have better data persistance?
And even if this is desired workflow and everything's forwarded then what is the point of installing the database inside the box after all?
This is mainly so that you can use Graphical Database SQL tools to query your Postgres database from your host machine. Since vagrant is used mainly by programmers and they need to frequently check the database for testing/debugging, this is in place. IDEs like IntelliJ and Eclipse have tools that you use to query databases and they would run on the host machine and thus would need to have access to the database port.
If you don't need to query your database from your host machine and it is only accessed by the guest VM, then you don't need this set.
Shouldn't the database be operating inside the box?
Yes.
Or is it just a practice to have better data persistence?
There is no relation between port forwarding and data persistence.
And even if this is desired workflow and everything's forwarded then what is the point of installing the database inside the box after all?
What is the point of forwarding database's port to the host?
There is no need to always forward port. Port forwarding is only needed when you want to access that port from host machine, e.g. using graphical tools as pointed by blownie55's answer. If you don't need to access the port from host then there is no need to forward it.
And this is true for all kind of port forwarding, not only for database port.
As a side note, there are other ways to access resource inside guest from host, e.g. configuring a private network.
Related
I have a client who is remote. I need to debug some weird problem that none of my other clients are having. Before I try and set up a conference with this client, I would like to know if there is some way of remotely debugging our application.
I see that there are remote debugging tools available for Visual Studio, but from what I've read, I need to be on the same subnet. As the person is remote, this is not a possibility. Also, as I'd like to keep our connection secure, I would need to connect up some sort of encrypted tunnel (this is where I'm a little fuzzy as my networking skills are mostly theoretical).
As I understand it, an encrypted tunnel is a bridge to another (different) subnet. This is to ensure that those computers on the other side won't interfere with the local subnet computers.
So, because the client's computer is on a different subnet, I think that this is not possible. Or is it? Should there not be a way of making the client's computer show up as a virtual computer on my subnet, by forwarding packets from one subnet to another? I would think that this is theoretically possible, but I'm not exactly sure how I would go about this.
Also, at the moment, my current way that we connect to clients is through GoToMeeting, but I don't think that it supports tunneling. If not, then I may need some way of generating a tunnel, so I was also thinking of maybe using some SSH programme like PuTTY.
As I have said before, my knowledge of networking is quite theoretical, so if the tools that I am suggesting are not the correct ones, please correct me. (I'm a programmer, damm it! Not a network engineer!)
Both computers are Windows boxes. Windows 10 (client) and Windows 8.1 (development).
If you can connect to an ssh server in the remote network, you can (subject to configuration on the server) create a tunnel such that you connect to a socket on your local pic and the connection appears from the server to an endpoint on the remote network.
You'll want to investigate the -L command of OpenSSH, which combined with the PuTTY docs, should help explain what's required.
By default, the endpoint would be a port on the ssh server, but it could be a port on a different host that the remote server can connect to.
I'm not familiar with the current state of Windows SSH servers, but even if there isn't a system server to hand, you should be able to have on run 'on demand' - if you run it on a non-privileged port and by the user you want to connect in as, it shouldn't even need Admin privileges.
I'm not familiar with GoToMeeting, but the one thing with SSH tunnelling it that IT depts should be familiar with SSH. If trying that, focus on getting a working connection in, then setting up the tunnel, then connecting through it as separate steps.
Once you have an SSH connection, then it doesn't need to do something itself, and you can then investigate connecting while specifying the port forwarding, but will will need to get the basic connection working correctly first.
Is it possible to access 127.0.0.1:8080 publicly i have a project application that is running on VM, What should I do?
Diagram:
VMachine( where xampp is installed) IP <-> Global(external) IP (167.1.174.21:8080)
I don't have any option left what should i do i'm really new to this. #respect
Yes, this is possible but there are multiple steps to the configuration and the details for each steps differ depending on the hardware/software used. In general though it can be accomplished like this:
VMware config
Configure the VM with a bridged network
Configure the guest OS to either have a dhcp reservation or static ip.
Router config
Add a dhcp reservation for the VM (if using DHCP)
Add a port forwarding rule pointing to the VM's IP address
XAMPP config
Make sure the XAMPP server is listening on all interfaces.
The key point is to make the Virtual Machine to have bridged connection.
You can do it by looking at this one.
After that do a Port Forwarding to the virtual machine like it a real machine on your LAN.
Step 1 : Apart from above solution, in your local network where xampp is installed, make your local ip as static one, like "192.168.1.125" from router settings->Address reservation option.
Once you reserve address
Step 2 : Open your router->port forwarding->set port & ip to forward.
Step 3 : Now you check your public ip, and bingo now you can go to your public ip from vmware or from any other network.
As long as the vm has a configured network and is therefor able to communicate with your LAN (using Bridged networks in the VM configuration is a good way to go) and the internet, it is possible to make it accessible to the external web/internet.
Therefor you would most likely need to define a port-redirect/port forwarding on your router, that all incoming packets on the external IP (167.1.174.21) on port 8080 gets forwarded to the local ip of your vm and the related xampp session.
A possible problem at that point might be changing IP addresses of the VM based on a possible DHCP configuration. Either use a fixed IP on the VM or configure some mac-based rule for fixed IP or increase the lease time of the dhcp-server (your router to unlimited)
That's the theory, but please think twice before you do so. Running a webserver which is available in the wild is not recommended if you are not used to IT security. And even if you decide to do so, using xampp sounds wrong to me ears. xampp is designed for local development & testing purposes, not for productive use.
I am using Neo4j graph database. Its running on Windows PC at url: http://localhost:7474/browser/. Now I want to get access to this server from machine running Ubuntu OS, so that I can access Neo4j browser and can use it for development purpose as well.
Here is what you need to do: -
Uncomment "org.neo4j.server.webserver.address" and provide a valid IP-Address on which you want to bind your neo4j http service at port 7474 in your neo4j-server.properties and restart your neo4j server.
Try accessing you Neo4j server on local machine by entering URL - http://:7474/ (Do not use localhost).
Switch off all firewalls and ensure :7474 is accessible from any remote machine. You may test it with Telnet too.
In case all the above works then you are done and your Neo4j server is accessible from remote machine.
I think you'll need to configure your conf/neo4j-server.properties file to allow access from non-localhost addresses. Here's the relevant part of my file:
# Let the webserver only listen on the specified IP. Default is localhost (only
# accept local connections). Uncomment to allow any connection. Please see the
# security section in the neo4j manual before modifying this.
#org.neo4j.server.webserver.address=0.0.0.0
I have seen a few related questions on SO, but none have helped me. I setup a MySQL database on an Ubuntu machine on EC2. I am trying to connect to it from within R, using e..g ,
con <- dbConnect(MySQL(), username = user, dbname = db, host = host, password = password)
where the username and password are those for the remote database, and the host is the ec2 address (something like ec2-54-456-161-6.us-west-2.compute.amazonaws.com [not a real one])
Any thoughts on how to do this?
To log in to the Ubuntu machine the database is installed on from the shell on my machine I have to use the key pem file. Does this key have to be provided to authenticate? If so, how?
Make sure the MySQL instance listens on the network, even if you're on the same machine. In /etc/mysql/my.cnf, change this:
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
This should be in a number of MySQL tutorials and is not EC2 specific.
You want to make sure that you can connect to the DB from the server itself. Once that is taken care of, try the remote access. If a port ends up being blocked, you can also got the route of an ssh tunnel -- which again is described in a number of tutorials.
The problem in my case was that I just need to add a new rule to the security group to allow remote connections on port 3306. See below screenshot of the rule added (the bottom line)
That was all that was needed.
I installed VirtualBox with a Oracle VM.
Now I simply try to access the Oracle Database of the VM from the host environment, but it doesn't work.
ipconfig on my host shows an IP number, but when I try to open this (Port 80), i get the content of localhost of the host system instead of the content of the server in the VirtualBox.
Which is the proper network setting ?
- Use Host-Only Networking on your guest machine
- See if the server (WEB, DB etc.) is running.
- Mouse-over network icon on status bar to note ip address
- From your host browser send a request to your quest server
I usually do a bridged connection so the vm will pick up an ip address from my router's dhcp; if that option is not available, your other option is to employ port forwarding where you assign an unused port on the host machine to forward to the port on the vm. The virtual box manual has a lot of useful info on both of these options. Let us know if you need additional info or examples.
Turn off the Windows Firewall on the Virtual PC. I've just fixed my HTTP request from Host to VM by turning off the firewall.
In the virtual box go to the settings->Network->Adapter and select Bridge Adapter for (Attached to) field. Don't forget to turn off your firewall in the machine.