[SOLVED] Unable to connect to the internet inside VMs with a NAT table.

LegoMyEggo

New Member
Dec 21, 2023
3
2
3
I'll preface this by saying yes, I am trying to run it through Wi-Fi. Ethernet is not an option right now, I intend to run a line in a few months, but for now it's just Wi-Fi.

I installed wpasupplicant through a usb drive with dpkg and got it set up and working on PVE just fine. I am able to ping inside the network and outside, as well as access the web GUI and SSH into it from another computer. My interfaces is set up like this:

Screen Shot 2023-12-21 at 5.21.02 PM.png

Here is ip a:
Screen Shot 2023-12-21 at 5.20.37 PM.png
wlp and vmbr both say UP, and at some point fwpr and tap were added; I guess when I created the VM and they are firewalls?

I attempted to set up NAT, but my VM is not able to connect to the network (or even ping internal computers) so there must be something wrong with that and/or the bridge.

If I run "ifup vmbr0" I get a warning stating this:
warning: vmbr0: post-up cmd 'echo > /proc/sys/net/ipv4/ip_forward' failed: returned 1 (/bin/sh: 1: echo: echo: I/O error)
Perhaps that's the source of the issues? I don't know what it means by I/O error, or how I could resolve it.


I'm obviously out of my depth, so if I left off any important information that I need to add let me know. Thank you.
 
Last edited:
Hi,

Code:
post-up echo > /proc/sys/net/ipv4/ip_forward
You probably meant
Code:
post-up echo 1 > /proc/sys/net/ipv4/ip_forward

Note the 1, that's important.
That also seems like the cause of the I/O error and even the NAT problem. Writing an empty string into a sysctl indeed just throws an error and won't work.
 
  • Like
Reactions: LegoMyEggo
Note the 1, that's important.
That also seems like the cause of the I/O error and even the NAT problem. Writing an empty string into a sysctl indeed just throws an error and won't work.
Hah.. To think I went back through the Wlan wiki page to double check for simple errors right before posting, yet it was still a typo. I guess I was so focused on getting the NAT part correct I didn't pay enough attention to turning on forwarding.

I'll correct that and give it a try when I get home from work tonight. I appreciate you taking the time to help.
 
Note the 1, that's important.
That also seems like the cause of the I/O error and even the NAT problem. Writing an empty string into a sysctl indeed just throws an error and won't work.
I've correct the interfaces file by adding the 1, and ifup vmbr0 no longer gives a warning. However, my vm is still not able to connect. As per the wiki, I tried to add
post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
below the Masquerade lines, but it did not fix the issue.

Edit: My interfaces inside the VM was also incorrect. After changing that to use my bridge's ip as gateway, and my router's ip as DNS, it now works. Thanks!
 
Last edited: