Posts Tagged ‘network’

arping in linux for getting MAC address and update ARP caches by broadcast

August 27th, 2014 Comments off

Suppose we want to know MAC address of then we can log on one linux host which is in the same subnet of, e.g.

[root@centos-doxer ~]#arping -U -c 3 -I bond0 -s
ARPING from bond0
Unicast reply from [00:21:CC:B7:1F:EB] 1.397ms
Unicast reply from [00:21:CC:B7:1F:EB] 1.378ms
Sent 3 probes (1 broadcast(s))
Received 2 response(s)

So 00:21:CC:B7:1F:EB is the MAC address of And from here we can see that IP address is now used in local network.

Another use of arping is to update ARP cache. One scene is that, you assign a new machine with one being used IP address, then you will not able to log on the old machine with the IP address. Even after you shutdown the new machine, you may still not able to access the old machine. And here's the resolution:

Suppose we have configured the new machine NIC eth0 with IP address which is already used by one old machine. Log on the new machine and run the following commands:

arping -A -I eth0
arping -U -s -I eth0 #this is sending ARP broadcast, and is the gateway address.
/sbin/arping -I eth0 -c 3 -s #update neighbours' ARP caches


  1. You can run 'arp -nae'(linux) or 'arp -a'(windows) to get arp table.
  2. Here is more about arp sproof prevention (in Chinese. statistic binding/arp firewall/small vlan/PPPoE/immune network).
  3. Here is about Proxy ARP(join broadcast LAN with serial link on router).

test telnet from VLAN on cisco router device

May 22nd, 2014 Comments off

If you want to test telnet/ping connection from one vlan to specific destination IP, here is the howto:

test-router# telnet 80 source vlan 125
Connected to
Escape character is '^]'.

ucf-c1z1-rtr-1# ping source

PING ( from 56 data bytes
Request 0 timed out
Request 1 timed out

Good luck.

Add static routes in linux which will survive reboot and network bouncing

December 24th, 2013 Comments off

We can see that in linux, the file /etc/sysconfig/static-routes is revoked by /etc/init.d/network:

[root@test-linux ~]# grep static-routes /etc/init.d/network
# Add non interface-specific static-routes.
if [ -f /etc/sysconfig/static-routes ]; then
grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do

So we can add rules in /etc/sysconfig/static-routes to let network routes survive reboot and network bouncing. The format of /etc/sysconfig/static-routes is like:

any net netmask gw
any net netmask gw

To make route in effect immediately, you can use route add:

route add -net netmask gw

But remember that to change the default gateway, we need modify /etc/sysconfig/network(modify GATEWAY=).

After the modification, bounce the network using service network restart to make the changes in effect.


  • You need make sure network id follows -net, or you'll see error "route: netmask doesn't match route address".
  • To reload all static routes in /etc/sysconfig/static-routes, you can do the following:
      # Add non interface-specific static-routes.
        if [ -f /etc/sysconfig/static-routes ]; then
           grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do
              /sbin/route add -$args