How to access a web server installed on Hyper-V - apache

I have installed Ubuntu on Windows 8 using Hyper V. Having also installed Apache 2 I had the notion that I was going to use this as a web dev environment. I set up an external switch so that my ubuntu installation could access the internet. So far everything was progressing swimmingly. The problem I am encountering is that I have no idea how to access the web server from my machine. I can get the IP address that ubuntu picks up and type that into my browser whereupon I am informed "It works!". That's all good but I move around among several networks and I should not have to look up the IP address every time, and that can't facilitate having multiple sites installed. I just want to be able to enter something like
"http://mytestserver/"
into my browser to access it.
Any pointers on how to set this up properly would be much appreciated.

I have always had the most success with Bridged networking in VM Guests and would definitley recommend you go with that option. What you then could do and what I have done is to assign a static IP for the server and assign the hostname as below. You will have to know what IP addressing is available or you can use 192.168.1.x if your inside your network.
The easiest way would be to assign a static IP in /etc/network/interfaces replacing the 0.0.0.0 with the correct entries for your network
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 0.0.0.0.0
netmask 0.0.0.0.0
gateway 0.0.0.0.0
broadcast 0.0.0.0.0
dns-nameservers 0.0.0.0.0 0.0.0.0.0
and then edit your /etc/hosts file and add that static IP and add the Hostname mytestserver. You will already have the localhost entry and possibly others. Just make sure you assign the Static IP address you assigned in interfaces to mytestserver. You may also have to make this same entry in your machines hosts file simply because it will not have a DNS record.
127.0.0.1 localhost
0.0.0.0 mytestserver

Related

Use sshuttle to route traffic to company's VPN server

I need to access company's internal network without using their OPENVPN server directly (My ISP blocks it). So I used an instance with a public IP, where my company is located, and have configured a OPENVPN client then used it to connect to the company's OPENVPN server.
(public IP instance) ===OPENVPN===> (Company)
Now, I need to achieve a further thing, which is working from my local machine by using VPN over SSH tunnel using sshuttle, such that the topology becomes:
(local) ===SSHUTTLE===> (public IP instance) ===OPENVPN===> (Company)
Note that public IP instance has two network adapters; eth0 (it has public IP) and tun0 (which belongs to OPENVPN)
I installed sshuttle, and tested the next command:
sshuttle --dns -r <user>#<public IP instance address> 0.0.0.0/0
It says connected after then but I still cant access anything. I tested dig and it returned results showing addresses of company's internal services. However, I still can't ping them. I tested using traceroute and it stops at some point after displaying some hops.
One important point is that I can't ping the tun0 address (on public ip instance) from my local machine.
I suspect that I need to add some routes on the intermediate public IP instance, but I am not sure.
I would appreciate any help
Thanks in advance
your setup is right but your assumptions are wrong.
Initially, check that your vpn is working fine on the jump box , if linux just check
route -n
Wrong assumptions:
sshuttle will route your dig commands , sshutle only route TCP and DNS queries are UDP
using --dns in your sshuttle meanless as you wont gain dns of vpn but of the jump box and that wont work
you should add the DNS of local vpn in your /etc/resolv.conf with target domain for local discovery
like : < call tech support to provide you with right DNS , you can find it in vpn log on jump box
search companydomain.internal
nameserver 10.x.y.z
its better to split the traffic and only target your company CIDR over sshuttle , most of them use parts of 10.0.0.0/8 instead of all traffic 0.0.0.0/0
important note: that may be your company block egress traffic to the internet over VPN access

XAMPP - can not access from public ip

before I was accessing to my xampp server from my dynamic ip. Now I installed latest version of xampp under c:\xampp3
i have no antivirus windows firewall disabled still I can not access.
Forwarding is done correctly.
My local ip is: 192.168.0.13
In router interface displayed WAN IP:
100.98.20....
but when I check it from browser that is:
94.54.225....
if I type 100.98.20.... which is displayed in router's interface it is okay from local computer but if I type it in different net not responding.
When I type 94.54.225.... not responding from anywhere.
Whats wrong here ?
My ISP gives ips many times to each other and that is why I can not access from public ? Should I buy a static ip ?
It depends on your ISP.
Your "WAN" IP is 100.98.20.... it's IPv4 ISP: Carrier-Grade NAT RFC6598
By the wiki https://en.wikipedia.org/wiki/Carrier-grade_NAT
Disadvantages
* It makes it impossible to host services
Read the wiki for more details and/or contact with your ISP for public IP address.

Knife SSL check fails when workstation is undocked

My Chef workstation is a virtual machine. I initially setup this machine with Hosted Chef server while the machine was docked in my computer's dock and hardlined to the internet.
When I undock the workstation, the knife ssl command fails with the following error:
c2-device#c2failover-VirtualBox:~$ cd chef/
c2-device#c2failover-VirtualBox:~/chef$ knife ssl check
Connecting to host api.chef.io:443
ERROR: Network Error: getaddrinfo: Name or service not known
Check your knife configuration and network settings
c2-device#c2failover-VirtualBox:~/chef$
I have since assigned a resolvable IP address to the VM workstation as it was using DHCP prior. I'm not sure how to resolve this issue or what the issue may be when undocking my workstation. Does anyone have any possible causes or solutions to the issue I'm seeing?
my network interface is configured as follows:
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address XXX.XXX.X.XXX
netmask XXX.XXX.XXX.X
gateway XXX.XXX.XX.XXX
dns-nameservers X.X.X.X
I have not been able to find much in the chef documentation about this issue. Thanks for any help in advance, I'm fairly new to Chef.
This is not related to Chef or knife. You'll need to ensure the VM is able to reach the Internet in general. Overall we do not recommend using a VM as your workstation, you the actual desktop or laptop that you work on.

Bind ip wrong in redis config

log:Creating Server TCP listening socket (myip:port): bind: Cannot assign requested address
my redis.conf
bind 10.114.234.11
when i cofig like this
bind 127.0.0.1
it works well
You likely do not currently have any interfaces set up for the 10.x.x.x subnet. If you're on any flavor of Linux, ifconfig should be able to tell you which interfaces are currently set up. For example, I'm running Mint 17:
$ ifconfig | grep "inet addr"
inet addr:127.0.0.1 Mask:255.0.0.0
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
So I (like you) would not be able to bind Redis (or most any other service requesting a TCP socket) to 10.x.x.x. If you are really trying to listen for connections on that subnet, you will need to change your network setup (how exactly that would be done depends largely on your operating system).
I also faced same issue while setting up redis for remote access. I was using google cloud platform and we created Google compute engine VM instance where we installed our Redis server. Redis doesn't ship with by default with security configured. You have to perform some steps to secure it. By updating IP address in redis.conf in bind will allow access only from that IP addresses. When we were doing it, we were getting same error.
To solve this issue we haven't added IP addresses in redis.conf file instead in Google cloud firewall rules when we add port open record in network -> IP ranges you can specify IP address which you want allow to access redis. In redis.conf file update from bind 127.0.0.1 to bind 0.0.0.0. So basically we will restrict it from Google cloud firewall rules dashboard.
Below are steps to add IP address restrictions:
Login to your google cloud console
Navigate to VPC Network -> Firewall Rules
Click on CREATE FIREWALL RULE or edit existing one if it's already there
In Source IP ranges add your IP address to allow access only - See below screenshot
Once you create this rule add this source tags under your VM instances network type and you are done.
I have faced the same issue when I changed the default redis.conf to custom Redis conf and after changing the bind as below then it started working, Please be aware that the below conf will open the Redis connection from all sources.
bind 127.0.0.1 -::1 to bind 0.0.0.0 -::1
At /etc/redis/redis.conf
Please change
bind 127.0.0.1 ::1
to
bind 0.0.0.0
then restart
/etc/init.d/redis-server restart
It's work to me

Localhost vs ip-address (e.g. 192.xxx.x.xxx)

When I host a page in /var/www/page, I can view it via:
localhost/page
192.xxx.x.xxx/page
Recently, I have started playing with websockets (using this repository).
When I activate the server, I can connect using localhost/page but not with 192.xxx.x.xxx/page (note that I can access the page but not connect to the server)
Can someone explain why?
"On most computer systems, localhost resolves to the address 127.0.0.1, which is the most-commonly used IPv4 loopback address..." (https://en.wikipedia.org/wiki/Localhost)
It's likely that the "localhost" host name is being resolved to the loopback interface IP address (127.0.0.1), as that is the standard on most machines.
If you want the server to respond to another IP address, you'll have to configure it.