What I want to create is 2 subnets that communicate each other through a gateway.
Here is my gateway:
wlan0 Link encap:Ethernet IndirizzoHW c4:46:19:69:b7:a5
indirizzo inet:192.168.1.3 Bcast:192.168.1.255 Maschera:255.255.255.0
indirizzo inet6: fe80::c646:19ff:fe69:b7a5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:987185 errors:0 dropped:0 overruns:0 frame:0
TX packets:635513 errors:0 dropped:0 overruns:0 carrier:0
collisioni:0 txqueuelen:1000
Byte RX:1300656767 (1.3 GB) Byte TX:86680631 (86.6 MB)
wlan0:1 Link encap:Ethernet IndirizzoHW c4:46:19:69:b7:a5
indirizzo inet:172.16.1.1 Bcast:172.16.1.255 Maschera:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
wlan0:2 Link encap:Ethernet IndirizzoHW c4:46:19:69:b7:a5
indirizzo inet:172.16.2.1 Bcast:172.16.2.255 Maschera:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
and its route table:
Destination Gateway Genmask Flags Metric Ref Use Iface
172.16.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
172.16.2.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 9 0 0 wlan0
In a similar way on 2 pc launching:
ifconfig wlan0:1 172.16.1.2/24
route add default gw 172.16.1.1
and
ifconfig wlan0:1 172.16.2.2/24
route add default gw 172.16.2.1
what happens is the following: at the beginning all works fine, if I make a ping from 172.16.2.2 to 172.16.1.2 it goes through the gateway, but I don't know why at a certain point it stops I mean 172.16.2.2 can send a packet to 172.16.1.2 without passing through the gateway, even if I turn down the gateway they continue to ping each other.
What's going on?