From owner-freebsd-questions@freebsd.org Fri Jul 14 17:01:43 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA6BADA7CFE; Fri, 14 Jul 2017 17:01:43 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D9046E215; Fri, 14 Jul 2017 17:01:42 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id v6EH1VNF095674; Sat, 15 Jul 2017 03:01:31 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Sat, 15 Jul 2017 03:01:31 +1000 (EST) From: Ian Smith To: Kulamani Sethi cc: freebsd-questions@freebsd.org, freebsd-ipfw@freebsd.org Subject: Re: Unable to set rule using service name In-Reply-To: Message-ID: <20170715024608.T92704@sola.nimnet.asn.au> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 17:01:43 -0000 On Fri, 14 Jul 2017 16:43:56 +0530, Kulamani Sethi wrote: > Hi, > I want to set a rule for a particular service URL which running on a remote > server. > I know the IP but don't know the port number where that service is running. > If i set rule for IP then it will applied for entire services running over > there. > > There is a option in IPFW rule we can set either port number or name, but > it does not accepting using name. Here is a example for my case. > > suppose URL for test1 service http://x.x.x.x/test1 > URL for test2 service http://x.x.x.x/test2 > > I tried a rule, "ipfw add 104 deny log ip from x.x.x.x test1 to any". Got > error "ipfw: missing "to'' ". > *I want to set rule for test1 where I have no idea about port.* > *Also please help me how to know port number if any way is there.* RW well described (in freebsd-questions@) the relationship between port numbers and service names in /etc/services; assuming you know the name, that gives you the number. Are 'test1' and 'test2' real examples, or placeholders for real service names? In any case, you cannot specify a port number in a rule with proto 'ip'; when specifying port/s you need to specify 'udp' or 'tcp' protocol. Can you give an example of the actual packets (protocol, port number/s) that you want to block? cheers, Ian