From: Bill Davidsen <davidsen@prodigy.com>
To: netfilter@lists.netfilter.org
Subject: Getting info from ifconfig output
Date: Wed, 12 Mar 2003 18:03:27 -0500 [thread overview]
Message-ID: <3E6FBCBF.3D80FAE@prodigy.com> (raw)
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.
reply other threads:[~2003-03-12 23:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E6FBCBF.3D80FAE@prodigy.com \
--to=davidsen@prodigy.com \
--cc=netfilter@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.