Ubuntu – How to find port of a network scanner for UFW

firewallscannerufw

Samsung multi-functional device SXC 3205w works perfectly with my Ubuntu 12.04 and I can scan and print over network, but only when firewall is disabled.

How can I find out which port to enable in UFW to make this printer work and have my firewall enabled?

Best Answer

You can use fallowing command to trace communication between pc and printer

sudo tcpdump -i interface | grep ip_address_of_printer

You will see output of network communication, protocol, port ...

After that you can set ufw

Another way is to use command

netstat -atu | grep ip_address_of_printer

With this command you will see active connection between pc and printer.

Also you can allow all trafic for printer ip address

sudo ufw allow from ip_address_of_printer
Related Question