LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-11-2005, 05:28 AM   #1
Niceman2005
Member
 
Registered: Nov 2004
Distribution: Fedora Core 2
Posts: 330

Rep: Reputation: 30
How to configure an iptables extdev and extip that uses dynamic ip?


Dear friends,

My knowledge of iptables configuration that uses static IP for its external ethernet device is to set the external IP address to be:

extdev=eth0 (e.g)
extip=xxx.xxx.xxx.xxx (my external IP)

however if for my case I have to set a firewall that s connected to internet with dynamic ip, which means my extip changes everytime disconencted, i learnt that I should use extdev=ppp0 and extip='ifconfig bla bla bla some kind of complicated scripts that capture the extip'

then I should not do ipables-save > /etc/sysconfig/iptables, else it would stuck at each reboot.

my question is....if not supposed to do iptables-save, then what is the correct way to do it so it reboots ok?

pls guide me the right way...really appreiate for your hhelp,
 
Old 10-11-2005, 09:43 PM   #2
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
There is some "tricks" but, yeah, dynamic ips is somewhat a pain when you are playing with iptables.

The easiest way would be to not use ip adresses as all in your script and to use only "wildcarded" interface, like "ppp+". Using "ppp+" instead of "ppp0" as example, would tell your script that rules apply to "all interface starting by ppp".

If you _really_ need to create a rule by ip, it's a bit tricky. Personnaly, I made a script that check if my internet connection (DSL, so a ppp0 interface) is up AND if the ip changed (because sometime it crashes and come back so fast that the script doesn't understand it have been down). Thus, if it detects the ip changed, it "restarts" the firewall. Of course, you can't use "iptables-save" when you do that, but who need this anyways? Just make sure your _real_ iptables script (and not just the rules applied at shutdown) is started at bot time and it will be almost the same.

<edit>My dog's spelling is better than mine but I'm trying to hide that fact.

Last edited by Half_Elf; 10-11-2005 at 09:45 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic IP with iptables HAMM3R Linux - Security 1 11-15-2005 09:30 PM
How to Configure Dynamic DNS abhishek124 Linux - Networking 4 08-17-2005 09:04 AM
iptables and dynamic rules.... ProtoformX Linux - Security 10 10-20-2004 07:50 AM
iptables and EXTIP access from LAN kajboj Linux - Security 1 02-06-2002 12:11 PM
iptables and EXTIP access from LAN kajboj Linux - Networking 1 02-04-2002 04:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration