Ufw
無法獲取 ufw 規則以允許 pc 和立體聲之間的 dlna/upnp 流量
我正在使用 pulseaudio-dlna+pavucontrol 將我的筆記型電腦 (192.168.2.159) 的聲音輸出定向到我的 yamaha 立體聲音響 (192.168.2.160) 這僅在我禁用 ufw 時有效
sudo ufw disable
我很難找到正確的規則來允許特定的流量。
sudo tail -f /var/log/ufw.log
顯示塊消息,例如:
Apr 21 20:40:50 foo kernel: [ 5349.911161] [UFW BLOCK] IN=wlo1 OUT= MAC=01:00:5e:7f:ff:ff:ff:ff:ff:65:c3:04:08:00 SRC=192.168.2.160 DST=239.255.255.250 LEN=204 TOS=0x00 PREC=0x00 TTL=1 ID=0 DF PROTO=UDP SPT=40760 DPT=51200 LEN=184
如您所見,我已經添加了各種規則,但沒有達到預期的效果,當我找到正確的配置時,我想再次刪除:
sudo ufw status verbose
Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), disabled (routed) New profiles: skip To Action From -- ------ ---- 22/tcp ALLOW IN 192.168.2.0/24 80/tcp ALLOW IN 192.168.2.0/24 80/udp ALLOW IN 192.168.2.0/24 1900/udp ALLOW IN 192.168.2.0/24 1900/udp ALLOW IN 239.255.255.0/24 1900/udp ALLOW IN Anywhere 3689 ALLOW IN Anywhere 1901/udp ALLOW IN 192.168.0.0/24 1900/udp 51200/udp ALLOW IN 192.168.0.0/24 40760/udp 8080/udp ALLOW IN 192.168.0.0/24 40760/udp 40760/udp ALLOW IN 192.168.0.0/24 51200/udp 51200/udp ALLOW IN 239.255.255.0/24 40760/udp 8080/tcp ALLOW IN 192.168.2.0/24 3393/tcp 40760/udp ALLOW IN 239.255.255.0/24 51200/udp 1900/udp (v6) ALLOW IN Anywhere (v6) 3689 (v6) ALLOW IN Anywhere (v6) 40760/udp ALLOW OUT 239.255.255.0/24 51200/udp 51200/udp ALLOW OUT 239.255.255.0/24 40760/udp
我能夠找到正確的規則。該應用程序
iftop
可以方便地查看哪些埠和地址可以看到流量。ufw disable # Now start playback and watch the traffic with: iftop -i wlo1 -N -n -P
這些規則使我可以進行 ufw 活動和立體聲播放:
ufw allow proto udp from 192.168.2.0/24 to any port 8080 ufw allow proto udp from 192.168.0.0/24 port 1900 to any port 1901 ufw enable