Change your MAC address on Linux with the command line.

To change your MAC address in Linux, you just need to issue these few commands, and then re-run dhcp or reconfigure the interface. This works for both wired and wireless cards. Bring down the interface. jason@eyjafjallajkull:~$ sudo ifconfig eth0 down [sudo] password for jason:jason@eyjafjallajkull:~$ sudo ifconfig eth0 down [sudo] password for jason: Set a new … Read more

Another way to get the IP address of your machine with the arp command.

This command will lookup the network adapter that you are using and return the gateway IP address. jason@eyjafjallajkull:~$ arp -n | grep : | awk ‘{print $1}’ 10.10.0.1jason@eyjafjallajkull:~$ arp -n | grep : | awk ‘{print $1}’ 10.10.0.1 This looks for the : character that is in the MAC address like this. jason@Yog-Sothoth:~$ arp -n … Read more

What is the loopback address of your network interface?

The loopback address of the network interface, usually 127.0.0.1, is the address used by the operating system to access the network interface itself. This is represented in IPv6 as 0:0:0:0:0:0:0:1:/128 or ::1/128 when compressed. This gives the computer user a way to ping a network interface and verify that it is actually working. The ping6 … Read more

Some very useful networking tricks for Linux/UNIX users.

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[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 … Read more

How to get the geographical location of an IP address.

How to get the geographical location of an IP address. This simple command will get this for you. [jason@darknet:~] curl ipinfo.io/203.113.124.148 ; echo "" { "ip": "203.113.124.148", "hostname": "No Hostname", "city": "", "region": "", "country": "TH", "loc": "13.7500,100.4667", "org": "AS9737 TOT Public Company Limited" }[jason@darknet:~] curl ipinfo.io/203.113.124.148 ; echo "" { "ip": "203.113.124.148", "hostname": "No … Read more

Another way to print your IP address in Linux. This is a very useful one liner.

This simple one liner will print out your IP address and then IPv6 equivalent if you have it set. [homer@localhost ~]$ ifconfig enp6s1 | awk ‘/inet/ { print $2 } ‘ | sed -e s/addr:// 192.168.1.2 fe80::213:46ff:fe3a:283[homer@localhost ~]$ ifconfig enp6s1 | awk ‘/inet/ { print $2 } ‘ | sed -e s/addr:// 192.168.1.2 fe80::213:46ff:fe3a:283 Here … Read more

How to convert an IP address to binary. This is very easy with this command.

This simple one-liner allows conversion of an IP address from decimal to binary. I came up with this after playing around with cut and grep. homer@deusexmachina ~/Documents $ ipcalc 172.18.31.2 | grep Address | cut -b 33-68 10101100.00010010.00011111. 00000010homer@deusexmachina ~/Documents $ ipcalc 172.18.31.2 | grep Address | cut -b 33-68 10101100.00010010.00011111. 00000010 The -b parameter … Read more

How to renew your network interface IP address on Linux with the dhclient command.

The dhclient command on Linux is used to renew an IP address for a network interface. Here i am using Fedora 19 with the new standardised network interface names. root@neo homer# dhclient -v wlp0s26f7u5 Internet Systems Consortium DHCP Client 4.2.5 Copyright 2004-2013 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/   Listening … Read more

Networking script I am working on. This prints some information about your machine.

This Perl script will print some information about your networking set-up on your Linux machine. #!/usr/bin/perl   use warnings;   $iface = "eth0";   @data = `ifconfig`;   $net = $data[1];   $kernel = `uname -r`;   printf("\n*————————————-*\n");   printf("The IP of %s is:%s\n", $iface, $net); printf("The kernel version is: %s\n", $kernel);   printf("\n*————————————-*\n");#!/usr/bin/perl use … Read more