The need to edit the hosts file is determined by the operating system:
- On a Linux or Linux-based (e.g., Raspberry Pi) computer acting as the remote server, the /etc/hosts file must be updated to associate the computer name with its current IP address. If this is not done then the remote machine may not give permission for the host, running MPLAB® X IDE, to connect to the remote server.
- On a Windows OS computer acting as the remote server, editing the hosts file may or may not need to be done.
Linux OS
The remote machine name can be retrieved through a console window using the hostname command. The IP address can be found by using the /sbin/ifconfig command or from the Server IP Address field in the MPLAB Remote USB Communications Server application.
An example of an updated hosts file is shown in the example below. For a remote machine named MyLinux42 and an IP address of 10.13.256.171, the content of the hosts file has been edited to add line #2.
Example: Hosts File Update
27.0.0.1 localhost
10.13.256.171 MyLinux42
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
This file will need to be edited using root privileges. For example, using a Vim editor:
$ sudo vim /etc/hosts
Windows OS
In some instances, when running the remote server application in a Windows system, you may need to edit the Windows equivalent of the Linux hosts file. This is especially true if the Server Name and the Server IP Address are the same.
The Windows hosts file may be found at C:\Windows\system32\drivers\etc\hosts.
You will need administrative privileges to edit this file. For more information, see How to Edit the Hosts File.