I would like to forward packets between interfaces without using iptables. I am not against iptables per se, I just believe that for my simple needs it's not necessary. However I am unable to do so. Can I?
Here's the scenario: I have a wireless interface and a hardwired interface on host A. My wireless gateway has IP 10.0.0.1. My wireless interface is 10.0.0.12.
So I figure that if I enable port forwarding using sysctl, and create an IP on the network for my wired interface, then create a routing table entry for the host attached to the wired interface (call it host B), then all should be good, no?
So I have:
- Gateway == 10.0.0.1
- Host A interface == 10.0.0.12
- Host A netmask == 255.255.255.0
- Host A interface == 10.0.0.99
- Host B interface == 10.0.0.100, plugged into Host A.
- routing table entry for Host B with a netmask of 255.255.255.255.
I can ping and ssh into Host B from Host A. But when I try to ping the gateway from host B, I see a lot of these on Host A's wired interface:
12:56:55.211866 ARP, Request who-has gateway tell 10.0.0.100, length 46 12:56:56.211751 ARP, Request who-has gateway tell 10.0.0.100, length 46 12:56:57.214187 ARP, Request who-has gateway tell 10.0.0.100, length 46 12:56:58.211834 ARP, Request who-has gateway tell 10.0.0.100, length 46 ...
Is there something I'm missing, or do I need iptables?
Here is my routing table on Host A:
Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 10.0.0.1 0.0.0.0 UG 0 0 0 wlp3s0 10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp3s0 10.0.0.100 0.0.0.0 255.255.255.255 UH 0 0 0 enp0s25
BTW, on Host A:
# sysctl net.ipv4.ip_forward net.ipv4.ip_forward = 1