相关命令:
客户端:
1 2 |
mkfifo /tmp/dns while : ; do nc -l -u 53 </tmp/dns | (nc -w 1 localhost 5353 > /tmp/dns && { pid=$( ps -ao comm,pid|awk '$1=="nc"{print $2}'); [[ $pid != "" ]] && kill $pid; } ) done & |
(如果有socat,就不用这这个while循环了)
服务端:
1 2 3 4 |
mkfifo /tmp/dns nc -l -k -p 5353 < /tmp/dns | nc -u 172.16.16.1 53 > /tmp/dns & ssh -R 5353:localhost:5353 |
参考: