What's new
  • 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!

Help with a post-conf script

zib

New Around Here
Hi everyone,

I am running into troubles with setting up a postconf script.
So the thing is I do not use the wan port on my rt-n66u so I need to setup manually the default route each time the router experiences a reboot (basically during power outage ...)

I do not mind do that manually but when I'm not home, then it becomes a problem because no-one can use the internet ... since this router is also the dns server!

the line is simple :
Code:
route add default gw 192.168.0.1 br0

So created a dnsmasq.postconf file with that line in it, hoping it would work. but is does not ...

Each time the router restart, If I add the route, then nothing happens, it does not work. but if I, first, restart the dhcp/dns server and then add the route, then is works!

I do not really know what's going on so if anyone has an idea, I'm ready to hear it!

Thanks,
Pierre
 
Hi everyone,

I am running into troubles with setting up a postconf script.
So the thing is I do not use the wan port on my rt-n66u so I need to setup manually the default route each time the router experiences a reboot (basically during power outage ...)

I do not mind do that manually but when I'm not home, then it becomes a problem because no-one can use the internet ... since this router is also the dns server!

the line is simple :
Code:
route add default gw 192.168.0.1 br0

So created a dnsmasq.postconf file with that line in it, hoping it would work. but is does not ...

Each time the router restart, If I add the route, then nothing happens, it does not work. but if I, first, restart the dhcp/dns server and then add the route, then is works!

I do not really know what's going on so if anyone has an idea, I'm ready to hear it!

Thanks,
Pierre

Postconf are typically used to modify the config file that's linked to them. For your purposes, you will probably be better served with a wan-start script.
 
Hello again,

Sorry for "opening" that post again, but I would really like to get my script to work.

So adding the command in the wan-start script did not the trick ... because my wan is not activated ...
However, I did add the script to the "services-start" script and it was executed, but un successfull ... and that is why I am back! so here is my script:
Code:
#!/bin/sh

echo "before:" > /tmp/000wanstarted
route >> /tmp/000wanstarted
route add default gw 192.168.0.1 br0
echo "" >> /tmp/000wanstarted
echo "after:" >> /tmp/000wanstarted
route >> /tmp/000wanstarted

and here is the tmp file created:
Code:
before:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 br0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo

after:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 br0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         192.168.0.1     0.0.0.0         UG    0      0        0 br0

This is what I get directly after a reboot. however, the default route seems not to be taken into account: if I "ping google.com", nothing happens, it just tells that the host is unknown.

However, If I go on the web interface and remove the dns entry of the dhcp server and apply the changes, then if I add the route once again, then it works ... so that's kinda weir to me, what doesn't it work the first time then ...

To summarize:
The router reboots
The default route is added
impossible to ping google
Some changes are made to the dhcp config
the default is added once again
the ping to google is successfull

so could someone explain what I am doing wrong ?

Also, my dns server on the nerwork is the router itself, I am now wondering whether that can be a problem ...

Thanks!
Cheers!
 

Similar threads

Latest 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!

Staff online

Back
Top