Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4495

Networking and servers • bookworm nftables routing Inetrnet to bridge for IPv4 and IPv6 not working like iptables

$
0
0
Raspberry Pi OS Desktop Bookworm with all updates. Pi 4. Using the one machine for e few things as there is not much traffic. Eth0 and wlan1 are bridged. Wlan0 is working Internet connection via a hotspot. The NAT is not working for IPv4 or IPv4 + IPv6.

I started it with default of IPv4 and IPv6. Had all the problems you normally get with IPv6. I started deleting/disabling IPv6 then I found the current hotspot working only in IPv6.

I started again with IPv6 not disabled. IPv4 traffic in the LAN cannot connect to the Internet. :o

On the router machine, I can ping a Web site and get an IPv6 address. When I ping 1.1.1.1 or similar, the ping fails. Is there a way to make nftables automatically translate from local traffic to the ISP traffic?

In NFT, I had stuff like the following. Nftables documentation says that defaults to IPv4 only.

Code:

sudo nft add table nat
I had changed it to the following as inet is supposed to hanle IPv4+IPv6. I do not know if anything else is needed.

Code:

sudo nft add table inet nat
The following is my current test. I had more and there was online pages to suggest this is the minimum. There are other pages showing a mass of extra code but in the description they are trying to use a fixed address for the Internet source but the hotspot has a dynamic address.

Code:

sudo nft add table inet natsudo nft -- add chain inet nat prerounting { type nat hook prerouting priority 0 \; }sudo nft add chain inet nat postrouting { type nat hook postrouting priority 100 \; }sudo nft add rule nat postrouting oifname "wlan0" masquerade
In /etc/sysctl.conf, I uncommented the following lines.

Code:

net.ipv4.ip_forward=1net.ipv6.conf.all.forwarding=1
The documentation for nftables appears to show only complicated examples, not the simple :D ones that worked in iptables. But at the time, the ISP appeared to default to IPv4 if requests were IPv4.

Statistics: Posted by peterlite — Fri Oct 25, 2024 10:23 am — Replies 0 — Views 33



Viewing all articles
Browse latest Browse all 4495

Trending Articles