Networking Forums

Networking Forums > Computer Networking > Linux Networking > automatically re-run firewall script on IP addr change

Reply
Thread Tools Display Modes

automatically re-run firewall script on IP addr change

 
 
David Efflandt
Guest
Posts: n/a

 
      12-26-2003, 03:46 AM
On Fri, 26 Dec 2003, Justin <(E-Mail Removed)> wrote:
> I have the following setup:
>
> LAN ------eth0--- Linux Router/Firewall ---eth1-----Dlink ADSL
> modem-------internet
>
> The Dlink modem can do PPPoA itself, and has some sort of DHCP server built
> in, so it will authenticate my broadband connection, and also set eth1 its
> IP address once connected, I don't understand how exactly it works actually
> since from my LAN (192.168.127.0) I can still ping the modem on 192.168.0.1
> while eth1 is on 81.7x.xxx.xxx.
>
> The internal network is on static IPs, and eth1 is set to be configured via
> DHCP in /etc/rc.d/rc.inet1
>
> I have got a firewall script on the router (from tldp.org, the IP Masq
> HOWTO), it loads on boot, and works beautifully. But since my ISP give
> dynamic IPs, the IP on eth1 changes, and thats the cause of my problem:
>
> I dont know how to automatically re-run the firewall script once the
> external IP changes, Ive tried using the
> /etc/dhcpc/dhcpcd-eth0.exe script which supposedly runs when dhcpcd detects
> a change in IP address, but it doesnt work! (I added /etc/rc.d/rc.firewall
> to the end of it)
> I dont want to have to manually run the firewall everytime the IP changes
> since the router is going to be headless.


Is that a typo or do you expect /etc/dhcpc/dhcpcd-eth0.exe to do something
when eth1 changes (shouldn't that be /etc/dhcpc/dhcpcd-eth1.exe)?

> can anyone help me out here?
>
> I run slackware 9.0 on the router.
>
> Thanks in advance! and Merry Christmas!
>
> Justin

--
David Efflandt - All spam ignored http://www.de-srv.com/
 
Reply With Quote
 
 
 
 
Justin
Guest
Posts: n/a

 
      12-26-2003, 04:52 AM
no its not a typo, I have tried renaming the script to dhcpcd-eth1.exe, and
swapping eth1 and eth0 around as the external iface, still it doesnt work,
it seems to me that dhcpcd isnt running the script at all when the IP
address changes. AFAIK from man pages and websites, it is supposed to run it
and I have no idea why its not happening on my router.

> Is that a typo or do you expect /etc/dhcpc/dhcpcd-eth0.exe to do something
> when eth1 changes (shouldn't that be /etc/dhcpc/dhcpcd-eth1.exe)?
>
> > can anyone help me out here?
> >
> > I run slackware 9.0 on the router.
> >
> > Thanks in advance! and Merry Christmas!
> >
> > Justin



 
Reply With Quote
 
Justin
Guest
Posts: n/a

 
      12-26-2003, 06:54 AM
Hi everyone!

I have the following setup:

LAN ------eth0--- Linux Router/Firewall ---eth1-----Dlink ADSL
modem-------internet

The Dlink modem can do PPPoA itself, and has some sort of DHCP server built
in, so it will authenticate my broadband connection, and also set eth1 its
IP address once connected, I don't understand how exactly it works actually
since from my LAN (192.168.127.0) I can still ping the modem on 192.168.0.1
while eth1 is on 81.7x.xxx.xxx.

The internal network is on static IPs, and eth1 is set to be configured via
DHCP in /etc/rc.d/rc.inet1

I have got a firewall script on the router (from tldp.org, the IP Masq
HOWTO), it loads on boot, and works beautifully. But since my ISP give
dynamic IPs, the IP on eth1 changes, and thats the cause of my problem:

I dont know how to automatically re-run the firewall script once the
external IP changes, Ive tried using the
/etc/dhcpc/dhcpcd-eth0.exe script which supposedly runs when dhcpcd detects
a change in IP address, but it doesnt work! (I added /etc/rc.d/rc.firewall
to the end of it)
I dont want to have to manually run the firewall everytime the IP changes
since the router is going to be headless.

can anyone help me out here?

I run slackware 9.0 on the router.

Thanks in advance! and Merry Christmas!

Justin


 
Reply With Quote
 
Bit Twister
Guest
Posts: n/a

 
      12-26-2003, 01:55 PM
On Fri, 26 Dec 2003 05:52:32 -0000, Justin wrote:
> no its not a typo, I have tried renaming the script to dhcpcd-eth1.exe, and
> swapping eth1 and eth0 around as the external iface, still it doesnt work,
> it seems to me that dhcpcd isnt running the script at all when the IP
> address changes. AFAIK from man pages and websites, it is supposed to run it
> and I have no idea why its not happening on my router.
>
>> Is that a typo or do you expect /etc/dhcpc/dhcpcd-eth0.exe to do something
>> when eth1 changes (shouldn't that be /etc/dhcpc/dhcpcd-eth1.exe)?


can we assume you have the execute perm set and owned by root?
 
Reply With Quote
 
Justin
Guest
Posts: n/a

 
      12-26-2003, 09:20 PM
> >> Is that a typo or do you expect /etc/dhcpc/dhcpcd-eth0.exe to do
something
> >> when eth1 changes (shouldn't that be /etc/dhcpc/dhcpcd-eth1.exe)?

>
> can we assume you have the execute perm set and owned by root?


I did chmod 700 on the script.

Ive been looking at the dhcpcd man pages and the rc.inet1 script, I found
that the lease time of dhcpcd is set to infinite by default, so I changed it
to 3600 sec, by adding a line dhcpcd -l 3600. This seems to have fixed the
problem.

but I dont understand why dhcpcd doesnt execute the .exe script when the
lease is set to infinity, because I know that it detects a change in IP,
ifconfig tells me that.

I have another question, which I cannot find the answer to anywhere. I cant
think why the IP address of the external interface should change at all!
Since my modem handles PPPoA, shouldnt the ISP assigned IP address be on the
modem? and to back this view, I know the modem can maintain the connection
to the ISP even when the router isnt even switched on! (I know this because
the IP addr stays the same after a hard reboot of the router).

Thanks to anyone who can tell me whats going on here!



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
script to change the static IP address Ezakial Windows Networking 2 09-14-2009 06:25 PM
Script to change Domain S Lane Windows Networking 2 03-20-2006 01:50 PM
Need script to change DNS and WINS settings on 50 servers Spin Windows Networking 5 11-07-2005 12:31 PM
Automatically rewritting Firewall based on New DHCP Lease Sean Linux Networking 3 02-25-2004 10:58 AM
Script to change dns settings dsmcd Windows Networking 0 01-30-2004 10:52 PM



1 2 3 4 5 6 7 8 9 10 11