LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-15-2005, 09:14 PM   #1
HAMM3R
LQ Newbie
 
Registered: Nov 2005
Distribution: Debian Sarge
Posts: 1

Rep: Reputation: 0
Dynamic IP with iptables


Hey.

Can I use a dynamic IP host (like no-ip.com) with iptables?
The user i want to add has a dynamic IP, so i thought he could get a no-ip.com host, and update it when his IP changes. But will IP tables be able to detect the IP change, or just stick with the initial ip from the host when I add it?

Thanks,

HAMM3R
 
Old 11-15-2005, 09:30 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
You need to get your iptables script to check what the ip address is everytime it is run, rather than writing it statically in the file.

This snippet will do the trick:
Code:
IFACE=eth0
IP="`/sbin/ifconfig $IFACE | awk /$IFACE/'{next}//{split($0,a,":");split(a[2],a," ");print a[1];exit}'`"
FYI: no-ip has a Linux update client that will run as a cron task, and update your ip if it changes automatically.

Last edited by bulliver; 11-16-2005 at 04:26 PM.
 
  


Reply



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 iptables rules slzckboy Linux - Networking 4 10-18-2005 01:28 PM
Dynamic ip and Apache with iptables props666999 Linux - Security 4 09-28-2005 04:08 AM
dynamic iptables based on ftp logs epoo Linux - Networking 0 04-28-2005 01:50 AM
iptables and dynamic rules.... ProtoformX Linux - Security 10 10-20-2004 07:50 AM
IPTABLES, dynamic IP. just to clear up Looking_Lost Linux - Security 2 08-07-2003 06:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:02 PM.

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