I found the answer from this forum.
iptables -i wlan0 -A INPUT ! -s 192.168.X.Y -m quota --quota 1024000 -j ACCEPT -c 0 0
iptables -i wlan0 -A INPUT ! -s 192.168.X.Y -j DROP
Replace 192.168.X.Y with your router. This is actually optional. ! -s 192.168.X.Y ignores the packets receiving from your router which is 192.168.X.Y.
You can also check whether rules are applied by using this command.
iptables -vnL
If they applied properly you should get something like this
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
18 1900 ACCEPT all -- wlan0 * !192.168.10.1 0.0.0.0/0 quota: 10485760 bytes
0 0 DROP all -- wlan0 * !192.168.10.1 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 4 packets, 332 bytes)
pkts bytes target prot opt in out source destination