Some very useful networking tricks for Linux/UNIX users.

Posted: August 11, 2014. At: 2:11 PM. This was 4 years ago. Post ID: 7616
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

Get your gateway IP address with curl on the command line.

[homer@localhost ~]$ echo $(curl -# http://ipecho.net/plain)
######################################################################## 100.0%
153.107.97.164

Another way to list the IP addresses of your network interfaces. Using the ip command.

[homer@localhost ~]$ ip a | grep inet*
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
    inet 192.168.233.138/24 brd 192.168.233.255 scope global dynamic eno16777736
    inet6 fe80::20c:29ff:fed5:77e3/64 scope link

Use the host command to get the FQDN of a host by the querying the IP address.

homer@localhost ~]$ host 8.8.8.8
8.8.8.8.in-addr.arpa domain name pointer google-public-dns-a.google.com.

List all multicast networking addresses for your network interfaces. Using the ipmaddr show command.

[homer@localhost ~]$ ipmaddr show
1:      lo
        inet  224.0.0.1
        inet6 ff02::1
        inet6 ff01::1
2:      eno16777736
        link  01:00:5e:00:00:01
        link  33:33:00:00:00:01
        link  33:33:ff:d5:77:e3
        link  01:00:5e:00:00:fb
        inet  224.0.0.251
        inet  224.0.0.1
        inet6 ff02::1:ffd5:77e3
        inet6 ff02::1
        inet6 ff01::1

Print out network adapter statistics using the ifstat command.

[homer@localhost ~]$ ifstat 
#kernel
Interface        RX Pkts/Rate    TX Pkts/Rate    RX Data/Rate    TX Data/Rate  
                 RX Errs/Drop    TX Errs/Drop    RX Over/Rate    TX Coll/Rate  
lo                     0 0             0 0             0 0             0 0      
                       0 0             0 0             0 0             0 0      
eno16777736           16 0            17 0          2185 0          4077 0      
                       0 0             0 0             0 0             0 0

Get the interface IP address using the ipconfig getifaddr command on Mac OSX.

Admins-iMac-203:~ admin$ ipconfig getifaddr en1
172.29.59.206

No comments have been made. Use this form to start the conversation :)

Leave a Reply