If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Stage 1. - IP address
To check our current IP address, we can use ifconfig. (or 'ip a' / 'ip link')Note: you may want to use the '-a' flag (ifconfig -a) to show all NICs (including the ones that are down). For more information, see here.

DHCP vs Static IPDHCP
If there is a DHCP service running on the network, you will automatically be assigned a free available IP address from its IP pool. Depending on its configuration, you may also be assigned a gateway and/or DNS addresses too.

To obtain an IP address from the DHCP service from eth0 (default wired NIC), we can do the following:

Code:

root@kali ~$ dhclient eth0
root@kali ~$

Static
If you wish to manually control your IP address, we are able to use 'ifconfig' again to alter our IP address (and subnet).

In this example we will alter it to '192.168.0.10', and then to '192.168.1.25' (with a /24 subnet).Note: This guide only covers IPv4. IPv6 is out of scope.

In both of the examples above (DHCP & static), these configurations are not persistent and may not be the same upon a restart.
To change this, we can alter the '/etc/network/interfaces' file.
First, lets create a backup.

Stage 2. - Gateway
A network gateway is responsible for connecting two different networks together.
If you're having issues accessing resources outside of your LAN subnet (e.g. WAN (the Internet), but LAN (local resources) is working), there is a good chance there is an issue with the gateway. Depending on if a DHCP service is used, as well as how it has been configured, it may push out a gateway address.

You can view the current routing path (which is '192.168.1.2' on interface 'eth0') by doing:

Stage 3. - DNSDNS
Domain Name System (DNS) is what is used to lookup 'human readable' names (e.g. www.kali.org), into IP addresses (allowing for machines to understand the destination).
In the example below we can see our DNS is pointed to '192.168.1.151'.

Host file
Before any DNS name service is queried, Kali-Linux checks the value in the 'hosts file' (/etc/hosts), to see if it contains any known value. If it finds a local value here, it will not query the first remote name server in /etc/resolv.conf.

Stage 4. - Network ConnectivityPing
The next stage is to test the values that have been set during stages #1-3, allowing us to verify the network connection.

A method to do this, is to 'ping' a remote device. We can do this by sending out a IMCP echo request, and then waiting to see if we hear a IMCP response back.
However, depending on the remote device that was choose to be pinged - if they have a firewall in place and how its configured, it may not response back to a IMCP request.

In the example below, we used 'google.com'. The response back was 4 successful replies. The result of all of this, means we have successfully been able to communicate with the device at 'google.com'.

Errors in the following example indicate that there might be an issue with the DNS (either it is set to a bad value or the address that was requested doesn't exists - such as the case in this example):

Traceroute
This shows the amount of 'hops' (each router/gateway the packet is passed through), which have been taken to reach the remote machine (as well as display the path it took). Note: Each device is separate and may have a firewall enabled on it, which as a result, will not display their result.

Stage 5. - Proxy settings
Depending on your the network that your connecting to, you may need to connect to a proxy to be able to gain WAN access.
Please double check with your network administrator if you're required to do so.

Depending on the program that you wish to use, you may need to alter its settings to match the proxy.

Bash
To configure 'bash' to use the proxy values (allowing you to use the network diagnostics mentioned above - ping & traceroute), you can do so by the following commands.
In this example the:

Apt
The recommend way to keep Kali-Linux up-to-date is by updating it using the repository. Kali-Linux uses 'apt' for its package manager. To configure apt to use the proxy values, we need to alter '/etc/apt/apt.conf'.

We will create a backup copy of the file encase we need to restore it for any reason.

Stage 6. - Virtual machine network adapter
If your using Kali-Linux in a virtual machine - you may wish to double check the settings on the virtual network adapter.Note: There are various virtual machines solutions, however this guide will only cover: VMware Fusion/Player/Workstation & Virtual Box

Bridged - This will join the current network that the host is connected too. The VM will have its own IP address. Plus will have access to the host, and any other virtual machine.

NAT (or 'Share with my Mac' if fusion) - This will create a private virtual network on the host. To external machines, it will appear to have the same IP as the host, allowing them to have access to the same resources as the host, as well as the host, and any other virtual machine.

Host-only - This will create a private virtual network on the host. It will not have external access, but it will have access to the host any other virtual machines set to the same adapter mode.

LAN segment (VMware Player/Workstation) / Internal Network (VirtualBox) - This will create a private virtual network on the host. It will not have external access and it will not have access to the host. It will only have access to any other virtual machines set to the same adapter mode and segment.

Summary: if you wish for the guest OS to have Internet access, the network adapter needs to be set to NAT or bridged.NAT is the safer option, unless the guest OS needs its own IP address on the same network as the host, then you would select bridged.