Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Renew DHCP IP address in Ubuntu

Answer:

To rename an IP address using DHCP in Ubuntu, try enter the commands below:

1. Release the current IP

# sudo dhclient -r

2. Renew a new IP

# sudo dhclient

Block website access in Linux

Answer:

The simple way to block access to web site is to change the hosts file.

1. Open the hosts file

# sudo vi /etc/hosts

2. Change the content, such as...

0.0.0.0 microsoft.com
0.0.0.0 oracle.com

3. Save the file.

Send ARP REQUEST to a neighbour host in Linux

Answer:

The arping command allow you to Ping destination on device interface by ARP packets, using source address source.

E.g.

# arping -U 192.168.1.5

The above command send an Unsolicited ARP request to update neighbours' ARP caches.

Check remote hostname using nslookup

Answer:

You can find the hostname of remote machine using the nslookup command.

# nslookup 198.182.196.48 | grep name

48.196.182.198.in-addr.arpa     name = linux.org.

Check for the number of connection from a particular IP address

Answer:

You can check the total number of connections from a particular IP address:

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

It will give something like:

25 192.168.1.2
13 192.168.1.3
..