LogParser query to grab only external IP addresses from IIS logs? - iis

I tried this question over at ServerFault and didn't have any luck, so I thought I'd try here.
I'm working on a public website that is used by both external visitors and internal employees. I'm after the external visitor hits, but I can't think of a good way to filter out the internal IP ranges.
Using LogParser, what is the best way to filter IISW3C logs by IP range?
This is all I've come up with so far, which can't possibly be the best or most efficient way.
WHERE [c-ip] NOT LIKE (10.10.%, 10.11.%)
Any help is appreciated.

The only other option is to use IPV4_TO_INT and Bitwise functions in your where clause. Personally I think what you have right now will be more readable and easier to maintain.

Related

How to block users accessing site outside of UK?

Searched the web and unable to find a solution. I have an umbraco site using IIS to host on a Windows server. Any ideas on approach to block users accessing site outside the UK? Htaccess approach would be too slow.... thank you in advance!
That's quite hard to do accurately, as you could have someone based in the UK using a European network provider, which means that they might appear to come from say Holland instead of the UK. It's also possible for people to spoof their location fairly easily if they really want to get at your site.
As Lex Li mentions there are plenty of commercial databases and tools for looking up a user's location, but the accuracy of these varies considerably, not to mention the fact that some of them only support IPv4. Any of these options are going to be slow though, as you'll have to check on every request. You also have to make sure you keep the databases up to date.
Another option would be to proxy your site through something like CloudFront or CloudFlare which both support blocking traffic by country.

username.website.com OR website.com/username

I'm developing a new website with membership. Do you think any of these has advantages or disadvantages? I thought today that a mobile version will be available and I was planning m.website.com for that but in "username.website.com" case, this won't work. On the other hand, I think website.com/username is ugly.
I need and also want to know your ideas about this.
Thanks.
From a management standpoint, username.website.com will surely be greater. You have to create a new DNS record for each user. In order to do that programatically, you are going to have to manage your DNS with a service that has a API. I am pretty sure registrars like GoDaddy do not have this. Amazon has something called Route 53 that might?
username.website.com will never work as domain names are propagated via DNS servers and through millions of network devices. Any change to the domain name takes time.
Usually, if you want to handle users you can do something like this: www.website.com/users/bob so mobile version will differ only by m. prefix.
It's a lot harder to make a script that sets up subdomains than it is to make a folder for a user.
If you have a mobile site, you could fix the m.username.domain.com by making it username.domain.com/m, if you really want the subdomain.
My half a cent.

Webmail and domain. I need a solution to this problem

Im hoping you geniuses here at stackoverflow can help me with this.
Recently i had to point my domain name to a network on Ning.com to map and merge the site with the domain, so i had to add an A and CNAME record. This disconnected the link between my domain and my web host and because of this my friends cant access their email anymore. Ning doesnt offer webmail either. And im not sure if i want to use Google Apps.
Is there a way i can retain the new domain pointer to the network on Ning.com and a pointer to my web host for the webmail? Or is there any other options i can take?
Thanks you so much :)
Is it an option for you to create a new A record to a subdomain like webmail.mydomain.com?
Not sure if this qualifies as a comment or answer, depends on your situation.
This is really more of a serverfault question also, if you want to try there.
Try Google Apps. You said you weren't sure if you wanted to use GA, but there's no better way to find out than to try it. It's easy to set up and if you don't like it, you can always disable it. I have personally had a good experience using GA for webmail on a custom domain.

dns for dynamic IP

I'd like to know the best solutions to get a public static dns or IP adress to access a computer on a routed network (for example to access from the internet a PC in my home LAN).
I heard about no-ip and dyndns.
Are they good? which one is the best? Is it really reliable ?
This is a server fault question, but to provide an answer anyway, I use dyndns.org, it works nicely ( most routers even have auto update support built in, and for those that dont there desktop updater works just fine. )
dyndns.org seems to have amazingly reliable uptime, and i cant talk for noip as i have never used it. give them a try and see which one you like more.
There are several free dynamic DNS services like afraid.org, dynu.com etc. You may want to go with one which has an open API so that you can use it from within your application.
May be you can have a look at https://www.good-dns.net/
Very simple to use, provides a URL for automatic IP update, so suitable for dynamic IPs.
There a lot options available - as far as I know dyn.org are not free for while already. And I am using https://myonlineportal.net
But you have to test by yourself and figure out which suit best for you. Sometimes it's just the available domain name.

How to determine nationality based on IP address?

How can I tell the nationality of a user of my web site based on client ip?
Edit: Like commented, this question have been answered before:
https://stackoverflow.com/questions/283016/know-a-good-ip-address-geolocation-service
use the GeoIP databse. there is a free one. there are also a lot of GeoIP webServices you can use.
If you're thinking localization, let the user choose the correct language instead of doing it automatically -- or at least provide an easy way for them to change it and make it sticky via cookies. You can do ok most of the time at guessing using GeoIP, but sometimes you'll get it really wrong. Google sometimes sends my wife to the German version of their web site even though we're in the middle of the US. Using anonymization services (like TOR) will also likely result in guessing errors. Having the option to choose and keeping the choice on the computer will make it a better experience for your users.
Besides the already mentioned GeoIP database, you could also use IP2LOCATION service. It's a paid one but it will also work.
Keep in mind that all these services will give you an estimate of the location but not a very accurate geographic position. I read a networking paper once stating that this is an impossible task to accomplish (give an accurate position of an IP address).

Resources