What's new

wan-start script not working

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

squallmx

New Around Here
I trying to get a different DHCP address for my Guest Network for Bandwidth limitation, after reading several great posts here I was finally able to do so. But only when running wan-start manually. This is my script:

Code:
/sbin/ifconfig wl0.1 192.168.2.1 netmask 255.255.255.0
/usr/sbin/ebtables -t broute -I BROUTING -p ipv4 -i wl0.1 -j DROP
/usr/sbin/ebtables -t broute -I BROUTING -p ipv6 -i wl0.1 -j DROP
/usr/sbin/ebtables -t broute -I BROUTING -p arp -i wl0.1 -j DROP
/usr/sbin/iptables -I FORWARD -i wl0.1 -j ACCEPT
/usr/sbin/iptables -I INPUT -i wl0.1 -j ACCEPT
/usr/sbin/iptables -I FORWARD -i wl0.1 -d 192.168.1.1/24 -j DROP
/usr/sbin/iptables -I INPUT -i wl0.1 -d 192.168.1.1/24 -j DROP
/sbin/service restart_dnsmasq

1wuZtHa2g.png


I also added this 3 additional lines to dnsmasq.conf.add

Code:
interface=wl0.1
dhcp-range=wl0.1,192.168.2.100,192.168.2.125,255.255.255.0,86400s
dhcp-option=wl0.1,3,192.168.2.1
dhcp-option=wl0.1,6,192.168.2.1,0.0.0.0

After rebooting the router reports that wl0.1 does not exist, and the devices connected to the guest network fail to get an IP address. Then if i just Run System Command "/jffs/scripts/wan-start" everything starts to work properly.

Any ideas about why I need to manually execute "wan-start" for this script to work, and how can I fix it?

Thanks.
 
Last edited:
Change dnsmasq.conf.add to this;
Code:
interface=wl0.1
dhcp-range=wl0.1,192.168.2.100,192.168.2.200,255.255.255.0,86400s
dhcp-option=wl0.1,3,192.168.2.1
dhcp-option=wl0.1,6,192.168.2.1,0.0.0.0

also, i think nat-start might be better for the script.

and you have to use;
Code:
chmod a+rx /jffs/scripts/*
to make it execute at boot
 
Change dnsmasq.conf.add to this;
Code:
interface=wl0.1
dhcp-range=wl0.1,192.168.2.100,192.168.2.200,255.255.255.0,86400s
dhcp-option=wl0.1,3,192.168.2.1
dhcp-option=wl0.1,6,192.168.2.1,0.0.0.0

also, i think nat-start might be better for the script.

and you have to use;
Code:
chmod a+rx /jffs/scripts/*
to make it execute at boot

Sorry, idiot me copy paste the sample lines I found here for dnsmasq.conf.add instead of the ones I'm using:

Code:
interface=wl0.1
dhcp-range=wl0.1,192.168.2.100,192.168.2.125,255.255.255.0,86400s
dhcp-option=wl0.1,3,192.168.2.1
dhcp-option=wl0.1,6,192.168.2.1,0.0.0.0

Very similar to the ones you recommended (thanks BTW), I will try changin the script to nat-start / init-start.

Thank You Both!
 
Yes:D:D:D, writing the code at "nat-start" fixed the problem, now my guest network has proper IPs and bandwidth limitations.

Thanks.
 
Can you post your working scripts??

Sure, first you have to create a 2.4 GHz Guest Network with Intranet Access using the GUI (don't worry, at least on my tests they cant access the Intranet).

Then put this in /jffs/scripts/nat-start (I used Vi, because I don't know how to copy&paste the text :p)

Code:
#!/bin/sh
/sbin/ifconfig wl0.1 192.168.2.1 netmask 255.255.255.0
/usr/sbin/ebtables -t broute -I BROUTING -p ipv4 -i wl0.1 -j DROP
/usr/sbin/ebtables -t broute -I BROUTING -p ipv6 -i wl0.1 -j DROP
/usr/sbin/ebtables -t broute -I BROUTING -p arp -i wl0.1 -j DROP
/usr/sbin/iptables -I FORWARD -i wl0.1 -j ACCEPT
/usr/sbin/iptables -I INPUT -i wl0.1 -j ACCEPT
/usr/sbin/iptables -I FORWARD -i wl0.1 -d 192.168.1.1/24 -j DROP
/usr/sbin/iptables -I INPUT -i wl0.1 -d 192.168.1.1/24 -j DROP
/sbin/service restart_dnsmasq

and added this 4 lines to dnsmasq.conf.add (also using vi):

Code:
interface=wl0.1
dhcp-range=wl0.1,192.168.2.100,192.168.2.125,255.255.255.0,86400s
dhcp-option=wl0.1,3,192.168.2.1
dhcp-option=wl0.1,6,8.8.8.8,8.8.8.4

This should work also:

Code:
interface=wl0.1
dhcp-range=wl0.1,192.168.2.100,192.168.2.200,255.255.255.0,86400s
dhcp-option=wl0.1,3,192.168.2.1
dhcp-option=wl0.1,6,192.168.2.1,0.0.0.0

Remember to run:

chmod a+rx /jffs/scripts/*
rebooot

Then apply QoS as you see fit (BTW there is a bug in the latest stable release, the download value is double of the select one, for example I have a 10 Mbps connection, but in order to provide 2 Mbps for the Guest network I have to select 10% bandwidth instead of 20% (which provides 4 Mbps instead).
 
Can't get it working on boot. The wl0.1 interface gets the custom IP address, but DHCP won't give any address.
After manually running the script again DHCP works. maybe nat-start is not good for me?
Suggestions?
 
Last edited:
Can't get it working on boot. The interface gets the IP address, but DHCP won't give any address.
After manually running the script everything is file.
Suggestions?

That was my problem too, it was fixed after using nat-start instead of "wan-start" or "init-start", but to be honest I keep the code in them too.
 
Well, I'm already using nat-start

I'll try to delay the dnsmasq start with a sleep 20 and see what happens...
 
Well, it seems that some firewall rules are lost, someone overwrites them after nat-start
Any help?
 
I figured out what was missing: I didn't enable intranet access.
Anyway beware that with this script, whenever you change something in your wireless setup, you should run it again.
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top