I am trying to connect one of my PCs to the Internet via a WiFi network using a notebook. Here is my network :
(Wifi) <=============> (Notebook) <===============> (Desktop)
(192.168.1.x) (10.12.0.x)
(192.168.1.85 (10.12.0.2)
& 10.12.0.1)
So, I have ipv4_forward enabled on my netbook, and this NAT rule :
iptables -t nat -A POSTROUTING -s 10.12.0.0/24 -j MASQUERADE
Here is my routing table on my notebook :
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 wlan0
10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
192.168.1.0 0.0.0.0 255.255.255.0 U 9 0 0 wlan0
192.168.1.85 127.0.0.1 255.255.255.255 UGH 303 0 0 lo
Here is my routing table on my desktop :
Destination Gateway Genmask Flags Metric Ref Use Iface
10.12.0.0 0.0.0.0 255.255.255.0 U 0 0 0 enp2s0
192.168.1.0 10.12.0.1 255.255.255.0 UG 0 0 0 enp2s0
I can ping everything on the 192.168.1.x network (my Internet gateway 192.168.1.254 included), but I can't add the simple route
route add default gw 192.168.1.254 enp2s0
or
ip route add default via 192.168.1.254 dev enp2s0
I keep getting errors like :
SIOCADDRT: Network is unreachable
RTNETLINK answers: Network is unreachable
And, of course, I can't ping any WAN server from my desktop. Do you have an idea of what I am doing wrong ?
Thank you.