Windows hosts file and host name with dot - windows

This is my hosts file (c:\WINDOWS\system32\drivers\etc)
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
x.x.x.x my.hostname1
#x.x.x.x my.hostname2
x.x.x.x is my actual IP. I'm running a Tomcat 6.0 server on 127.0.0.1:80 with Windows XP (please don't blame me, not my machine). So, if I open localhost or x.x.x.x, i can see the error message of Tomcat (but that's ok, cause I've not put any project name in the URL).
If I open my.hostname1, a network error page is displayer. If I replace in my hosts file my.hostname1 with my-hostname1, the behavior is the same of localhost or x.x.x.x, so I think the problem is the dot (.) character in the host name. Is there a way to include a dot in my hostname?
Thank you
EDIT:
The ouput of running on cmd ping my.hostname1
Pinging my.hostname1[x.x.x.x] with 32 bytes of data:
Reply from x.x.x.x: bytes=32 time<1ms TTL=128
Reply from x.x.x.x: bytes=32 time<1ms TTL=128
Reply from x.x.x.x: bytes=32 time<1ms TTL=128
Reply from x.x.x.x: bytes=32 time<1ms TTL=128
Ping statistics for x.x.x.x:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

I find out it was a proxy problem, now I added an exception to my internet options, exaclty 'local*', and everything works.

Host names cant have "." inside them. Dots are used as separators for domain names.
You can use something like myhostname.domain , where domain is your domain, or just myhostname.
Read more at http://en.wikipedia.org/wiki/Fully_qualified_domain_name

Related

set proxy through windows command line without login parameters

I have some proxy applications like Ultra-surf or Tor-browser. I can set their proxy in browsers or on other applications. For example for Tor, I can set socks: to "127.0.0.1:9150" in any application.
but I want to using this proxy for CMD.
I saw these answers
netsh winhttp set proxy proxy-server="socks=localhost:9090" bypass-list="localhost"
Or
set HTTP_PROXY=http://proxy_userid:proxy_password#proxy_ip:proxy_port
I opend a CMD as an Administrato, and then I tried these commands. After each one, I tested 3 sites: "google.com" and "facebook.com" and "youtu.be". But noting was changed. "google.com" always works and "facebook.com and youtu.be" do not work. Also, It does not make difference if my proxy apllication be open or not.
Anyone knows how can I set this kind of proxy for CMD?
netsh winhttp set proxy 127.0.0.1:1080
netsh winhttp set proxy proxy-server="socks=127.0.0.1:9150" bypass-list="127.0.0.1"
netsh winhttp set proxy proxy-server="socks=localhost:9150" bypass-list="localhost"
netsh winhttp set proxy proxy-server="http=127.0.0.1:1080" bypass-list="127.0.0.1"
netsh winhttp set proxy proxy-server="https=127.0.0.1:1080" bypass-list="127.0.0.1"
set HTTP_PROXY=127.0.0.1:1080
set HTTPs_PROXY=127.0.0.1:1080
set HTTP_PROXY=#127.0.0.1:1080
set HTTPs_PROXY=#127.0.0.1:1080
set HTTP_PROXY=:#127.0.0.1:1080
set HTTPs_PROXY=:#127.0.0.1:1080
The ping response always is:
For not sensored site:
C:\>ping google.com
Pinging google.com [172.217.18.142] with 32 bytes of data:
Reply from 172.217.18.142: bytes=32 time=198ms TTL=51
Reply from 172.217.18.142: bytes=32 time=94ms TTL=51
Reply from 172.217.18.142: bytes=32 time=95ms TTL=51
Reply from 172.217.18.142: bytes=32 time=102ms TTL=51
Ping statistics for 172.217.18.142:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 94ms, Maximum = 198ms, Average = 122ms
For sensored sites:
C:\WINDOWS\system32>ping youtu.be
C:\WINDOWS\system32>ping facebook.com
Pinging facebook.com [10.10.34.35] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 10.10.34.35:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

Custom domain does not work for homestead

I'm brand new to using homestead for developing laravel sites locally. I followed two different tutorials for setup and have reinstalled about 5 times, but the custom domain name does not work for me. I'm working on a windows 10 machine and am using Virtualbox. I'm able to see the test site when I browse to 192.168.10.10 in my browser. I can ping 192.168.10.10 and get all of the packets send and receive fine. I can also ping obsessories.dev it sends and receives all of the packets successfully. I also tried changing my hosts file to use 127.0.0.1 based on another answer I saw on SO, but that didn't work for me. I use the command
vagrant reload --provision
each time I make any change to Homestead.yaml and my hosts file. I have noticed that firefox and chrome both redirect to https://obsessories.dev, but I'm not sure if that's a problem or not. I appreciate any help or insight on this in advance!
Here is my Homestead.yaml file:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: C:\Users\******\Projects\web\ssh\publickey.pub
keys:
- C:\Users\******\Projects\web\ssh\privatekey.ppk
folders:
- map: C:\Users\******\Projects\web\sites
to: /home/vagrant/code
sites:
- map: obsessories.dev
to: /home/vagrant/code/obsessories/public
databases:
- homestead
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# zray:
# If you've already freely registered Z-Ray, you can place the token here.
# - email: foo#bar.com
# token: foo
# Don't forget to ensure that you have 'zray: "true"' for your site.
output for pinging 192.168.10.10
ping 192.168.10.10
Pinging 192.168.10.10 with 32 bytes of data: Reply from 192.168.10.10:
bytes=32 time<1ms TTL=64 Reply from 192.168.10.10: bytes=32 time<1ms
TTL=64 Reply from 192.168.10.10: bytes=32 time<1ms TTL=64 Reply from
192.168.10.10: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.10.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
output for pinging obsessories.dev
ping obsessories.dev
Pinging obsessories.dev [192.168.10.10] with 32 bytes of data: Reply
from 192.168.10.10: bytes=32 time<1ms TTL=64 Reply from 192.168.10.10:
bytes=32 time<1ms TTL=64 Reply from 192.168.10.10: bytes=32 time<1ms
TTL=64 Reply from 192.168.10.10: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.10.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Joe's suggestion worked for me. I changed the domain to .local instead and reloaded vagrant and works just fine now.

Batch/cmd: saving ping logs to a file and getting the summary paragraph afterwards

I'm trying to use ping to monitor my internet connection overnight and watch for connection dropouts, packet loss, latency spikes, and so on. I have a batch file that pings google each second and records the results to a file:
#echo off
ping -t www.google.com|cmd /q /v /c "(pause&pause)>nul & for /l %%a in () do (set /p "data=" && echo(!time! !data!)&ping -n 2 localhost>nul" > ping_logs_google.txt
And I get output like this:
16:36:50.47 Pinging www.google.com [209.85.202.106] with 32 bytes of data:
16:36:51.50 Reply from 209.85.202.106: bytes=32 time=31ms TTL=47
16:36:52.52 Reply from 209.85.202.106: bytes=32 time=31ms TTL=47
16:36:53.54 Reply from 209.85.202.106: bytes=32 time=30ms TTL=47
16:36:54.58 Reply from 209.85.202.106: bytes=32 time=29ms TTL=47
16:36:55.61 Reply from 209.85.202.106: bytes=32 time=32ms TTL=47
16:36:56.64 Reply from 209.85.202.106: bytes=32 time=32ms TTL=47
.. and so on. However, when I press Ctrl-C or whatever to stop the task, I want to get the summary paragraph at the end. The one that looks like this:
Ping statistics for 209.85.202.106:
Packets: Sent = 9, Received = 9, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 29ms, Maximum = 34ms, Average = 30ms
Control-C
^C
Now, this does work when I press Ctrl-C after running just "ping -t www.google.com" in the command window itself -- it just doesn't work when I run it from the batch file. How do I make it so that I get the summary paragraph at the end when I'm finished with the batch file?
Instead of running continuously with -t, replace with "-n 100", where "100" is the number of times it will ping (or 1000 if you like). This will give you the summary at the end of your output file the same way it does in the command window. However, you'll want to remove any pauses, etc. and just it rip.

LFTP active mode with servers that do not recognize the PORT command

I am using LFTP to transfer files from a server, which unfortunately does not recognize the PORT command. I do not have control over the server (do not know in detail what server is) and I have to use the active mode.
This is the command line as:
lftp -e 'debug 10;set ftp:passive-mode off; set ftp:auto-passive-mode no; ls; bye;' -u user,password ftp://ftp.site.com
This is the debug output:
<--- 200 Using default language en_US
---> OPTS UTF8 ON
<--- 200 UTF8 set to on
---> OPTS MLST modify;perm;size;type;UNIX.group;UNIX.mode;UNIX.owner;
<--- 200 OPTS MLST modify;perm;size;type;UNIX.group;UNIX.mode;UNIX.owner;
---> USER xxxxx
<--- 331 Password required for xxxxx
---> PASS xxxxxx
<--- 230 User xxxxx logged in
---> PBSZ 0
<--- 200 PBSZ 0 successful
---> PROT P
<--- 200 Protection set to Private
---> PORT 172,16,133,11,146,168
<--- 500 Illegal PORT command
---> LIST
---> ABOR
---- Closing aborted data socket
---- Chiusura del socket di controllo
It seems that LFTP renounces to connect to data socket because the remote server does not support the PORT command. Is there a way to convince LFTP can still connect to port 20? By FTP manual obviously no problem.
The issue, I think, is not that the FTP server doesn't support the PORT command (it does), but rather, it doesn't like the IP address/port that your FTP client is sending in the PORT command.
PORT 172,16,133,11,146,168
...tells the server to connect to address 172.16.133.11, port 37544*. The interesting part here is the IP address: it's an RFC 1918 address (i.e. it's a private network address). That, in turn, suggests that your FTP client is in a LAN somewhere, and is connecting to an FTP server using a public IP address.
That remote FTP server cannot connect to a private network address; by definition, RFC 1918 address are not publicly routable.
Thus it very well could be that the FTP server is trying to make a connection to the address/port given in your PORT command, fails, thus that is why the FTP server fails the command, saying:
500 Illegal PORT command
To make a PORT command work with that FTP server, you would need to discover the public IP address that that server can connect to, to reach your client machine. Let's say that this address is 1.2.3.4. Then you would need to tell lftp to use that address in its PORT command, using the ftp:port-ipv4 option.
Chances are, though, that public IP address is the address of a NAT/router/firewall, and that that NAT/router/firewall will not allow connections, from the outside world to a high numbered port (e.g. 37544), to be routed to a machine within the LAN. This is one of the issues with active FTP data transfers, i.e. FTP data transfers which use the PORT (or EPRT) commands: they are not considered "firewall-friendly".
Hope this helps!
* - why 146,168 translates to port 37544?
According to FTP's RFC959 those parameters are:
(...) 16-bit TCP port address. This address information is broken into
8-bit fields and the value of each field is transmitted as a decimal
number (in character string representation).
146 dec = 10010010 bin = A
168 dec = 10101000 bin = B
A B
10010010 10101000 bin = 37544 dec

Windows console command for finding server site is deployed to

I have a url to a site and I vaguely remember there being a Windows console command that you can use to find the IP address of the server the site is deployed to. Can someone remind me? Also, can you tell me how to use it?
if you ping the server using the Windows command prompt, it will gives you the server IP.
ex.: ping www.google.com
C:\Users\Deleu>ping www.google.com
Pinging www.l.google.com [177.99.189.241] with 32 bytes of data:
Reply from 177.99.189.241: bytes=32 time=34ms TTL=58
Reply from 177.99.189.241: bytes=32 time=36ms TTL=58
Reply from 177.99.189.241: bytes=32 time=38ms TTL=58
Reply from 177.99.189.241: bytes=32 time=38ms TTL=58
Ping statistics for 177.99.189.241:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 34ms, Maximum = 38ms, Average = 36ms
C:\Users\Deleu>
You need nslookup.
Nslookup.exe is a command-line administrative tool for testing and
troubleshooting DNS servers. This tool is installed along with the
TCP/IP protocol through Control Panel. This article includes several
tips for using Nslookup.exe.
c:\Temp>nslookup google.com
Server: BoB.Orcon
Address: 10.1.1.1 <------ Name server
Non-authoritative answer:
Name: google.com
Addresses: 2404:6800:4006:804::1004 <----- Answer in ipv6
74.125.237.128 <----- Answer in ipv4
74.125.237.137 <----- Other answers....
74.125.237.134 .
74.125.237.132 .
74.125.237.135 .
74.125.237.133 etc
74.125.237.136 .
74.125.237.142 .
74.125.237.130 .
74.125.237.131 .
74.125.237.129

Resources