![为什么tftp直接访问请求到不同网络接口的不同文件夹](https://linux22.com/image/99752/%E4%B8%BA%E4%BB%80%E4%B9%88tftp%E7%9B%B4%E6%8E%A5%E8%AE%BF%E9%97%AE%E8%AF%B7%E6%B1%82%E5%88%B0%E4%B8%8D%E5%90%8C%E7%BD%91%E7%BB%9C%E6%8E%A5%E5%8F%A3%E7%9A%84%E4%B8%8D%E5%90%8C%E6%96%87%E4%BB%B6%E5%A4%B9.png)
这是我的/etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
我的主机上有两个接口:
- 洛:127.0.0.1
- virbr1:192.168.122.1
我分别通过2个接口连接tftp服务器。
tftp 127.0.0.1
get somefile
该文件是从 /tftpboot 获取的
tftp 192.168.122.1
get somefile
该文件是从获取的/var/lib/tftp
我不知道这个/var/lib/tftp
配置来自哪里。或者也许通过 192.168.122.1,tftp 服务器会回退到某些默认配置?
提到我也没有修改 /etc/xinetd.conf:
defaults
{
# The next two items are intended to be a quick access place to
# temporarily enable or disable services.
#
# enabled =
# disabled =
# Define general logging characteristics.
log_type = SYSLOG daemon info
log_on_failure = HOST
log_on_success = PID HOST DURATION EXIT
# Define access restriction defaults
#
# no_access =
# only_from =
# max_load = 0
cps = 50 10
instances = 50
per_source = 10
# Address and networking defaults
#
# bind =
# mdns = yes
v6only = no
# setup environmental attributes
#
# passenv =
groups = yes
umask = 002
# Generally, banners are not used. This sets up their global defaults
#
# banner =
# banner_fail =
# banner_success =
}
includedir /etc/xinetd.d
答案1
我自己找到了答案,在我的配置中virbr1 interface
,我为我的虚拟网络接口指定了 tftp 根。
<network>
<name>pxe_bridge</name>
<uuid>17970555-f3dc-40ee-a2af-16f0898a5ff6</uuid>
<forward mode='nat'/>
<bridge name='virbr1' stp='on' delay='0' />
<ip address='192.168.122.1' netmask='255.255.255.0'>
<tftp root='/var/lib/tftp' />
<dhcp>
<range start='192.168.122.2' end='192.168.122.254' />
<bootp file='pxelinux.0' />
</dhcp>
</ip>
</network>
虽然我还是很迷茫
为什么有tftp配置为网络接口。
我也看到了tftp配置为了DHCP服务器。
PXE 安装受益于这些功能。
但我还是觉得奇怪,有什么意见吗?