BSD Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsBSD Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old February 11th, 2004, 12:37 AM
blackcow blackcow is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 4 blackcow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Redirecting _outgoing_ packets to internal services

Hello,

Im currently running a freebsd box to NAT an adsl connection throughout our home network. The internet interface is named tun0, while the internal interface is named rl0. We use the 192.168.0.0/24 spectrum and the bsd box is 192.168.0.1

I'm trying to 'force' the use of our internal dns server by capturing any tcp/udp packets on port 53 destined for our ISP's dns servers and forwarding them to the local dns server also running on the same freebsd gateway.

Our internal dns server would normally forward any unknown requests to our ISP dns servers. So basically dns requests from anywhere on our local network should be 'diverted' but reuqests from the bsd server itself should be allowed through.


I'm having great difficulty trying to explain my requirements to google. I always end up with texts relating to forwarding INCOMMING packets to internal services ( such as a www server running behind nat ) which is NOT what i need

I also want to force use of our squid proxy server ( also running on the bsd box ), so that any connections to http on the internet are dealt with by the internal squid server.

Any info and in particular example configs are appreciated, im currently using both IPFilter ( for nat and firewalling ) and IPFW(2) ( for bandwidth limiting ).

In Essence:

Code:
Forward/divert outgoing packets destined for port 53 udp/tcp to internal dns server
Allow outgoing packets destined for port 53 udp/tcp from bsd gateway to reach and return from ISP's dns servers


Thanks in advance, this is freaking confusing i tell ye :P

Reply With Quote
  #2  
Old February 11th, 2004, 12:25 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
You could probably find it on google with the keyword "transparent proxy".

But it should IMO be as simple as adding some rules to natd and ipfw similar to these:
Code:
natd:
-redirect_port tcp 192.168.0.1:domain domain
-redirect_port udp 192.168.0.1:domain domain
ipfw:
divert natd ip from 192.168.0.0/24 to any in via rl0

This is just an idea, i didn't test it and I can't tell if it works...

hth,
M.
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
  #3  
Old February 11th, 2004, 05:19 PM
blackcow blackcow is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 4 blackcow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hmmm,


Those natd rules just redirect _incomming_ packets ( from the internet ) to a local dns server.

When i added a divert rule for rl0 ( which is my internal interface, i already have a rule for my external divert natd ) i loose connectivity.


I am not trying to provide dns to the world but rather force the use of our internal dns server rather than our ISP's dns server.

I would also be using any help i get here to force use of an internal squid proxy server ( all OUTGOING packets should be directed 'back in' to the squid running on 3128 or whatever )

This is getting very confusing *weep*

Reply With Quote
  #4  
Old February 29th, 2004, 02:25 PM
kotolenko kotolenko is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Maribor; Slovenia
Posts: 21 kotolenko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hi
is your BSD box the only way out to the internet for your local clients? If so than you can force your clients to use local proxy by blocking all traffic from them to any address and port other than your proxy.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsBSD Help > Redirecting _outgoing_ packets to internal services


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway