Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - evalfun

#1
Chinese - 中文 / Re: opnsense使用透明代理并分流
September 14, 2022, 05:36:30 AM
请各位注意,这种方法有个致命的问题,如果tun2socks不能在网络服务启动之前启动,那么网络服务启动时会找不到这个接口,导致接口重新分配,并且断网
所以没做好开机自启的,使用中千万不要重启
#2
分享一个我自用的mosdns rc脚本,放到/etc/rc.d下面即可。要修改文件路径

#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: mosdns
# REQUIRE: LOGIN FILESYSTEMS
# KEYWORD: shutdown

. /etc/rc.subr

name="mosdns"
desc="mosdns daemon"
rcvar="mosdns_enable"
command="/usr/sbin/daemon"
pidfile="/var/run/${name}.pid"

procname="/usr/local/mosdns-freebsd-amd64/mosdns"
command_args="-f -p ${pidfile} -u root ${procname} -dir2exe -c config.yaml "

load_rc_config $name
run_rc_command "$1"
#3
I can not query domain with a rfc 1918 record using dnsmasq.For example, v4.nas.tongyifan.me has a record 172.26.153.16, but i can not get a result from dnsmasq.In the dnsmasq log,it shows
Warning   dnsmasq   possible DNS-rebind attack detected: v4.nas.tongyifan.me
How to disable dnsmasq DNS-rebind attack detect?
#4
Chinese - 中文 / opnsense使用透明代理并分流
February 20, 2022, 05:00:49 AM
思路:使用tun2socks在系统中创建虚拟接口,将进入接口的流量转换成socks5代理流量,并发送至socks5代理服务器,如v2ray或者clash。

下载tun2socks
https://github.com/xjasonlyu/tun2socks/releases
运行
tun2socks -device tun://mytun2socks0 -loglevel info -proxy socks5://127.0.0.1:1081 -stats 0.0.0.0:9000 -udp-timeout 120
注意,tun接口名称尽量随机,不能使用默认的tun0名称,否则不会在web界面中显示。
可以运行在screen里面,防止ssh关闭后进程就结束了。
也可以用clash premium,带tunnel功能。闭源软件看着不爽?其实也有clash premium的开源实现,可以找一个
比如这个https://github.com/wwqgtxx/clashr



配置网络。
在接口-分配中分配新的接口。在接口中给新的接口设置一个你不会用到的ip地址。可以设置为10.44.230.1/30
在系统-网关-单个中添加一个网关。接口选择tun2socks的接口,ip地址为10.44.230.2
如果你的代理服务器支持ipv6,你也可以添加一个私有ipv6地址。


设置国内ip段(可选)
https://docs.opnsense.org/manual/how-tos/maxmind_geo_ip.html


设置策略路由
添加两条规则,第一条规则是不对保留地址重定向,以防内网主机无法访问防火墙上的dns服务器。源选择要科学的内网主机,可以使用组来批量管理主机。目标填私有ip段。
第二条规则是对科学流量进行策略路由。源选择要科学的内网主机,目标为反向选择国内ip地址段,如果要全局代理,目标就是any,网关选择新创建的网关。
对规则排序,最后是像这样的



测试结果
访问国外:

访问国内:


#5
21.7 Legacy Series / Re: add tun interface
February 19, 2022, 05:00:51 PM
opnsense will filter interface name in the webui, you can use tun name like ovpns999 or ovpnc999
#6
Chinese - 中文 / Re: opnsense ipv6问题
February 10, 2022, 01:41:20 AM
22版本已解决此问题
#7
Chinese - 中文 / opnsense ipv6问题
February 05, 2022, 10:58:36 AM
先说明一下我的网络,WAN网络通过pppoe拨号上网,有公网v4和/60的ipv6分发前缀。LAN网络有ipv6,LAN网络下的服务器v6地址可以正常访问。opnsense主机可以访问v4和v6网站,在shell里输入curl ipv6.ip.sb,可以看到我的WAN口ipv6地址。

opnsense主机上运行的服务器程序,例如ssh服务器和openvpn服务器,可以通过ipv4公网ip连接,但是不能通过ipv6公网地址连接。主机似乎只能接收ipv6流量,但是无法发送。需要开启的端口都已经通过防火墙规则开启,在实时日志里也能看到放行记录。
同一个openvpn服务器,使用udp协议,用ipv4协议时可以正常连接,用v6时就报错,
2022-02-05T17:12:19   openvpn[38340]   TLS Error: incoming packet authentication failed from [AF_INET6]xxxx::::34181 (via xxxx:::%pppoe0)   
2022-02-05T17:12:19   openvpn[38340]   Authenticate/Decrypt packet error: packet HMAC authentication failed

如果用tcp协议,例如openvpn tcp协议的服务器和ssh服务器,完全无法连接,没有任何日志,但是已经在防火墙规则里看到已经放行流量了。。。

有大佬能帮忙看看吗?
#8
hi
I use opnsense as my router and I setup a PPPoE network, I have ipv6 on both wan and lan, and a /60 ipv6-pd.
This is ipv6 info:

Internet6:
Destination                       Gateway                       Flags     Netif Expire
default                           fe80::a19:a6ff:fe3f:53f2%pppoe0 UG     pppoe0
::1                               link#8                        UH          lo0
240e:xa0:xxxx:xxxx::/64           link#12                       U        pppoe0
240e:xa0:xxxx:xxxx:320e:d5ff:fe55:d762 link#12                  UHS         lo0
240e:ya1:yyyy:yyyy::/64           link#1                        U          igb0
240e:ya1:yyyy:yyyy:320e:d5ff:fe55:d762 link#1                   UHS         lo0
fe80::%igb0/64                    link#1                        U          igb0
fe80::320e:d5ff:fe55:d762%igb0    link#1                        UHS         lo0
fe80::%em0/64                     link#6                        U           em0
fe80::320e:d5ff:fe52:735%em0      link#6                        UHS         lo0
fe80::%lo0/64                     link#8                        U           lo0
fe80::1%lo0                       link#8                        UHS         lo0
fe80::320e:d5ff:fe55:d762%ovpns1  link#11                       UHS         lo0
fe80::%pppoe0/64                  link#12                       U        pppoe0
fe80::320e:d5ff:fe55:d762%pppoe0  link#12                       UHS         lo0

pppoe0: flags=88d1<UP,POINTOPOINT,RUNNING,NOARP,SIMPLEX,MULTICAST> metric 0 mtu 1492
        inet6 fe80::320e:d5ff:fe55:d762%pppoe0 prefixlen 64 scopeid 0xc
        inet6 240e:xa0:xxxx:xxxx:320e:d5ff:fe55:d762 prefixlen 64 autoconf
        inet 180.a.b.c --> 180.a.b.1 netmask 0xffffffff
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
igb0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=802028<VLAN_MTU,JUMBO_MTU,WOL_MAGIC>
        ether 30:0e:d5:55:d7:62
        inet6 fe80::320e:d5ff:fe55:d762%igb0 prefixlen 64 scopeid 0x1
        inet6 240e:xa1:yyyy:yyyy:320e:d5ff:fe55:d762 prefixlen 64
        inet 10.0.1.1 netmask 0xffffff00 broadcast 10.0.1.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>


My ipv6 is working, I can connect my server in Lan using ipv6 slaac address.
I could not connet the server such as openvpn and openssh-server running on opnsense using ip  240e:xa0:xxxx:xxxx:320e:d5ff:fe55:d762 or 240e:xa1:yyyy:yyyy:320e:d5ff:fe55:d762,but I can connect it by using by public ipv4 address on pppoe0.

This is openvpn server log on opnsense:

2021-08-30T16:15:33 openvpn[63412] 240e:zzz:zzzz:zzzz:8dae:664f:4e7:609f TLS: Initial packet from [AF_INET6]240e:zzz:zzzz:zzzz:8dae:664f:4e7:609f:62142 (via 240e:xa0:xxxx:yyyy:320e:d5ff:fe55:d762%pppoe0), sid=33962ebb a7001040
2021-08-30T16:15:33 openvpn[63412] 240e:zzz:zzzz:zzzz:8dae:664f:4e7:609f Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2021-08-30T16:15:33 openvpn[63412] 240e:zzz:zzzz:zzzz:8dae:664f:4e7:609f Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2021-08-30T16:15:27 openvpn[63412] 240e:zzz:zzzz:zzzz:8dae:664f:4e7:609f SIGUSR1[soft,tls-error] received, client-instance restarting
2021-08-30T16:15:27 openvpn[63412] 240e:zzz:zzzz:zzzz:8dae:664f:4e7:609f TLS Error: TLS handshake failed
2021-08-30T16:15:27 openvpn[63412] 240e:zzz:zzzz:zzzz:8dae:664f:4e7:609f TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)



I check the firewall log, the firewall accepted and forwarded the traffic.It seems server application received the request packet but can't response to client.

This is my firewal rule on WAN interface:


Can anyone help me?Thanks