Date: Mon, 10 Mar 2003 01:21:38 -0500 From: David Banning <david@skytracker.ca> To: Michael Collette <metrol@metrol.net> Cc: FreeBSD Mailing Lists <freebsd-questions@freebsd.org> Subject: Re: identifying my network address Message-ID: <20030310012138.A54863@skytrackercanada.com> In-Reply-To: <200303092130.22748.metrol@metrol.net>; from metrol@metrol.net on Sun, Mar 09, 2003 at 09:30:22PM -0800 References: <200303092130.22748.metrol@metrol.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 09, 2003 at 09:30:22PM -0800, Michael Collette wrote: > David Banning wrote: > > > I am running an Xwindow on a windows box. I need a script to > > tell me what my network address is so that I can set my DISPLAY > > varible correctly eg: 192.168.1.2:0.0 > > > > Any idea what command would be useful for this purpose? > > It's ugly. It won't work if you multiple NICs. It may just work for what you > need just the same. > > echo `ifconfig | grep broadcast | cut -d" " -f2`":0.0" > > This takes the output of ifconfig and parses it just a wee bit with grep and > cut. I use something very similar to this in a script that changes my > network settings for my laptop on the fly. > > Let me know if this works for ya. Nope. ifconfig by itself does not contain the address at all, anywhere; dc0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255 inet6 fe80::220:78ff:fe0e:13d6%dc0 prefixlen 64 scopeid 0x1 ether 00:20:78:0e:13:d6 media: Ethernet autoselect (10baseT/UTP) status: active rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet 209.188.66.29 netmask 0xffffff00 broadcast 209.188.66.255 inet6 fe80::248:54ff:fe8c:13e5%rl0 prefixlen 64 scopeid 0x2 ether 00:48:54:8c:13:e5 media: Ethernet autoselect (10baseT/UTP) status: active lp0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500 sl0: flags=c010<POINTOPOINT,LINK2,MULTICAST> mtu 552 faith0: flags=8002<BROADCAST,MULTICAST> mtu 1500 lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x6 inet 127.0.0.1 netmask 0xff000000 ppp0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500 tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1492 inet 209.188.66.29 --> 206.221.248.4 netmask 0xffffffff Opened by PID 6716 Thanks anyway - To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030310012138.A54863>