Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hostname resolution not working #69

Closed
hopgoodpaul opened this issue Oct 14, 2015 · 2 comments
Closed

Hostname resolution not working #69

hopgoodpaul opened this issue Oct 14, 2015 · 2 comments

Comments

@hopgoodpaul
Copy link

I'm having trouble resolving hostnames using redsocks.

When I access an IP address directly I can view the webpage however browsing to the hostname does not work.

My setup:
Raspberry Pi B+ 1 running Raspbian Jessie acting as a router with hostapd and dnsmasq. I'm using two identical wireless dongles. One is the main AP for all devices. The other dongle is creating another AP just for my iPhone to connect to which is running the proxy server (3proxy).

Here is my redsocks.conf:

base {
// debug: connection progress & client list on SIGUSR1
log_debug = off;

// info: start and end of client session
log_info = on;

/* possible `log' values are:
 *   stderr
 *   "file:/path/to/file"
 *   syslog:FACILITY  facility is any of "daemon", "local0"..."local7"
 */
log = "syslog:daemon";

// detach from console
daemon = on;

/* Change uid, gid and root directory, these options require root
 * privilegies on startup.
 * Note, your chroot may requre /etc/localtime if you write log to syslog.
 * Log is opened before chroot & uid changing.
 */
user = redsocks;
group = redsocks;
// chroot = "/var/chroot";

/* possible `redirector' values are:
 *   iptables   - for Linux
 *   ipf        - for FreeBSD
 *   pf         - for OpenBSD
 *   generic    - some generic redirector that MAY work
 */
redirector = iptables;
}

redsocks {
/* `local_ip' defaults to 127.0.0.1 for security reasons,
 * use 0.0.0.0 if you want to listen on every interface.
 * `local_*' are used as port to redirect to.
 */
local_ip = 0.0.0.0;
local_port = 1081;

// `ip' and `port' are IP and tcp-port of proxy-server
// You can also use hostname instead of IP, only one (random)
// address of multihomed host will be used.
ip = 10.10.10.10;
port = 1080;


// known types: socks4, socks5, http-connect, http-relay
type = socks5;

// login = "foobar";
// password = "baz";
}

redudp {
// local_ip' should not be 0.0.0.0 as it's also used for outgoing
// packets that are sent as replies - and it should be fixed
// if we want NAT to work properly.
local_ip = 127.0.0.1;
local_port = 10053;

// ip' and `port' of socks5 proxy server.
ip = 10.10.10.10;
port = 1080;
//login = username;
//password = pazzw0rd;

// kernel does not give us this information, so we have to duplicate it
// in both iptables rules and configuration file.  By the way, you can
// set `local_ip' to 127.45.67.89 if you need more than 65535 ports to
// forward ;-)
// This limitation may be relaxed in future versions using contrack-tools.
dest_ip = 8.8.8.8;
dest_port = 53;

udp_timeout = 30;
udp_timeout_stream = 180;
}

dnstc {
// fake and really dumb DNS server that returns "truncated answer" to
// every query via UDP, RFC-compliant resolver should repeat same query
// via TCP in this case.
local_ip = 127.0.0.1;
local_port = 5300;
}

And here are my firewall settings with iptables (which I don't know much about so am assuming is where the problem lies):

Chain PREROUTING (policy ACCEPT)
target prot opt source destination
REDSOCKS tcp -- anywhere anywhere

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
REDSOCKS udp -- anywhere anywhere
REDSOCKS tcp -- anywhere anywhere

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination

Chain REDSOCKS (3 references)
target prot opt source destination
RETURN all -- anywhere default/8
RETURN all -- anywhere 10.0.0.0/8
RETURN all -- anywhere loopback/8
RETURN all -- anywhere link-local/16
RETURN all -- anywhere 172.16.0.0/12
RETURN all -- anywhere 224.0.0.0/4
RETURN all -- anywhere 240.0.0.0/4
REDIRECT tcp -- anywhere anywhere redir ports 1081
REDIRECT udp -- anywhere anywhere redir ports 10053

Any help you can give would be great. Like I said I can access IP addresses directly but can't get hostnames to resolve.

When configuring the browser to use socks through the phone when they are on the same network works just fine but I want to make the Pi a transparent socks proxy router and don't want to have to configure each device to use the socks proxy.

Thanks

@darkk
Copy link
Owner

darkk commented Feb 1, 2018

I'm sorry, I've missed that question long time ago.
The configuration seems to be reasonable... but I doubt that the question is still relevant three years later, but, please, reopen the issue if it is.

@darkk darkk closed this as completed Feb 1, 2018
@tdzard94
Copy link

Any solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants