* Getting info from ifconfig output
@ 2003-03-12 23:03 Bill Davidsen
0 siblings, 0 replies; only message in thread
From: Bill Davidsen @ 2003-03-12 23:03 UTC (permalink / raw)
To: netfilter
Browsing the list I saw a question regarding using grep and friends
to get an IP. I do this, but to allow a single firewall config file to
be used on a number of machines without editing. Here are the first few
lines, I hope they are useful to someone. I extract the IP and the
broadcast (I don't always have 8 bit subnetting).
# define internal and external interfaces
int_i=eth0
ext_i=eth1
loopback=lo
# define the IP of the external address, only IP used
AdrsLine=$(ifconfig ${ext_i} | grep "inet addr:")
ext_ip=$(expr "$AdrsLine" : ".*inet addr: *\([0-9.]*\)")
Bcast=$(expr "$AdrsLine" : ".*Bcast: *\([0-9.]*\)")
--
bill davidsen (davidsen@tmr.com)
Doing interesting things with small computers since 1979.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-03-12 23:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-12 23:03 Getting info from ifconfig output Bill Davidsen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.