个人工具

UbuntuHelp:DnsmasqPolipoPrivoxy

来自Ubuntu中文

跳转至: 导航, 搜索

Notes

<
>Hm. i should do a dnsmasq dns+dhcp thing... another time. <
>This could probably benefit from a 'diy in 30 seconds' feel, which would include a quick 'do this do that' at the top here, more help can got by following links if people need it. Another day :)

3 proxy services

Asumptions

This Howto/walkthrough makes the following asumptions

  • The PC in question is acting as a gateway/proxy in some other form for other PCs
  • It has 2 network cards (eth0 and eth1)
  • Eth0 has the ip 192.168.0.1
  • Eth1 has the ip 192.168.1.2
  • You want other people using this service :)
  • You want other people to be able to contact you when it breaks.
  • You have read the Howtos for these 3 services

Order of configuration

Thats actualy up to you, but I will do them Dnsmasq -> Polipo -> Privoxy. It will pay for you to have read the following pages, as I will assume knowlage, and try to just meantion here what is different/important to those pages. <
>Dnsmasq <
>Polipo <
>Privoxy

Dnsmasq

Interestingly, Dnsmasq needs no special configuration as such, you just needs to know about the address lines. These have the layout address=/domain/ip, where domain is a site you want to divert, and ip is the new for the site. This can be used for 3 primary reasons:

  • Having fun
  • Redirect apple.com to ubuntulinuxorg -> address=/apple.com/82.211.81.166
  • Blocking ads (this is actualy meantioned in the config file)
  • Redirect doubleclick.net to 127.0.0.1 -> address=/doubleclick.net/127.0.0.1
  • Redirecting to a more apropriate site
  • Redirect google.com to google.com.au -> address=/google.com/216.239.39.104

And as far as adblocking goes, thats dnsmasq's part in it.

Polipo

Polipo plays no part in killing ads and cookies, but it does provide us with caching. As long as you setup Polipo as the link above (keeping the default port number), all you have to check is that your listening address is 192.168.0.1, and listening port is 8123.

Privoxy

Privoxy is going to save our eyes many ads... or thats the idea. It also needs a small change to its configs. Open up the config file

sudo vi /etc/privoxy/config

and jump to ~ line 950. Half your screen should be section 5.1 forwarding, and the other half should be section 5.2 forwarding. just above 5.2, add the following line:

forward /       192.168.0.1:8123

By doing this we just told privoxy to ask Polipo for its packages - Polipo just became an upstream proxy. Hopefully thats enought to get you started :) kk