Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic IP with IPTABLES

Status
Not open for further replies.

RiezalR

Technical User
Oct 28, 2002
113
MY
Anyone know of a way to automatically obtain dynamic ip address, to be placed in rc.firewall script?
 
I've used "pump" before. An example was:
pump -i eth0 -h isp.com

Pump comes in it's own package in Mandrake 9.0. It may be packaged with some dhcp tools in other distros. --
JR
 
hi,

ifconfig eth0 | grep 'inet addr' | cut -d: -f2 | cut -d' ' -f1

will give you the IP associated with eth0 (dynamic or static)
so, you can use:
EXT_IP=`ifconfig eth0 | grep 'inet addr' | cut -d: -f2 | cut -d' ' -f1`
__
___
 
Actually, my internet connection is dialled only after Linux has fully booted up and i have login as root. Therefore the dynamic IP is only available after the login. My firewall however, is launched during boot time. Is there any other way that I can do this? Or do I have to execute the firewall script everytime i change my IP?
 
On my Mandrake 9.0 box, there are some files in /etc/sysconfig/network-scripts. I'd look into 'ifup-ppp' if you are using dialup. Your distro may not have this exact file. Try doing a 'locate ifup', may get back some more relevant results. You just want to find any script that runs automagically after connection. In that script, have it call your rc.firewall.

I also found this link via Google:

Looks pretty useful. Sorry, I haven't done dialup in Linux for almost 3 1/2 years now. I'm a little rusty ;-) --
JR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top