Showing posts with label ip. Show all posts
Showing posts with label ip. Show all posts

Finding Interface Name Using IP Address

Tags: April 23, 2014 7:47 AM
0 comments

Getting network interface name using IP address could be accomplished by issuing:

$ ip addr show | grep "192.168.1.2" | awk '{print $7}'
or another alternative:
ifconfig | grep -B 1 "192.168.1.2" | head -n1 | awk '{print $1}'
Both command would output the name of interface such as eth0, eth1, etc.

Reference

Share on Facebook Twitter

Linux Show Selected Route for Particular IP Address

Tags: April 8, 2014 11:11 AM
0 comments

When having multiple gateway it is very useful know which route is used by particular address. So we can know if the routing is work as expected. For this task we can use ip route get command.

Show Selected Route for particular IP

ip route get 8.8.8.8
8.8.8.8 via 192.168.42.129 dev usb0  src 192.168.42.243 
    cache

Share on Facebook Twitter