# Shadowsocks client on router

**URL:** <https://forum.openwrt.org/t/shadowsocks-client-on-router/141822>\
**Category:** Network and Wireless Configuration\
**Created:** [November 4, 2022, 4:06pm UTC](https://forum.openwrt.org/t/shadowsocks-client-on-router/141822 "2022-11-04T16:06:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Demontager](https://forum.openwrt.org/user_avatar/forum.openwrt.org/demontager/32/62854_2.png) [@Demontager](https://forum.openwrt.org/u/Demontager)\
**Post date:** [November 4, 2022, 4:06pm UTC](https://forum.openwrt.org/t/shadowsocks-client-on-router/141822/1 "2022-11-04T16:06:15Z")

</div>

I wish to setup shadowsocks client on openwrt router and forward all lan clients traffic through shadowsocks server. [After some searching found that guide](https://forum.openwrt.org/t/guide-shadowsocks-setup-on-openwrt-for-beginners/77026) and after applying all changes, client does not open websites but may ping if ip specified.

```nohighlight
ping 142.251.39.5

PING 142.251.39.5 (142.251.39.5): 56 data bytes

64 bytes from 142.251.39.5: icmp_seq=0 ttl=118 time=186.436 ms

64 bytes from 142.251.39.5: icmp_seq=1 ttl=118 time=467.009 ms

^C

--- 142.251.39.5 ping statistics ---

2 packets transmitted, 2 packets received, 0.0% packet loss

round-trip min/avg/max/stddev = 186.436/326.723/467.009/140.286 ms

dem@MacBook12 RTN14U % ping gmail.com

ping: cannot resolve gmail.com: Unknown host

```

Current setup

```nohighlight
upstream_router 192.168.1.1(Internet)
        \
    openwrt_router
    wan_IP: 192.168.1.20
    lan_IP: 192.168.2.1         
             \
     client_IP: 192.168.2.244                     

```

shadowsocks-libev config according to [github manual](https://github.com/openwrt/packages/blob/master/net/shadowsocks-libev/README.md#recipes)

Have removed inactive sections

```nohighlight
root@OpenWrt:~# cat /etc/config/shadowsocks-libev

config ss_rules 'ss_rules'
	option src_default 'checkdst'
	list dst_ips_forward '8.8.8.8'
	option redir_tcp 'ssr0'
	option redir_udp 'ssr0'
	option dst_default 'forward'
	option local_default 'forward'

config server 'sss0'
	option server 'my_server_ip'
	option server_port '6338'
	option password 'my_password'
	option method 'chacha20-ietf-poly1305'

config ss_tunnel
	option server 'sss0'
	option local_address '0.0.0.0'
	option local_port '8053'
	option tunnel_address '8.8.8.8:53'
	option mode 'tcp_and_udp'
	option disabled '0'

config ss_redir 'ssr0'
	option server 'sss0'
	option local_address '0.0.0.0'
	option local_port '1100'
	option mode 'tcp_and_udp'
	option reuse_port '1'
	option disabled '0'

```

 ![Screen Shot 2022-11-04 at 18.24.57](https://forum.openwrt.org/uploads/default/original/3X/a/b/ab8f857b018b5e0264200a3eca52fdf62763e214.png)  
 ![Screen Shot 2022-11-04 at 18.55.04](https://forum.openwrt.org/uploads/default/original/3X/9/f/9f81ce85b4795adf40adda7fd91593448a38f703.png)  
 ![Screen Shot 2022-11-04 at 18.59.42](https://forum.openwrt.org/uploads/default/original/3X/5/9/5923eff3edcfe865aed6951c548e766910dac540.png)

 ![Screen Shot 2022-11-04 at 19.00.08](https://forum.openwrt.org/uploads/default/original/3X/7/e/7e7593f9d335f76236b8793a45cb086c3d3d3f2f.png)  
 ![Screen Shot 2022-11-04 at 19.00.16](https://forum.openwrt.org/uploads/default/original/3X/c/9/c9c6beab5c04359e2e51786855d58622a3bb0342.png)

dhcp config

```nohighlight
root@OpenWrt:~# cat /etc/config/dhcp

config dnsmasq
        list server '127.0.0.1#8053'
	option noresolv '1'
	option localuse '1'
	option domainneeded '1'
	option boguspriv '1'
	option filterwin2k '0'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option nonegcache '0'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option nonwildcard '1'
	option localservice '1'
	option ednspacket_max '1232'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

```

Restarted dnsmasq and showsocks.

---

<div class="post-metadata">

**Author:** ![mfat](https://forum.openwrt.org/letter_avatar/mfat/32/6_449c533f586939b6e5f246632a46421f.png) [@mfat](https://forum.openwrt.org/u/mfat)\
**Post date:** [December 3, 2022, 11:38am UTC](https://forum.openwrt.org/t/shadowsocks-client-on-router/141822/2 "2022-12-03T11:38:09Z")

</div>

I have exactly the same problem..

---

<div class="post-metadata">

**Author:** ![ezamos](https://forum.openwrt.org/letter_avatar/ezamos/32/6_449c533f586939b6e5f246632a46421f.png) [@ezamos](https://forum.openwrt.org/u/ezamos)\
**Post date:** [February 11, 2023, 7:45pm UTC](https://forum.openwrt.org/t/shadowsocks-client-on-router/141822/3 "2023-02-11T19:45:18Z")

</div>

Same problem. No solution? Its look like a nat rule problem.

---

<div class="post-metadata">

**Author:** ![vfilatov87](https://forum.openwrt.org/letter_avatar/vfilatov87/32/6_449c533f586939b6e5f246632a46421f.png) [@vfilatov87](https://forum.openwrt.org/u/vfilatov87)\
**Post date:** [March 6, 2023, 2:15pm UTC](https://forum.openwrt.org/t/shadowsocks-client-on-router/141822/5 "2023-03-06T14:15:23Z")

</div>

Same problem

---

<div class="post-metadata">

**Author:** ![vfilatov87](https://forum.openwrt.org/letter_avatar/vfilatov87/32/6_449c533f586939b6e5f246632a46421f.png) [@vfilatov87](https://forum.openwrt.org/u/vfilatov87)\
**Post date:** [March 6, 2023, 7:55pm UTC](https://forum.openwrt.org/t/shadowsocks-client-on-router/141822/6 "2023-03-06T19:55:50Z")

</div>

This video helped me

[![](https://img.youtube.com/vi/f4-GUnCK2Wo/maxresdefault.jpg "How to install v2ray and Shadowsocks on router passwall openwrt") ](https://www.youtube.com/watch?v=f4-GUnCK2Wo)

---

<div class="post-metadata">

**Author:** ![JJBungles](https://forum.openwrt.org/letter_avatar/jjbungles/32/6_449c533f586939b6e5f246632a46421f.png) [@JJBungles](https://forum.openwrt.org/u/JJBungles)\
**Post date:** [March 15, 2023, 2:40pm UTC](https://forum.openwrt.org/t/shadowsocks-client-on-router/141822/7 "2023-03-15T14:40:01Z")

</div>

Please press edit on ss\_redir.ssr0 and ensure all tick boxes are off in the "Advanced Settings" tab.

I have only two fields that are populated: 1) mode of operation "tcp\_and\_udp" and

1. Timeout (keep the same time as the others)

---

<div class="post-metadata">

**Author:** ![JJBungles](https://forum.openwrt.org/letter_avatar/jjbungles/32/6_449c533f586939b6e5f246632a46421f.png) [@JJBungles](https://forum.openwrt.org/u/JJBungles)\
**Post date:** [March 15, 2023, 2:52pm UTC](https://forum.openwrt.org/t/shadowsocks-client-on-router/141822/8 "2023-03-15T14:52:48Z")

</div>

Also ensure SS\_redir.hj is enabled and matches the configuration of ss\_redir.ssr0.

---

<div class="post-metadata">

**Author:** ![mullakhmetov](https://forum.openwrt.org/user_avatar/forum.openwrt.org/mullakhmetov/32/83598_2.png) [@mullakhmetov](https://forum.openwrt.org/u/mullakhmetov)\
**Post date:** [October 24, 2023, 6:39pm UTC](https://forum.openwrt.org/t/shadowsocks-client-on-router/141822/9 "2023-10-24T18:39:05Z")

</div>

I solved this problem by adding my outline IP (sss0 server) as well as some reserved local subnets to "Dst ip/net bypass".

```plaintext
root@OpenWrt:~# cat /etc/config/shadowsocks-libev

config ss_tunnel
	option server 'sss0'
	option local_address '0.0.0.0'
	option local_port '8053'
	option tunnel_address '1.1.1.1:53'
	option mode 'tcp_and_udp'
	option timeout '60'

config ss_redir 'hj'
	option server 'sss0'
	option local_address '0.0.0.0'
	option local_port '1100'
	option mode 'tcp_and_udp'
	option timeout '60'
	option fast_open '1'
	option verbose '1'
	option reuse_port '1'

config ss_rules 'ss_rules'
	option redir_tcp 'hj'
	option redir_udp 'hj'
	option src_default 'checkdst'
	option dst_default 'forward'
	option local_default 'forward'
	option dst_ips_bypass_file '/etc/shadowsocks-libev/bypass.lst'

config server 'sss0'
	option server '_outline_ip_address_'
	option server_port '_outline_port_'
	option method 'chacha20-ietf-poly1305'
	option password '_outline_password_'

root@OpenWrt:~# cat /etc/shadowsocks-libev/bypass.lst

0.0.0.0/8
10.0.0.0/8
127.0.0.0/8
169.254.0.0/16
172.16.0.0/12
192.168.0.0/16
224.0.0.0/4
240.0.0.0/4
_outline_ip_address_

```

---

<div class="post-metadata">

**Author:** ![ulmwind](https://forum.openwrt.org/letter_avatar/ulmwind/32/6_449c533f586939b6e5f246632a46421f.png) [@ulmwind](https://forum.openwrt.org/u/ulmwind)\
**Post date:** [October 24, 2023, 8:33pm UTC](https://forum.openwrt.org/t/shadowsocks-client-on-router/141822/10 "2023-10-24T20:33:20Z")

</div>

Shadowsocks is proxy, so it is not possible to "forward all traffic" through it. Clients should use SOCKS5-proxy, running on router.

---

<div class="post-metadata">

**Author:** ![CurlyCrit](https://forum.openwrt.org/letter_avatar/curlycrit/32/6_449c533f586939b6e5f246632a46421f.png) [@CurlyCrit](https://forum.openwrt.org/u/CurlyCrit)\
**Post date:** [April 28, 2024, 2:58am UTC](https://forum.openwrt.org/t/shadowsocks-client-on-router/141822/11 "2024-04-28T02:58:06Z")

</div>

I've done this, and I've still having DNS issues. My configuration matches the above exactly, and I'm able to ping 8.8.8.8, but not [google.com](http://google.com) and nslookup returns an error. Even with the local subnets, and server IP added to the "Dst ip/net bypass".

@Demontager Were you able to get this resolved?

Any help would be greatly appreciated. I'm embarrassed to admit I've spent probably close to 30 hours stuck on this issue.
