Archive for the tag 'IP'

How to find IPs and IP networks behind each interface

To find the IPs of your network interfaces use ip addr show and to find the IP networks behind each interface use ip route show.

$ ip addr show

1: lo: mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
2: eth0: mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:08:74:22:5c:61 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.2/24 brd 192.168.1.255 scope global eth0
inet 192.168.1.4/24 brd 192.168.1.255 scope global secondary eth0:1

# ip route show

192.168.52.12 dev ppp0 proto kernel scope link src 117.114.119.119
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.1
169.254.0.0/16 dev eth0 scope link metric 1000
default dev ppp0 scope link

Add or delete static routes from the Linux IP routing table.

You need to know the network/subnet you wish to reach, also the interface you wish this route to be added to, i.e., which interface to use to reach the subnet.

How to reach another network, 10.20.30.0/24, that is reachable via a router on the 192.168.1.0/24 network, 192.168.1.254.

The following ip route command would add the desired route to the kernel routing table:

ip route add 10.20.30.0/24 via 192.168.1.254 dev eth1

Note: eth1 is connected to 192.168.1.0/24

Removing a default domain from one of your IP addresses in Plesk

Once you have set a domain to be the default domain for a specific IP address in Plesk, you will not be able to deselect that particular domain. At this point you only have the option of switching the IP address to another domain on your server.

If you would like to do this there is a solution using MySQL commands. You can manually set the default_domain_id to zero for a specific IP address directly in the Plesk database. Make sure to replace IPADDRESS with your address.

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -e “UPDATE IP_Addresses SET default_domain_id = 0 WHERE ip_address = ‘IPADDRESS’;”

The following command will remove the default domain setting for all IP addresses:

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -e “UPDATE IP_Addresses SET default_domain_id = 0;”

Then you need to use the command ‘websrvmng’ to apply changes:

# /usr/local/psa/admin/sbin/websrvmng -a -v

Reference: http://parallels.com/

How to block a specific IP Address from accessing your Website

If you have annoying visitors, site scrapers, or spammers, you may find it useful to block these users from accessing your website content. You can block bad visitors by IP Address (or blocks of IP Addresses) using a .htaccess file. Below are some useful examples.

In the following example, all IP Addresses and domains are accepted, except for xxx.xxx.xxx.xxx and bad-site-example.com.

# allow all except those indicated here
<Files *>
order allow,deny
allow from all
deny from xxx.xxx.xxx.xxx
deny from .*bad-site-example\.com.*
</Files> 

In the following example, all IP addresses are denied access except for xxx.xxx.xxx.xxx and good-site-example.com.

# Deny access to everyone, except those listed here:
<Files *>
order deny,allow
deny from all
allow from xxx.xxx.xxx.xxx
allow from .*good-site-example\.com.*
</Files> 
SBDavid

Finding your current IP Address

Finding your current IP Address

There are several free websites that offer you the ability to find your current IP Address. The following is a short list of websites that will provide you this information:

http://whatismyIP.com
http://IPChicken.com
http://tracemyip.org

Every device connected to the public Internet is assigned a unique number known as an Internet Protocol (IP) address. IP addresses consist of four numbers separated by periods, e.g. 127.0.0.1. Knowing the current IP Address of your home computer can be helpful when troubleshooting an issue.

« Prev - Next »