Hack Like a Pro: Linux Basics for the Aspiring Hacker, Part 6 (Networking Basics) « Null Byte :: WonderHowTo

Welcome, my neophyte hackers!The aspiring hacker needs to know a bit ofLinuxto be successful, and probably most importantly, Linux networking. To fill that knowledge gap, I'm offering this guide on Linux networking basics.I assume that you understand a small amount of networking concepts, things like IP addresses, MAC addresses, DNS, DHCP, etc. If not, please take some time to pick up a few networking basics. Our past admin here on Null Byte,Allen Freeman, has some really good guides you should check out:How IP addresses and MAC addresses work togetherA brief history on how the Net came to beHow network packets are routedHow everything connects todayStep 1: Analyzing NetworksThe most basic linux command for analyzing networks isifconfig. It's very similar to the Windows commandipconfig. Let's take a look at it.ifconfigAs you can see in this screenshot,ifconfigconveys a significant amount of information to the user. In the very first line, we see to the far lefteth0. This is the firstwirednetwork connection,ethernet 0 (Linux usually starts counting at 0).Following this, we see the type ofnetworkbeing used (Ethernet) and thehardware address(this is the globally unique address stamped on every piece of network hardware, in this case the NIC).The second line then contains information of theIP address, in this case, 192.168.1.114, thebroadcast address(the address to send out information to all IPs on the subnet), and finally thenetwork mask(this is the info on what part of the IP address is network and which part is hosts). There is a lot more technical info there, but it's beyond the scope of a Linux basics tutorial.If we look down below to what appears to be a second paragraph, we see the start of another paragraph withloto the far left.This is theloopback addressorlocalhost. This is the address of the machine you're working on if you simply wanted to test something like a website. It generally is represented with the IP address 127.0.0.1.Step 2: Changing IP AddressesChanging IP addresses can be fairly simple in Linux. Remember that in most cases, you're going to have a dynamically assigned address from a DHCP server. In some cases, you may need to reassign the address, especially if you're hacking. This can be useful in spoofing your IP address, making network forensics more challenging, but certainly not impossible.We can do this by using theifconfigcommand with the interface we want to assign the IP to and the IP address we want. Such as:ifconfig eth0 192.168.1.115Now, when we typeifconfig, we can see that our IP address has changed to the new IP address.We can also change thenetmaskandbroadcast address, if necessary, such as:ifconfig eth0 192.168.1.115 netmask 255.255.255.0 broadcast 192.168.1.255Step 3: DHCP (Dynamic Host Configuration Server)Linux has a DHCP server that runs a daeman calleddhcpd. It's this DHCP server that assigns IP addresses to all the systems on the subnet. It also keeps logs files of which machines had which IP addresses at which time. It's this log that is often used to trace hackers in a forensic analysis after an attack.When I want to be assigned a new address from the DHCP server, I can simply call the server with the commanddhclient(different Linux distros use different DHCP clients, butBackTrackis built on Ubuntu which uses dhclient), like this:dhclientAs you can see, thedhclientcommand sends outDHCPDISCOVERrequest from the default NIC. It then gets an offer (DHCPOFFER) of 192.168.1.114 from the DHCP server, then confirms the IP assignment to the DHCP server. Now, if we typeifconfig, we can see that the DHCP server has assigned a new IP address.Step 4: DNS (Domain Name Service)DNS, or Domain Name Services, is the service that enables us to type in a domain name likewww.wonderhowto.com, which it then translates to the appropriate IP address. Without it, we would all have to remember thousands of IP addresses of our favorite websites (no small task even for a savant).One of the most useful commands for the aspiring hacker isdig, which is the equivalent ofnslookupin Windows, but offers us much more information on the domain. For instance, wedigwonderhowto.comand by adding thensoption, it will display the name server forwonderhowto.com.dig wonderhowto.com nsBy using the dig command with themxoption, we can get info on WonderHowTo's email servers.dig wonderhowto.com mxThe most common Linux DNS server is the Berkeley Internet Name Domain, orBIND. In some cases, Linux users will often refer to DNS as BIND, so don't be confused. DNS or BIND simply maps individual domain names to IP addresses.On our BackTrack system, we can point out DNS services to a local DNS server or a public DNS server. This pointing takes place in the a plain text tile named/etc/resolv.conffile. Let's open it withkwrite:kwrite /etc/resolv.confAs you can see, we are pointing to two public DNS servers to provide us with DNS services. If we want to change our DNS servers or add another server, we can simply add another line to this text file and save it. The next time DNS services are required, the Linux operating system will look to the new DNS server designated in this file.Simple, right?In my next Linux tutorial, we will look at security and permissions, so keep coming back. If you haven't already, make sure to check out thefirst five partsof this series, and if you have any questions, ask away in the comments below or hit up theNull Byte forumfor more help.PenguinphotosbyLai RyanneWant to start making money as a white hat hacker?Jump-start your hacking career with our2020 Premium Ethical Hacking Certification Training Bundlefrom the newNull Byte Shopand get over 60 hours of training from cybersecurity professionals.Buy Now (90% off) >Other worthwhile deals to check out:97% off The Ultimate 2021 White Hat Hacker Certification Bundle99% off The 2021 All-in-One Data Scientist Mega Bundle98% off The 2021 Premium Learn To Code Certification Bundle62% off MindMaster Mind Mapping Software: Perpetual LicenseRelatedNews:How to Study for the White Hat Hacker Associate Certification (CWA)How To:The Essential Skills to Becoming a Master HackerHack Like a Pro:Linux Basics for the Aspiring Hacker, Part 11 (Apache Web Servers)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 1 (Getting Started)How to Hack Like a Pro:Getting Started with MetasploitHack Like a Pro:Linux Basics for the Aspiring Hacker, Part 12 (Loadable Kernel Modules)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 5 (Installing New Software)Hack Like a Pro:Windows CMD Remote Commands for the Aspiring Hacker, Part 1Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 13 (Mounting Drives & Devices)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 21 (GRUB Bootloader)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 17 (Client DNS)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 2 (Creating Directories & Files)How To:Hack a Site Knowing a Bit of HTML (hackthissite.org) Part 3Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 9 (Managing Environmental Variables)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 22 (Samba)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 4 (Finding Files)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 25 (Inetd, the Super Daemon)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 15 (Creating a Secure Tunnel to MySQL)Goodnight Byte:HackThisSite Walkthrough, Part 6 - Legal Hacker TrainingGoodnight Byte:HackThisSite Walkthrough, Part 8 - Legal Hacker TrainingCommunity Byte:HackThisSite Walkthrough, Part 6 - Legal Hacker TrainingCommunity Byte:HackThisSite Walkthrough, Part 1 - Legal Hacker TrainingGoodnight Byte:HackThisSite Walkthrough, Part 10 - Legal Hacker TrainingCommunity Byte:HackThisSite Walkthrough, Part 2 - Legal Hacker TrainingGoodnight Byte:HackThisSite Walkthrough, Part 9 - Legal Hacker TrainingCommunity Byte:HackThisSite Walkthrough, Part 10 - Legal Hacker TrainingGoodnight Byte:HackThisSite Walkthrough, Part 7 - Legal HackerGoodnight Byte:HackThisSite Walkthrough, Part 4 - Legal Hacker TrainingHow To:Hack Wireless Router Passwords & Networks Using HydraTHE FILM LAB:Non-Linear Editing Basics, Final Cut Pro - Part 01Goodnight Byte:HackThisSite Walkthrough, Part 5 - Legal Hacker TrainingHack Like a Pro:Hacking Samba on Ubuntu and Installing the MeterpreterTHE FILM LAB:Intro to Final Cut Pro - 02Community Byte:HackThisSite Walkthrough, Part 5 - Legal Hacker TrainingCommunity Byte:HackThisSite Walkthrough, Part 9 - Legal Hacker Training