ipfilter to route out by udp source addr and port

This is a discussion on ipfilter to route out by udp source addr and port within the IPFilter forums, part of the System Security and Security Related category; This message is in MIME format. Since your mail reader does not understand this format, some or all of this ...


Go Back   Usenet Forums > System Security and Security Related > IPFilter

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-25-2005
Eric Coston
 
Posts: n/a
Default ipfilter to route out by udp source addr and port

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C5915E.7E9E3CE0
Content-Type: text/plain;
charset="iso-8859-1"

I'm trying to use ipfilter to route messages based on the source tcp/ip
address and source port. I have a sip proxy server listening in a specific
interface (ce1), and want to route all sip traffic back out that specific
interface (ce1). My default route is on a different interface (eri0), and I
do not want to change this.

All of my sip traffic arrives on the correct interface, but routes out based
on my routing table (below) and not by my ipfilter rules.

pass out quick on ce1 proto udp from 172.16.16.50/32 port 5060 >< 5061 to
any keep state

Here's my modlist for interface ce1

dev01:root:/etc/rc2.d/> ifconfig ce1 modlist
0 arp
1 ip
2 pfil
3 ce

Here's my net config

dev01:root:/etc/rc2.d/> ifconfig -a
lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 5
inet 127.0.0.1 netmask ff000000
ce0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 6
inet 192.168.1.1 netmask ffffff00 broadcast 192.168.1.255
ether 0:3:ba:85:37:9
ce1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 7
<=== sip proxy
inet 172.16.16.50 netmask fffffc00 broadcast 172.16.255.255
ether 0:3:ba:85:37:a
eri0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 8
<=== admin interface
inet 10.50.20.98 netmask fffffe00 broadcast 10.50.21.255
ether 0:3:ba:13:31:d7
eri1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 9
inet 192.168.2.1 netmask ffffff00 broadcast 192.168.2.255
ether 0:3:ba:13:31:d8

My routing table

dev01:root:/etc/rc2.d/> netstat -nr

Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------
192.168.1.0 192.168.1.1 U 1 3010 ce0
192.168.2.0 192.168.2.1 U 1 5605 eri1
10.50.20.0 10.50.20.98 U 1 12734 eri0
172.16.16.0 172.16.16.50 U 1 75 ce1
224.0.0.0 10.50.20.98 U 1 0 eri0
default 10.50.20.1 UG 1 6534
127.0.0.1 127.0.0.1 UH 173968330 lo0

Here's my ipf rule

dev01:root:/etc/rc2.d/> ipfstat -on
@1 pass out quick on ce1 proto udp from 172.16.16.50/32 port 5060 >< 5061 to
any keep state

Here's my ipfstat

dev01:root:/etc/rc2.d/> ipfstat
bad packets: in 0 out 0
IPv6 packets: in 0 out 0
input packets: blocked 0 passed 634116 nomatch 393476 counted 0
short 0
output packets: blocked 0 passed 629220 nomatch 377366 counted 0
short 0
input packets logged: blocked 0 passed 0
output packets logged: blocked 0 passed 0
packets logged: input 0 output 0
log failures: input 0 output 0
fragment state(in): kept 0 lost 0 not fragmented 0
fragment state(out): kept 0 lost 0 not fragmented 0
packet state(in): kept 0 lost 0
packet state(out): kept 0 lost 0
ICMP replies: 0 TCP RSTs sent: 0
Invalid source(in): 0
Result cache hits(in): 240640 (out): 251854
IN Pullups succeeded: 0 failed: 0
OUT Pullups succeeded: 1072 failed: 0
Fastroute successes: 0 failures: 0
TCP cksum fails(in): 0 (out): 0
IPF Ticks: 19866
Packet log flags set: (0)
none






NOTE: This message, including any attachments, may include privileged,
confidential and/or inside information. Any distribution or use of this
communication by anyone other than the intended recipient(s) is strictly
prohibited and may be unlawful. If you are not the intended recipient,
please notify the sender by replying to this message and then delete it from
your system. Thank you.

------_=_NextPart_001_01C5915E.7E9E3CE0
Content-Type: text/html;
charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.2800.1505" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=178340321-25072005>I'm trying to use
ipfilter to route&nbsp;messages based on the source&nbsp;tcp/ip address and
source port.&nbsp; I have a sip proxy server listening in a specific interface
(ce1), and want to route&nbsp;all sip traffic back out that specific interface
(ce1).&nbsp; My default route is on a different interface (eri0), and I do not
want to change this.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=178340321-25072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=178340321-25072005>All of my sip
traffic arrives on the correct interface, but routes out based on my routing
table (below) and not by my ipfilter rules.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=178340321-25072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2><SPAN class=178340321-25072005>pass out
quick on ce1 proto udp from 172.16.16.50/32 port 5060 &gt;&lt; 5061 to any keep
state</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=178340321-25072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2><SPAN class=178340321-25072005>Here's my
modlist for interface ce1</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=178340321-25072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=178340321-25072005>dev01:root:/etc/rc2.d/&gt; ifconfig ce1 modlist<BR>0
arp<BR>1 ip<BR>2 pfil<BR>3 ce<BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=178340321-25072005>Here's my net
config</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=178340321-25072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=178340321-25072005>dev01:root:/etc/rc2.d/&gt; ifconfig -a<BR>lo0:
flags=1000849&lt;UP,LOOPBACK,RUNNING,MULTICAST,IPv 4&gt; mtu 8232 index
5<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inet 127.0.0.1 netmask ff000000
<BR>ce0: flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IP v4&gt; mtu 1500 index
6<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inet 192.168.1.1 netmask
ffffff00 broadcast 192.168.1.255<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;
ether 0:3:ba:85:37:9 <BR>ce1:
flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IP v4&gt; mtu 1500 index
7&nbsp;&nbsp;&nbsp; &lt;=== sip
proxy<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ; inet 172.16.16.50 netmask
fffffc00 broadcast 172.16.255.255<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;
ether 0:3:ba:85:37:a <BR>eri0:
flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IP v4&gt; mtu 1500 index
8&nbsp;&nbsp;&nbsp;&lt;===
admin&nbsp;interface<BR>&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp; inet
10.50.20.98 netmask fffffe00 broadcast
10.50.21.255<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp; ether 0:3:ba:13:31:d7
<BR>eri1: flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IP v4&gt; mtu 1500
index 9<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inet 192.168.2.1 netmask
ffffff00 broadcast 192.168.2.255<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;
ether 0:3:ba:13:31:d8 <BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=178340321-25072005>My routing
table</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=178340321-25072005></SPAN></FONT><FONT face="Courier New" size=2><SPAN
class=178340321-25072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=178340321-25072005>dev01:root:/etc/rc2.d/&gt; netstat
-nr</SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT size=2><SPAN class=178340321-25072005><FONT
face="Courier New">Routing Table: IPv4<BR>&nbsp;
Destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;
Gateway&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp; Flags&nbsp;
Ref&nbsp;&nbsp; Use&nbsp;&nbsp; Interface<BR>--------------------
-------------------- ----- ----- ------
---------<BR>192.168.1.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;
192.168.1.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;
U&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp; 3010&nbsp;
ce0<BR>192.168.2.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;
192.168.2.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;
U&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp; 5605&nbsp;
eri1<BR>10.50.20.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;
10.50.20.98&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;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<DIV><FONT face=Arial size=2><SPAN class=178340321-25072005>Here's my ipf rule
</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=178340321-25072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=178340321-25072005>dev01:root:/etc/rc2.d/&gt; ipfstat -on<BR>@1 pass out
quick on ce1 proto udp from 172.16.16.50/32 port 5060 &gt;&lt; 5061 to any keep
state</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=178340321-25072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2><SPAN class=178340321-25072005>Here's my
ipfstat</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=178340321-25072005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=178340321-25072005>dev01:root:/etc/rc2.d/&gt; ipfstat<BR>bad
packets:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; in
0&nbsp;&nbsp;&nbsp; out 0<BR>&nbsp;IPv6
packets:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; in 0 out
0<BR>&nbsp;input packets:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
blocked 0 passed 634116 nomatch 393476 counted 0 short 0<BR>output
packets:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; blocked 0 passed 629220
nomatch 377366 counted 0 short 0<BR>&nbsp;input packets logged:&nbsp; blocked 0
passed 0<BR>output packets logged:&nbsp; blocked 0 passed 0<BR>&nbsp;packets
logged:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; input 0 output 0<BR>&nbsp;log
failures:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp; input 0 output
0<BR>fragment state(in):&nbsp;&nbsp;&nbsp;&nbsp; kept 0&nbsp; lost 0&nbsp; not
fragmented 0<BR>fragment state(out):&nbsp;&nbsp;&nbsp; kept 0&nbsp; lost 0&nbsp;
not fragmented 0<BR>packet state(in):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kept
0&nbsp; lost 0<BR>packet state(out):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kept 0&nbsp;
lost 0<BR>ICMP replies:&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCP
RSTs sent:&nbsp; 0<BR>Invalid source(in):&nbsp;&nbsp;&nbsp;&nbsp; 0<BR>Result
cache hits(in):&nbsp; 240640&nbsp; (out):&nbsp; 251854<BR>IN Pullups
succeeded:&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; failed: 0<BR>OUT
Pullups succeeded:&nbsp; 1072&nbsp;&nbsp;&nbsp; failed: 0<BR>Fastroute
successes:&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
failures:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<BR>TCP cksum
fails(in):&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (out):&nbsp;
0<BR>IPF Ticks:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 19866<BR>Packet log flags set:
(0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; none<BR></SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=178340321-25072005>&nbsp;&nbsp;</SPAN></FONT></DIV></BODY></HTML>
<BR>
<BR>
<BR>
<BR>

<P><FONT SIZE=2 FACE="Arial">NOTE: This message, including any attachments, may include privileged, confidential and/or inside information. Any distribution or use of this communication by anyone other than the intended recipient(s) is strictly prohibited and may be unlawful. If you are not the intended recipient, please notify the sender by replying to this message and then delete it from your system. Thank you.</FONT></P>

------_=_NextPart_001_01C5915E.7E9E3CE0--
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:59 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0