Install TFTP Server on Lightsail

Status
Not open for further replies.

Finbar

Free User
Joined
Apr 30, 2020
Messages
2
Reaction score
0
There are a couple of extra steps needed to install a TFTP server on Lightsail in order to provision Cisco 7940/7960 phones that are not well documented so I'm just recording the steps for anyone who needs them.

Setup an ftp connection to your instance:

https://lightsail.aws.amazon.com/ls...-connecting-to-linux-unix-instance-using-sftp

Open a connect to your instance:

https://lightsail.aws.amazon.com/ls...nnect-to-your-instance-virtual-private-server

Install TFTP on instance:

sudo apt-get update
sudo apt-get install tftpd-hpa xinetd

Set permissions for folders so ftp can write to them:

sudo chmod -R 777 /etc/xinetd.d
sudo chmod -R 777 /etc/default
sudo chmod -R 777 /srv/tftp

Create xinetd config file. On your local machine create a file called tftp (no extension) with the following contents:

service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -c -s /srv/tftp
per_source = 11
cps = 100 2
flags = IPv4
}

Copy this file to the /etc/xinetd.d directory on your lightsail instance.

Create the tftp config file. On your local machine create a file called tftpd-hpa (no extension) with the following contents:

# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s -R 59000:59499"

Copy this file to the /etc/default directory on your lightsail instance.

Edit the file /etc/hosts.allow and add the following line:

in.tftpd: LOCAL, <external IP>, <external IP>, <external IP>, <external IP>

You can add multiple external IP addresses corresponding to the external IP's where the Cisco remote phones are. The phones can be behind a router. But only one phone per router. If you need multiple phones behind one router install a copy of 3CX SBC at the location.

Restart the TFTP server:

sudo /etc/init.d/xinetd restart
sudo service tftpd-hpa restart

Add 2 lines to the Lightsail Instance firewall:

Custom UDP Port 69
Custom Ports 59000 - 59499

See:
https://lightsail.aws.amazon.com/ls...irewall-and-port-mappings-in-amazon-lightsail

This completes the setup for the TFTP server on the instance.

Next, go into the 3CX Management console, Go to the extensions section and select the extension.
Go to the Option tab and deselect "Disallow use of extension outside the LAN "
Go to the Phone Provisioning tab. Select Cisco 7960 as the phone, change the Interface to the external URL, add the mac address of the phone, Save and then come back to the same page and click on the Provisioning link. This will download the provisioning file to your local PC. Copy this file to the /srv/tftp folder on your instance.

You can test the server by installing tftp on a windows PC (its a windows option) and then GET the provisioning file using the external IP of the Instance.

The following procedure will provision the Cisco 7960 phone:

Unplug power cable
Hold down the # key whilst plugging in the power cable.
Keep holding the # key till the 'line' lights flash in sequence and display says "reset key sequence detected"
Within 60 seconds type 123456789*0# This will perform a factory reset of the phone and clear out any existing settings.
The phone will reboot. Wait for it to finish.
Touch the setting button (has a square with a tick mark within it)
Use th vertical rocker buttons to go down to number 9 - "Unlock Config"
Touch "select"
Type in cisco using the keypad and touch Select. Number 9 will now say Lock Config
Scroll up to 3 - Network Setup and touch Select.
Scroll down to 32 - Alternative TFTP Server and touch Yes followed by Save
Scroll down to 3 - Network Setup and touch Select.
Scroll down to 7 - Network Setup and touch Edit.
Touch the softkey (<--) to clear 0.0.0.0
Type in the Lightsail Instance External IP Address. The period is entered using the softkey (.) next to the back key.
Touch Accept and then Save.
The phone will reboot and provision.
 
Scroll down to 7 - Network Setup and touch Edit.
should read
Scroll down to 7 - TFTP Server and touch Edit.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
111,945
Messages
589,869
Members
164,836
Latest member
saranga