大网数据广告活动
服务器运维问答

A faulty printer doesn’t respond to ARP requests. How to spoof it from a Linux router?

· 52CE 我爱测

I have this silly printer that will answer to ARP only once in a while (relatively rarely, sometimes one has to wait 5 minutes to get a connection). However when I add its MAC manually to the ARP table on a client machine, it wor…

问题原文

原帖链接 · Michal Rus · CC BY-SA 3.0

I have this silly printer that will answer to ARP only once in a while (relatively rarely, sometimes one has to wait 5 minutes to get a connection). However when I add its MAC manually to the ARP table on a client machine, it works very well (responds to ICMP pings, prints etc. instantly).

One solution could be to add it statically to /etc/ethers on each client machine. But this is probably wrong, as new machines won’t be able to learn about it in the future.

This local network is run by a Linux router.

Another solution would then be for that router (10.77.4.1) to respond to ARP requests directed at that printer (10.77.4.5). I read some manuals and thought it would suffice to just do this on that Linux router:

$ sudo arp -i wlan0 -s 10.77.4.5 f4:81:39:86:73:cb pub

… i.e. add a manual (permanent) and published entry, but it turns out that pub functionality never worked, after quick Google™’ing?…

I also thought of using arping or arpoison to broadcast this printer’s address, but they would have to do this constantly (say, every second), for stuff to work reliably. It would be better, if the router was only responding to requests.

How can I make it do that?


This is how it looks:

# arping 10.77.4.5
ARPING 10.77.4.5
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
42 bytes from f4:81:39:86:73:cb (10.77.4.5): index=0 time=250.435 msec
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout

… and under the hood:

# tcpdump -i wlp8s0 -v arp
tcpdump: listening on wlp8s0, link-type EN10MB (Ethernet), capture size 262144 bytes
21:34:44.877417 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:45.878547 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:46.879713 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:47.880887 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:48.882064 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:49.883216 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:50.884338 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:51.134742 ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.77.4.5 is-at f4:81:39:86:73:cb (oui Unknown), length 28
21:34:51.928209 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:52.886242 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:53.886689 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:54.887869 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:55.889023 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:56.890206 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:57.891361 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:58.892543 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:34:59.893485 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:35:00.894657 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:35:01.895783 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:35:02.896968 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:35:03.898118 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44
21:35:04.899301 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.77.4.5 tell 10.77.4.100, length 44

已采纳解答

原帖链接 · Spooler · CC BY-SA 3.0

I would use this as an excuse to set up a CUPS server, as forcing ARP to work correctly in this edge case across the entire broadcast domain is more likely to cause confusion if there ever needs to be a future change of admin hands, or if networks need refactoring.

Not only can you consolidate your print management plane this way, but you can use CUPS as a central server for addressing, allowing you to focus any ARP fix on a single server. Printers that use various connection types can be represented with IPP or IPPS connections from CUPS, making client connection management much easier.

I'm not sure if this is your only printer in this environment, but even if it is CUPS is still a good solution to the issue. Some details on installation can be found here:

https://help.ubuntu.com/lts/serverguide/cups.html

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-02-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。