Build a tftp server with Docker. I'm not doing anything special.
Allow the service to listen for the tftp service
firewall-cmd --add-service=tftp --zone=public --permanent
firewall-cmd --reload
Create an image so that it can be reused. Create an appropriate directory to put the Dockerfile and the configuration file.
mkdir -p /opt/docker/tftp
cd /opt/docker/tftp
/opt/docker/tftp/tftp.df
FROM centos:centos8
RUN dnf -y update ; dnf -y install tftp-server xinetd
COPY tftp /etc/xinetd.d/tftp
CMD [ "/usr/sbin/init" ]
Create a configuration file to start tftp via xinetd
/opt/docker/tftp/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -c -u root -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
Once you have created the Dockerfile, build it. tftp first connects with 69 / udp, but after that it negotiates the port number and transfers data, so it is difficult to forward port with bridge. So it connects to the host network.
docker build --force-rm -t infraserv:tftp . -f ./tftp.df && \
docker run --cap-add sys_admin --security-opt seccomp:unconfined -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
--network host -it -d --name tftp --hostname tftp infraserv:tftp
Check with the Cisco router you had
Rdc01#copy run tftp://10.254.10.251/rdc01-config
Address or name of remote host [10.254.10.251]?
Destination filename [rdc01-config]?
!!
11944 bytes copied in 1.112 secs (10741 bytes/sec)
Rdc01#copy tftp://10.254.10.251/rdc01-config flash:
Destination filename [rdc01-config]?
Accessing tftp://10.254.10.251/rdc01-config...
Loading rdc01-config from 10.254.10.251 (via Vlan10): !
[OK - 11944 bytes]
11944 bytes copied in 0.652 secs (18319 bytes/sec)
Rdc01#
Recommended Posts