Add multiple IPs to Windows Server

Imagine you have 20 IPs to add to your Windows Server and it is not an easy job to add them one by one.

To easily add them to the Windows server, you may use the following command format to add them.

netsh interface ip add address "Local Area Connection" 192.168.1.2 255.255.255.0

To add IP from 192.168.0.2 to 192.168.0.21, you may use the following command,

FOR /L %I IN (2,1,21) DO netsh interface ip add address "Local Area Connection" 192.168.0.%I 255.255.255.0

cPanel: Change the outbound email IP in Exim

If your cPanel server is a shared environment server, your server IP might be blocked by any RBL list such as SpamHaus.

As cPanel by default set the primary email as the SMTP mail IP, to enable different IPs to be send from the cPanel, you may follow the step as below,

1. Log into WHM.
2. Select Service Configuration and choose Exim Configuration Editor.
3. Find “Reference /etc/mailips for outgoing SMTP connections” and enable it.
4. Edit the file named /etc/mailips through SSH.

example.com: 192.168.0.2
sub.example.com: 192.168.0.2
example.net: 192.168.0.3
addon.example.net: 192.168.0.3
*: 192.168.0.1

Replace the host name and IPs with your desired information.

How to check DNSBL automatically?

PEAR::Net_DNSBL provides an easy way to check if a given Host or URL is listed on an DNS-based Blackhole List (DNSBL, Real-time Blackhole List or RBL) or Spam URI Realtime Blocklist (SURBL).

According to PEAR::Net_DNSBL manual, you may trigger PEAR::Net_DNSBL automatically to check certain IPs that needed.

First of all, you will need to install PEAR::Net_DNSBL as command below,
pear install NET_DNSBL

By referring to the sample script from PEAR::Net_DNSBL manual, I have modified the script to be able to send an email to me when found any IPs range that needed by me as below,

Continue reading How to check DNSBL automatically?

Basic Network Commands in Windows

Today, I will show some Network commands used in Windows Operating System. You might use some of the command daily and some of it which is useful but you have never used it.

nslookup
This is a tools that always use to check the DNS information such as ns, a, mx, txt, etc. Sometimes, it is important to check the DNS if your domain entered to the expired and you have forgotten to renew your domain name causing the domain provider temporarily change your DNS information.

tracert
tracert is trace route in Linux and it is the same like trace route, with tracert, you are allowed to understand the hop route from your PC to the server (destination).

arp -a
With the command “arp -a”, it gives you the IPs list of your internal network and easily to allow you to know which IPs used in your network if you are not using DHCP network.

ping
ping is the mostly used to understand if a domain or IP able to return the response in short time.

ipconfig
ipconfig is widely used by network administrator to test out some of the testing on the internal network and the command could be /all, /flushdns, etc.

pathping
pathping is the advance(newer version) of tracert and it show you the result in another method.

Free Proxy Server List

Sometimes, you might want to hide your IPs from the Internet to perform some task or even want to try to test some task from different country.

A proxy server has a large variety of potential purposes, including:

  • To keep machines behind it anonymous (mainly for security).
  • To speed up access to resources (using caching). Web proxies are commonly used to cache web pages from a web server.
  • To apply access policy to network services or content, e.g. to block undesired sites.
  • To log / audit usage, i.e. to provide company employee Internet usage reporting.
  • To bypass security/ parental controls.
  • To scan transmitted content for malware before delivery.
  • To scan outbound content, e.g., for data leak protection.
  • To circumvent regional restrictions.

Now, you may get the free proxy server list as URL below.
http://www.digitalcybersoft.com/ProxyList/fresh-proxy-list.shtml

What is DNS?

What would be a DNS from your mind? DNS could be Domain Name Service or Domain Name System.

By right a domain name will referring to the DNS setting and understand which web server or server should it go and an Internet User could only able to get the page work from their Browser.

Basically, DNS could be the group in 2 major group where I will separate it to parent DNS and child DNS. With Parent DNS, it meant that the DNS of your domain name set that referring to your DNS server such as ns1.mickgenie.com and ns2.mickgenie.com.

Once the parent DNS setting up, the domain will connect to the DNS server and you will have A, CNAME, MX, TXT, and so on record to refer so the subdomain, email services and some rules called from TXT will done accordingly.

Below is some of the record available.
1. Address Record (A record),
A record normally used by an IPs only where it could resolve to 4 blocked of IP which something like 127.0.0.1 and you shall not point it to a domain base such as mickgenie.com and this will cause it not working.

2. Canonical Name (CNAME),
CNAME used a user-friendly domain name such as mickgenie.com to allow a user do not need to remember the IPs based address and this is easily for a web services to connect to different server if they have more than 1 server within the subdomain.

3. Mail Exchange(MX),
MX record used for the email services and it used to recognize if you have more than 1 email server and if you have backup email services.

4. Text (TXT),
TXT record is widely used when a DNS services contain a Sender Verify Framework(SPF) were used to protect spamming record, etc.

TXT also used when you have a domain key such as Yahoo! email services protection.

How to Check Apache Connections

Apache is one of the famous web services and surpass for more than 100 Million website.

If you have experience in Server Administrator task, you surely headache on the Apache connections when it is getting tons of connections to the server. But, how could you going to check for those connections?

Some command like netstats, grep, ps, etc will very helpful to help you to understand the number of connections of the server.

Mick Genie will guide you some ways to list the Apache connection as below.

Grep port 80 (web services port)

netstat -alntp | grep :80

Check the number of connection from port 80

netstat -alntp | grep :80 | wc -l
ps auxw | grep httpd | wc -l

List the remote IPs connecting to your server on port 80

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr

List the unique remote IPs and the number of connections from each IP

netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

iptables handy guide

iptables used to setup, maintain and inspect the tables of IP packet filter rules through Linux Kernel. You can modify or manage the rules through the command from console or SSH.

To list the IPs that is being blocked, you may run the command as below.

iptables -L -n

You will get the list of the IP that is being listed from the Iptables Kernel rules as command above.

To block an IP using iptables,

iptables -D INPUT -s xxx.xxx.xxx.xxx -j DROP

where xxx.xxx.xxx.xxx is the actual IP

Continue reading iptables handy guide

Redirect A Website with mod_rewrite

.htacess is very useful when you want to manage your website. It can be used to define the value that you want, block certain IPs, etc.

To redirect a website, you do not need to hard code from every single of your page, but you may use the .htaccess rewrite to get it done.

To redirect a domain name to www such as mickgenie.com to www.mickgenie.com

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mickgenie\.com$
RewriteRule ^(.*)$ http://www.mickgenie.com [R=301,L]

To redirect mickgenie.com and www.mickgenie.com to www.mickgenie.com

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.mickgenie\.com$ [OR]
RewriteCond %{HTTP_HOST} ^mickgenie\.com$
RewriteRule ^(.*)$ http://www.mickgenie.com [R=301,L]