Bekijk de volledige versie : IP Start-scripts for IP-UP and IP-DOWN
Hello,
I'll start a script, after the WAN-IP (PPPoE) goes up or down on my WL500g.
How are the exact names (with path) of the script.
I test these both scripts:
/usr/local/sbin/ip-up
/usr/local/sbin/ip-down
But the script are not started at my WAN-IP goes up or down :mad:
emediquei
06-05-2007, 21:18
I'm using oleg's firmware and I've been trying to get this to work too.
If you're also using Oleg's, after creating the script I to go to the web interface and in "IP Config/WAN & LAN" set the option "Additional pppd options:" to something like "ip-up-script /usr/local/etc/ppp/ip-up", or wherever your script is.
I've tried it this way and it is running the script but I don't have connection to the internet. The status for the connection in the web interface is Disconnected, but if I do "ifconfig ppp0" through ssh it gives me an ip.
I've looked at the logs and I think I might have found out the reason. This is the log when I don't run the script:
May 6 08:45:47 pppd[516]: Plugin rp-pppoe.so loaded.
May 6 08:45:47 pppd[516]: RP-PPPoE plugin version 3.3 compiled against pppd 2.4.2
May 6 08:45:47 pppd[517]: pppd 2.4.2 started by admin, uid 0
May 6 08:45:47 pppd[517]: PPP session is 6106
May 6 08:45:47 pppd[517]: Using interface ppp0
May 6 08:45:47 pppd[517]: Connect: ppp0 <--> vlan1
May 6 08:45:49 pppd[517]: PAP authentication succeeded
May 6 08:45:49 pppd[517]: peer from calling number 00:17:0F:F6:08:19 authorized
May 6 08:45:49 pppd[517]: local IP address 89.180.20.55
May 6 08:45:49 pppd[517]: remote IP address 212.0.167.112
May 6 08:45:49 pppd[517]: primary DNS address 195.23.129.126
May 6 08:45:49 pppd[517]: secondary DNS address 194.79.69.222
May 6 08:45:49 dnsmasq[74]: read /etc/hosts - 4 addresses
May 6 08:45:49 dnsmasq[74]: reading /tmp/resolv.conf
May 6 08:45:49 dnsmasq[74]: using nameserver 194.79.69.222#53
May 6 08:45:49 dnsmasq[74]: using nameserver 195.23.129.126#53
May 6 08:45:50 ddns update: connected to members.dyndns.org (63.208.196.96) on port 80.
May 6 08:45:50 PPPoE: connect to ISP
When I try to make the script run, the lines in bold don't appear on the log. I'm guessing that because the script is running it's stopping the execution of something.
I've already tried to add the line "exit 0" to the script, since I thought it might be because of the return value, but it didn't do any good. Any thoughts on how to solve this?
Thanks
AFAIK, you might try to use /usr/local/sbin/post-firewall in place of of ip-up
emediquei
07-05-2007, 21:05
I thought post-firewall was only executed once, when the router booted. Using it instead of ip-up worked perfecty.
Thanks!
I placed a call to my custom ip-up-script at the end of
/usr/local/sbin/post-firewall
The call is running every time, if my PPPoE connection comes up! Not only one time at the router boots!
Thanks!
I placed a call to my custom ip-up-script at the end of
/usr/local/sbin/post-firewall
How did you place the call to another script. I have tried to do it, but it is not executing. maybe its my mistake. Could you please show that part of your post-firewall script. Thanx
Here is my post-firewall:
#!/bin/sh
iptables -D INPUT -j DROP
#thttpd
iptables -I INPUT -p tcp --dport 81 -j ACCEPT
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 80 -j DNAT --to-destination $4:81
# ssh
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 22 -j DNAT --to-destination $4:22
# drop rest
iptables -A INPUT -j DROP
# DNS-Update
sleep 10
/opt/etc/cron.30mins/IPupdate.sh
Don't forget:
chmod +x /usr/local/sbin/post-firewall
and also don't forget (with this example):
chmod +x /opt/etc/cron.30mins/IPupdate.sh
And at the end type this to the prompt:
flashfs save && flashfs commit && flashfs enable && reboot
Tnanx rj.2001,
I was interested in this code you posted:
/opt/etc/cron.30mins/IPupdate.sh
Is the .sh postfix mandatory in order to be executed as a bash script?
I used the script files with no .sh postfix and they did not execute.