From owner-freebsd-net Tue Dec 5 1:12:28 2000 From owner-freebsd-net@FreeBSD.ORG Tue Dec 5 01:12:26 2000 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from hotmail.com (f101.law6.hotmail.com [216.32.241.101]) by hub.freebsd.org (Postfix) with ESMTP id 122CA37B401 for ; Tue, 5 Dec 2000 01:12:26 -0800 (PST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 5 Dec 2000 01:12:25 -0800 Received: from 61.9.178.117 by lw6fd.law6.hotmail.msn.com with HTTP; Tue, 05 Dec 2000 09:12:25 GMT X-Originating-IP: [61.9.178.117] From: "Aaron Hill" To: oscar@163.net, freebsd-net@freebsd.org Subject: Re: get tun0's ip from my program Date: Tue, 05 Dec 2000 09:12:25 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 05 Dec 2000 09:12:25.0820 (UTC) FILETIME=[7BE941C0:01C05E9B] Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >I want to get tun0's two ip addresses. >and add ipfw rules to system at my program. >How can I do it?is there a function? or >have document describe it. someone please tell me! I found a good example of modifying the rc.firewall file at... http://people.freebsd.org/~jmb/PPPoE.configuration ... and modified it for my needs. In particular here's how the IP address for the tun0 interface is detected... red_if="tun0" red=`ifconfig ${red_if} | grep netmask | cut -f 2 -d ' ' | tail -1` Next the red_if and red objects are referenced in the firewall configuration with the following kind of line... ${fwcmd} add 100 deny log all from ${red} to any in recv ${red_if} So if you need to pull the two IP addresses from tun0 I'm sure you could make two objects like red_ip1 and red_ip2, then pull the relevant IP address for each one with different uses of the head and tail utilities with the above commands. Check out the above mentioned web site for a more complete picture of how to modify /etc/rc.firewall and how to execute it. I hope that helps. Aaron Hill _____________________________________________________________________________________ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message