in ,

Kali Linux – Configuring network services and secure communications

Kali Linux Tutorials – Configuring network services and secure communications

How To Configure Network Services and Secure Communications on Kali Linux

The first step in being able to use Kali is to ensure that it has connectivity to either a wired or wireless network to support updates and customization.

You may need to obtain an IP address by DHCP (Dynamic Host Configuration Protocol), or assign one statically. First, confirm your IP address using the ifconfig command from a terminal window, as shown in the following screenshot:

In this particular case, the VM has been assigned an IP address of
If an IP address was not obtained, an address can be assigned by DHCP using the command dhclient eth0 (or other available interfaces, which will depend on the specific configuration of the system being used).

If a static IP address is used, additional information may be required. For example, you can assign a static IP of as follows:

host IP address:
subnet mask:
default gateway:
DNS server:

Enter a terminal window and enter the following command:

root@kali:~# ifonconfig eth0
root@kali:~# route add default gw
root@kali:~# echo nameserver > /etc/resolv.conf

Changes made to IP settings are non persistent, and will be lost when Kali Linux is rebooted. To make the changes permanent, you will need to edit the /etc/network/ interfaces file, as shown in the following screenshot:

By default, Kali Linux does not start with the DHCP service enabled. Doing so announces the new IP address on the network, and this may alert administrators about the presence of the tester. For some test cases, this may not be an issue, and it may be advantageous to have certain services start automatically during boot up.

This can be achieved by entering the following commands:

root@kali~# update-rc.d networking defaults

root@kali~# /etc/init.d/networking restart

Kali Linux installs with network services that can be started or stopped as required, including DHCP, HTTP, SSH, TFTP, and the VNC server. These services are usually invoked from the command line, however, some are accessible from the Kali menu.

Adjusting network proxy settings

Users located behind an authenticated or unauthenticated proxy connection must modify bash.bashrc and apt.conf. Both files are located in the /root/etc directory.

1/ Edit the bash.bashrc file, as shown in the following screenshot, use a text editor to add the following lines to the bottom of the bash.bashrc file:

export ftp_proxy="ftp://user:password@proxyIP:port"
export http_proxy="http://user:password@proxyIP:port"
export https_proxy="https://user:password@proxyIP:port"
export socks_proxy="https://user:password@proxyIP:port"

2/ Replace proxyIP and port with your proxy IP address and port number respectively, and replace the username and password with your authentication username and password. If there’s no need to authenticate, write only the part following the @ symbol.

3/ In the same directory, create the apt.conf file and enter the following command lines, as shown in the following screenshot:

4/ Save and close the file. Log out and then log in to activate the new settings.


Securing communications with Secure Shell

To minimize detection by a target network during testing, Kali Linux does not enable any externally-listening network services. Some services, such as Secure Shell (SSH), are already installed. However, they must be enabled prior to use.

Kali comes preconfigured with default SSH keys. Before starting the SSH service, it’s a good idea to disable the default keys and generate a unique keyset for use.

Move the default SSH keys to a backup folder, and then generate a new SSH keyset using the following command:

dpkg-reconfigure openssh-server

The process of moving the original keys and generating the new keyset is shown in the following screenshot.

To verify that the newly generated keys are unique, calculate their md5sum hash values, and compare with the original keys as shown in the following screenshot.

To start the SSH service using the menu, select Applications | Kali Linux | System Services | SSHD | SSHD Start.
To start SSH from the command line :

root@kali:~# etc/init.d/ssh start

To verify that SSH is running, perform a netstat query, as shown in the following command:

root@kali:~# netstat -antp

The SSH daemon is listening on port 22 in the previous example. To stop SSH, use
the following command:

root@kali:~# /etc/init.d/ssh stop

That all, we have down with Configuring network services and secure communications on Kali Linux.

If you have encountered a problem or you have any questions or remarks please feel free to set a comment.

If this article helped you to solve your problem please feel free to share it with your friends … with love and prosperity K4LINUXTEAM.

With Love and Prosperity K4LINUX-TEAM.


What do you think?

1080 points
Upvote Downvote

Total votes: 2

Upvotes: 2

Upvotes percentage: 100.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Penetration Testing with Kali Linux free training course

Kali Ebook – Mastering Kali Linux For Advanced Penetration Testing

Penetration Testing with Kali Linux free training course

Kali Linux Tutorial – Creating an encrypted folder