在我的工作场所,我们有一个 WAN 连接多个远程地点。这些远程地点通过 ISDN 连接思科路由器,或者在某些情况下,通过 Centrex 数据电路连接,以提供互联网和 WAN 连接。思科路由器产品允许在网络服务器上使用 TFTP ("简单文件传输协议") 来读取和写入配置文件。每当路由器配置更改时,将配置文件保存在 Linux 服务器上以维护备份非常重要。
请注意,Red Hat 默认禁用 TFTP 服务,因为它如果配置不当可能会成为真正的安全漏洞。TFTP 守护进程允许任何人读取和写入文件而无需进行身份验证。我个人设置的方式是创建一个 ``/tftpboot/'' 目录,由 root 拥有,然后修改 ``/etc/inetd.conf'' 文件以指定文件位置
tftpd dgram udp wait root /usr/sbin/tcpd in.tftpd /tftpboot |
注意:注意:添加 ``/tftpboot'' 路径在上述行末尾明确指出 TFTP 守护进程被允许访问文件的位置。虽然实际上你可以省略这部分,并允许 TFTP 访问系统上的任何文件,但由于 TFTP 被认为存在一定的安全风险,这可能是一个非常糟糕的主意。
启用 TFTP 服务后,不要忘记输入
killall -HUP inetd |
上述命令重启 INETD 守护进程,以识别您对 inetd.conf 文件所做的任何更改。
创建路由器配置文件备份涉及 3 个步骤:设置现有文件(或创建新文件)的权限以允许写入,写入备份文件,然后重置权限以限制对文件的访问。以下是路由器备份会话示例
mail:~# cd /tftpboot mail:/tftpboot# chmod a+w xyzrouter-confg chmod: xyzrouter-confg: No such file or directory mail:/tftpboot# touch xyzrouter-confg mail:/tftpboot# chmod a+w loyola-confg mail:/tftpboot# telnet xyzrouter Escape character is '^]'. User Access Verification Password: **** xyzrouter> enable Password: **** xyzrouter# write network Remote host []? 123.12.41.41 Name of configuration file to write [xyzrouter-confg]? Write file xyzrouter-confg on host 123.12.41.41? [confirm] Building configuration... Writing xyzrouter-confg !! [OK] xyzrouter# exit Connection closed by foreign host. mail:/tftpboot# chmod a-wr,u+r xyzrouter-confg mail:/tftpboot# exit |
如果路由器发生故障(例如,由雷雨期间的电涌引起),这些备份文件可以帮助重新加载路由器配置。同样,从配置文件恢复也涉及 3 个步骤:设置现有文件的权限,加载文件,然后重置权限以限制对文件的访问。以下是路由器恢复会话示例。
mail:~# cd /tftpboot mail:/tftpboot# chmod a+r xyzrouter-confg mail:/tftpboot# telnet xyzrouter Escape character is '^]'. User Access Verification Password: **** xyzrouter> enable Password: **** xyzrouter# config network Host or network configuration file [host]? Address of remote host [255.255.255.255]? 123.12.41.41 Name of configuration file [xyzrouter-confg]? Configure using loyola-confg from 123.12.41.41? [confirm] Loading xyzrouter-confg from 123.12.41.41 (via BRI0): ! [OK - 1265/32723 bytes] xyzrouter# write xyzrouter# exit Connection closed by foreign host. mail:/tftpboot# chmod a-wr,u+r xyzrouter-confg mail:/tftpboot# exit |