Open Windows Firewall for XDebug - windows

This seems like it should be beyond simple, so I hate asking. But I've tried to configure Windows Firewall to allow XDebug to connect to PHPStorm on port 9000 without success.
XDebug is on on Vagrant Box with private network connection--so the host machine has a virtual network adapter. Vagrant is 192.168.33.10 and the host PC is 192.168.33.1.
With Windows Firewall disabled, XDebug connects to PHPStorm. But I obviously don't want to leave my firewall off.
So I've tried to open a port in Windows Firewall with the following Inbound Rule settings:
General
Enabled: Check
Action: Allow the connection
Program and Services
All programs that meet the specified conditions: Checked
Services
Apply to all programs and services: Checked
Protocols and ports
Protocol type: TCP
Local port: Specific Ports : 9000
Remote port : All Ports
Scope
Local IP address
Any IP address: checked
Remote IP address
Any IP address: checked
Advanced
Profiles
Domain: checked
Private: checked
Public: checked
Interface types
All interface types: checked
Edge traversal: Block edge traversal
But it's not working to allow XDebug to connect to PHP storm. I've also tried setting the protocol to UDP. And I'm aware that if this rule did work, it would be excessively open (I could tighten up the scope), but for the moment I just want to see it work before tightening it.

There is a problem with Virtualbox network host-only interface since it is loopback interface and Windows manage it in a diffrent way.
Easy way to solve this is to open 'regedit'. Search for 'HKLM:\system\CurrentControlSet\control\class{4D36E972-E325-11CE-BFC1-08002BE10318}'. There is plenty of interfaces. Simply look one named 'VirtualBox Host-Only Ethernet Adapter'. Then add new DWORD(32) key named '*NdisDeviceType' and value '1' (hex). Reboot.
I don't know if there is a need to add standard fw rules like host port 9000 allow for all, since i had it already.
More about it - http://brianreiter.org/2010/09/18/fix-virtualbox-host-only-network-adapter-creates-a-virtual-public-network-connection-that-causes-windows-to-disable-services/

The simplest approach that I found: Windows Advanced Firewall (where you add/remove rules) -> right-click -> Properties (another place for en/disabling Local/Domain/Public firewalling)
Each off the three scopes (Local/Domain/Public) has a setting to exclude firewall-processing for specific network interfaces completely (!)
Turn of windows firewall for any vmware/virtualbox network interface. (unless you require it against your virtual machine)
This will allow any connection from your guest, to your host machine.

In general, it's easier to not specify rules in terms of protocols or port ranges. Rather, just let the the program executable have a firewall exception for everything. So instead of creating a rule for port 9000, just create a rule for "xdebug.exe", but don't limit it to just port 9000.
Control Panel->Windows Firewall -> click "Allow an app or feature through Windows Firewall", then add xdebug.exe (or whatever the executable name is). This will add a new set of inbound rules (one for UDP and another for TCP). Go back to the advanced settings page, find the new inbound rules that were created, and inspect each to validate thatl the "Scope" checkboxes are set (private, domain, public).
There's a way to turn on firewall logging so you can discover what is getting blocked when the firewall is on. Then you can add rules as appropriate.
http://technet.microsoft.com/en-us/library/cc787462(v=ws.10).aspx

If you have a NAT adapter on your box in addition to virtual adapter, you can change xdebug config in php.ini xdebug.remote_host parameter to the IP of physical interface on your machine. Easiest way to find out is to try to telnet to 9000 port.

Related

How can you create a route to a host using the host name in TwinCAT?

Have you ever been able to connect to a host, while you have the "Host Name" selected? I can only ever connect to a host when I select "IP Address".
I had the same problem. I discovered that it has to do with firewall settings. In order to connect via hostname you need to have "File and Printer Sharing" enabled in Windows Firewall.
I did some quick testing just now and it appears that you only need to have File Sharing open on the XAE PC, not the target.
EDIT:
After further research, I believe that using hostnames for connections makes use of NetBios name resolution in Windows. This requires UDP port 137 to be open (strangely, only for inbound connections on the originating PC). Enabling File and Printer Sharing in the firewall opens this port, among others. For more granularity, you can open Advanced Settings in Windows Firewall and enable just File and Printer Sharing (NB-Name-In) under Inbound Rules.

Devilbox Auto DNS on Windows

I started using devilbox (https://github.com/cytopia/devilbox) which gives me a great and really easy to setup LAMP server.
Following the docs for Windows Auto DNS, you should make 127.0.0.1 your default DNS of your "active network adapter". However:
Setting DNS in my Wireless Adapter works but leads to losing Internet Access when docker/devilbox isn't running (as the DNS Server isn't running at this point)
Setting it on vEthernet Adapter (Hyber-v Virtual Ethernet adapter, probably created by Docker) works too but resets itself upon restarting
Setting it within Docker > Dashbord > Settings has no effect at all (probably because it is only for within docker and not on the
host)
I can eighter set the alternate DNS in Solution 1 to e.g. 8.8.8.8 OR I have to edit DNS the vEthternet everytime I start devilbox. I therefore highly suspect that I'm missing something, and as the official docs are thin on this topic:
How can I setup Devilboxes DNS for Windows permanently?

Access xampp from VMWARE to Public IP

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.

Windows Azure Virtual Machine - Opening a port

I am trying to open a port in a Windows Azure virtual machine. I have a game listening on that port, and I am able to access it via localhost, so the game is running.
I have also opened the port in the firewall and created an endpoint in the virtual machine, but the port doesn't seem to be open to the outside world. I have tried accessing it both via the IP address and the DNS with the same results.
Is there anything else I should do? I have looked up several tutorials online and can't figure out what I am doing wrong.
this has changed to this
I would recommend ignoring 100% of what is on google at the moment
Irina, make sure you have configured your endpoint properly by setting the private and public port. Here's a documentation that explains the steps to accomplish this...
http://www.windowsazure.com/en-us/documentation/articles/virtual-machines-set-up-endpoints/
It's easy via Azure CLI, for example , open port 80
$ az vm open-port -g MyResourceGroup -n MyVm --port 80
Open multiple ports at the same time
az vm open-port -g MyResourceGroup -n MyVm --port 80-100 --priority 100
Open all..
az vm open-port -g MyResourceGroup -n MyVm --port '*'
Pay special attention to this parameter,Must be unique for each rule
--priority : Rule priority, between 100 (highest priority) and 4096 (lowest priority).
Must be unique for each rule in the collection. Default: 900.
This is a two step process:
Configure the port rule in the Azure Portal (No need of any restarts. The effect takes place in a few minutes.)
Here are the steps (at the time of writing): Click on the VM -> Click on 'Networking' -> Click 'Allow inbound port rule'
Configure the port rule in the VM's own Firewall - this depends on the Operating System your VM has got (OR disable this firewall)
Here are the steps for Windows 10:
Open 'Windows Firewall with Advanced Security' Desktop App -> Click on 'Inbound Rules' on the left panel -> Click on 'New Rule' in the Actions panel on the right. The following screenshots explain the rest.
Now the application listening to the port can be reached over the internet.
For future reference, if you're trying to listen to 3000 or that range it simply does not work.
Go to the 8080's range, make the inbound rule and you're up and running.
Probably this is the latest solution at a time of writing this answer:
You need to create a Network Security Group (or use an existing one). The easiest way is to search for Network Security Groups in the search resources bar. If there is an existing NSG, click on it and find inbound security rules from the settings. Then add an inbound rule with your desired port.For example, I opened port 8080 on my VM with settings shown in picture below.
More info: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-nsg-quickstart-portal/
In addition to described, you may need to create inbound rule in VM firewall. The settings in portal create forwarding from public IP towards VM. VM itself should allow applications to listen on the port.
This may explain why this didn't work for Irina on some ports and worked on other ports.
Check the Windows firewall on the VM also. If port 8080 is not added in firewall inbound rules, then make sure to add a new inbound rule to allow access to port 8080. (Remotely login to your VM. Windows Defender Firewall -> Advanced Settings)
Source port ranges: * (allows any source port)
After you've created a VM that's configured to serve web requests on the standard TCP port 80, you can:
Create a network security group.
Create an inbound security rule allowing traffic and assign values to the following settings:
- Destination port ranges: 80
- Source port ranges: * (allows any source port)
- Priority value: Enter a value that is less than 65,500 and higher in
priority than the default catch-all deny inbound rule.
Associate the network security group with the VM network interface or subnet.
it's assumed you've already started the appropriate services and opened any OS firewall rules on the VM
for other example : port ranges: 2022-2023

Resolve host name to an ip address

I developed a client/server simulation application. I deployed client and server on two different Windows XP machines. Somehow, the client is not able to send requests to the server.
I tried below options:
Pinged server machine successfully from client using ip-address.
Pinged client machine successfully from server using ip-address.
Checked netstat command line tool from both machines. Server is in LISTENING mode and client is in SYS_SENT mode. But the foreign address it is using to send is host name not the ip address.
Pinged server machine unsuccessfully using host name from client.
Pinged client machine successfully using host name from server.
I feel the problem is when the client is trying to connect to the server using the host name.
Could you please let me know how to force an application to use an ip address instead of a host name? Is there any other way to map the host name to an ip address?
Go to your client machine and type in:
nslookup server.company.com
substituting the real host name of your server for server.company.com, of course.
That should tell you which DNS server your client is using (if any) and what it thinks the problem is with the name.
To force an application to use an IP address, generally you just configure it to use the IP address instead of a host name. If the host name is hard-coded, or the application insists on using a host name in preference to an IP address (as one of your other comments seems to indicate), then you're probably out of luck there.
However, you can change the way that most machine resolve the host names, such as with /etc/resolv.conf and /etc/hosts on UNIXy systems and a local hosts file on Windows-y systems.
Try tracert to resolve the hostname. IE you have Ip address 8.8.8.8 so you would use; tracert 8.8.8.8
You could use a C function getaddrinfo() to get the numerical address - both ipv4 and ipv6.
See the example code here
This is hard to answer without more detail about the network architecture. Some things to investigate are:
Is it possible that client and/or server is behind a NAT device, a firewall, or similar?
Is any of the IP addresses involved a "local" address, like 192.168.x.y or 10.x.y.z?
What are the host names, are they "real" DNS:able names or something more local and/or Windows-specific?
How does the client look up the server? There must be a place in code or config data that holds the host name, simply try using the IP there instead if you want to avoid the lookup.
Windows XP has the Windows Firewall which can interfere with network traffic if not configured properly. You can turn off the Windows Firewall, if you have administrator privileges, by accessing the Windows Firewall applet through the Control Panel. If your application works with the Windows Firewall turned off then the problem is probably due to the settings of the firewall.
We have an application which runs on multiple PCs communicating using UDP/IP and we have been doing experiments so that the application can run on a PC with a user who does not have administrator privileges. In order for our application to communicate between multiple PCs we have had to use an administrator account to modify the Windows Firewall settings.
In our application, one PC is designated as the server and the others are clients in a server/client group and there may be several groups on the same subnet.
The first change was to use the functionality of the Exceptions tab of the Windows Firewall applet to create an exception for the port that we use for communication.
We are using host name lookup so that the clients can locate their assigned server by using the computer name which is composed of a mnemonic prefix with a dash followed by an assigned terminal number (for instance SERVER100-1). This allows several servers with their assigned clients to coexist on the same subnet. The client uses its prefix to generate the computer name for the assigned server and to then use host name lookup to discover the IP address of the assigned server.
What we found is that the host name lookup using the computer name (assigned through the Computer Name tab of the System Properties dialog) would not work unless the server PC's Windows Firewall had the File and Printer Sharing Service port enabled.
So we had to make two changes: (1) setup an exception for the port we used for communication and (2) enable File and Printer Service in the Exceptions tab to allow for the host name lookup.
** EDIT **
You may also find this Microsoft Knowledge Base article on helpful on Windows XP networking.
And see this article on NETBIOS name resolution in Windows.

Resources