I have a computer with two network devices (eth0
and wlan0
), both connected to the internet (two different connections/isp).
I'm trying to share the connection of wlan0
to another computer connected via ethernet to eth0
.
What I'm doing is:
# sysctl net.ipv4.ip_forward=1
# iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
From the client computer I can then connect to this one, but the internet connection that gets shared is the one on eth0
and not the one on wlan0
.
If I disable the internet connection on eth0
(by setting no gateway), then the connection to be shared is the one on wlan0
. However, I'd like to have both internet connections enabled and specify to iptables which one to share. Is this possible?
What am I missing? Do I need some forwarding rule?
sysctl -a | grep net.ipv4.ip_forward
, is FORWARD Chain is allowed ? could you please add your iptables rules. and what is client side gateway ?net.ipv4.ip_forward = 1
. Forward chain is allowed and there are no other rules beside the one I posted above. The client side gateway is the local address of the computer that should share the connection. Note that sharing the connection is working, it's just not sharing the one I want.