Skip to main content
2 of 2
added 332 characters in body
Hauke Laging
  • 94.8k
  • 21
  • 132
  • 185

Routing is about "where (and if) to send to". That's not limited to selecting a NIC. In your case routing is very simple though.

You need masquerading in its most simple form (all commands on host A):

iptables -t nat -I POSTROUTING -s 192.168.22.234 -j MASQUERADE 

And maybe (if not yet) you need allow forwarding:

iptables -I FORWARD 1 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT iptables -I FORWARD 2 -s 192.168.22.234 -j ACCEPT 

Assuming host A is configured as the default gateway for Host B.

Edit 1:

After a chat discussion the situation has become clearer. In theory configuring the default gateway on B should have been enough. But it seems that the gateway (which is not under the control of the questioner) blocks host B. Thus the masquerading solution was necessary.

Hauke Laging
  • 94.8k
  • 21
  • 132
  • 185