Score:0

IP Forwarding Fails Ubuntu Server 22.04

sd flag

Running 2 servers in VirtualBox. Server 1 (will be the firewall)

$ sysctl net.ipv4.ip_forwward
net.ipv4.ip_forward = 1

$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)

Anywhere on enp0s3         ALLOW FWD   Anywhere on enp0s8
Anywhere on enp0s8         ALLOW FWD   Anywhere on enp0s3
Anywhere (v6) on enp0s3    ALLOW FWD   Anywhere (v6) on enp0s8
Anywhere (v6) on enp0s8    ALLOW FWD   Anywhere (v6) on enp0s3

Server 2 (will be web server):

$ sudo ip route
default via 192.168.0.1 dev enp0s3
192.168.0.0/24 dev enp0s3 proto kernel scope link src 192.168.0.1

$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.0.1 icmp_seq=1 Destination Host Unreachable

Server 2 can ping both internal and external IP addresses of the firewall.

zwets avatar
us flag
Both servers appear to have the same IP address: 192.168.0.1.
John avatar
sd flag
No, server 1 is 192.168.0.2 1nd server 2 is 192.168.0.1
zwets avatar
us flag
OK, the other way around then. But if server 1 is the gateway at `192.168.0.2`, then why doesn't server 2 have it as its gateway? Its default gateway is `192.168.0.1`, which is ... itself?
John avatar
sd flag
No, that's right. We're telling server 2, "For your default route, use the interface with the address 192.168.0.1", which is it's only interface, so that makes sense.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.