Print to local printer from Raspberry pi VM?

{c}guy_123

Active Member
Sep 8, 2020
32
0
26
54
Hi,
I'm sure this is possible, but I'm just not sure where to start. I've got a proxmox server running a windows VM in one location, and a raspberry pi on a remote network that's using parsec to view the VM desktop. The pi is configured to connect to the proxmox network using openvpn, and all of that works wonderfully.

There is a local wifi printer on the network the pi is connected to (remote to proxmox) and I'd like the windows VM to be able to print to this printer. Is this possible? How would I go about setting this up?

Thanks for any help in advance.
 
You might be able to send files to print over to your Raspberry Pi and print it from there depending on the printer manufacturer and driver compatibility.

It is probably also possible to set up your Raspberry as yet another VPN server and then connect from the Windows VM to there for the time needed to print your files, though that means your Raspberry can't use the Windows VM as a VPN for that time.
It depends on your setup I guess. A VPN might not be the best solution here anyway, is your printer in the same physical location as the rest of your nodes? What does your networking setup look like?
 
Thanks for your reply, here's a better description of my scenario:

Network A (192.168.0.0/24) with windows 10 VM on it -- pfsense openvpn server connected to network B via pi client
Network B (192.168.1.0/24) raspberry pi connected to local network - also vpn client to pfsense on Network A

I'm using a virtual IP in the openvpn server of 192.168.70.x the server is configured as .1 and the pi on the other network is .2

I can successfully ping the virtual IP address of the pi, but not any other machines on Network B (which includes the printer) and none of the other machines on network A can ping any machine on network B.

So, I'm not sure if what I have is a routing issue.. or something else. I think ideally just connecting both networks so local resources are available both ways would be ideal(easiest)?

Thanks for the help.
 
There is a local wifi printer on the network the pi is connected to (remote to proxmox) and I'd like the windows VM to be able to print to this printer. Is this possible? How would I go about setting this up?
the easiest way i can think of would setting up port forwarding on your pi to expose the your printer port (usually it's on port 9100) to the windows VM...

something like this:
Code:
root@pi:# echo 1 > /proc/sys/net/ipv4/ip_forward
root@pi:# echo 1 > /proc/sys/net/ipv4/conf/tun0/forwarding
root@pi:# iptables -t nat -A PREROUTING -i tun0 -p tcp --dport 9100 -j DNAT --to 1.2.3.4:9100 # replace 1.2.3.4 with the local IP address of the printer

above should forward incoming packets from tun0 interface (your VPN interface) on port 9100 to the IP address of the printer on the pi's local network.

from there you should be able to use the IP address of the pi as a network printer in your windows VM.

if that works out, you could make it persistent by editing /etc/network/interfaces and use post-up directives to run the commands automatically.
you could also run a script on the pi after the openvpn connected successfully [0]

hope this helps!

[0]: https://askubuntu.com/questions/28733/how-do-i-run-a-script-after-openvpn-has-connected-successfully
 
  • Like
Reactions: datschlatscher

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!