Changing Network Information In LINUX

Changing information such as IP address or MAC address or any other network information is a very useful skill because you would be able to access other networks while appearing trusted device on those networks . For example , lets say for DoS( denial-of-service ) attack , you can spoof you IP address so that the attack appears to be from another source meaning the forensic team wont be able to track or capture the IP address . This can be easily done in Linux.

Changing your IP address

Before we go on trying something cool lets go for the basics when it comes to networking in linux . The ifconfig command is one of the most basic tool you can use to examine and interact with the network connections . So lets try it out by simply typing ifconfig into the terminal , you should be seeing the following result :

➜ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.181.131  netmask 255.255.255.0  broadcast 192.168.181.255
        inet6 fe80::215:5dff:fede:3935  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:de:39:35  txqueuelen 1000  (Ethernet)
        RX packets 823  bytes 102874 (102.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 100  bytes 21022 (21.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 6  bytes 234 (234.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6  bytes 234 (234.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Now we know what ifconfig does . Now lets get to the fun part!!!!!!!!!

So to change your IP address , enter ifconfig followed by the interference you want to re-assign and the new IP address . For example lets say we want to change or reassign IP address to 192.168.181.115 to the interference , you would enter the following :

➜ ifconfig eth0 192.168.181.115

When you do this , Linux simply returns the command prompt and says nothing . No need to worry , this tells us that the command did work and the IP address has changed . Now enter ifconfig again and you should see that the IP address has changed to the one you wanted to assign to. Now you have learnt how to spoof you IP address, GOOD JOB!!!!!

Changing your network mask and broadcast

You can also change your network mask (netmask) and broadcast address with the ifconfig command. For instance, if you want to assign that same eth0 interface with a netmask of 255.255.0.0 and a broadcast address of 192.168.1.255, you would enter the following:

➜ ifconfig eth0 192.168.181.115 netmask 255.255.0.0 broadcast 192.168.1.255

You can check your network connection again with ifconfig and you should see that the IP address , netmask and the broadcast address has all changed to the one you wanted .

Spoofing your MAC address

Well you read it right . You can use ifconfig to spoof your MAC address (or HWaddr or ether). MAC address is unique globally and is often used as a security measure to keep hackers in check . Changing you MAC address to spoof a different MAC address is almost trivial and it also neutralizes the security measures. Therefore it is very useful for bypassing network access control.
Now to spoof your MAC address we wouldn't follow the same approach as we followed previously . For changing the MAC address we would need to take down the interference (eth0 in this case ) and then change the MAC address by entering ifconfig followed by the interference which is eth0 in this case and followed by hw(hardware) followed by ether(ethernet) and the new MAC address . After changing it , we bring back the interference up by using ifconfig up . Try out this example:

➜ ifconfig eth0 down
➜ ifconfig eth0 hw ether  00:11:22:33:44:55
➜ ifconfig eth0 up

Now , by entering ifconfig you should be able to see that the MAC address(HWaddr or ether) has been changed for the interference you wanted to reassign .

Conclusion

So by now you have learnt how to change network information using a simple tool ifconfig and I believe you learnt something new. Thank you for reading my blog , hope you liked it :)))

(btw this is my first blog , so please give some feedback) Well then I'll see you in the next blog with something new and fun (hopefully)

-Luqmaan Hakeem

Did you find this article valuable?

Support Luqmaan Hakeem by becoming a sponsor. Any amount is appreciated!