https://github.com/techprober/mosdns-lxc-deploy
A generic guide to deploy mosdns in Proxmox LXC Container. [maintainers=@piyoki]
https://github.com/techprober/mosdns-lxc-deploy
dns-server lxc mosdns proxmox
Last synced: about 2 months ago
JSON representation
A generic guide to deploy mosdns in Proxmox LXC Container. [maintainers=@piyoki]
- Host: GitHub
- URL: https://github.com/techprober/mosdns-lxc-deploy
- Owner: techprober
- License: mit
- Created: 2022-08-25T11:05:37.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-27T18:54:47.000Z (about 1 year ago)
- Last Synced: 2024-12-11T00:11:41.182Z (10 months ago)
- Topics: dns-server, lxc, mosdns, proxmox
- Language: Shell
- Homepage:
- Size: 5.02 MB
- Stars: 49
- Watchers: 1
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
mosdns-lxc-deploy
A generic guide to deploy mosdns in Proxmox LXC Container
![]()
![]()
![]()
![]()
![]()
## Project Owner
CopyRight 2021-2023 @TechProber. All rights reserved.
Maintainer: [ Kev (@piyoki) ](https://github.com/piyoki)
## Related Projects
- [IrineSistiana/mosdns](https://github.com/IrineSistiana/mosdns) - A self-hosted DNS resolver
- [tteck/Proxmox](https://github.com/tteck/Proxmox) - Proxmox Helper Scripts
- [Loyalsoldier/v2ray-rules-dat](https://github.com/Loyalsoldier/v2ray-rules-dat) - Enhanced edition of V2Ray rules dat files, compatible with Xray-core, Shadowsocks-windows, Trojan-Go and leaf.
- [Loyalsoldier/geoip](https://github.com/Loyalsoldier/geoip) - Enhanced edition of GeoIP files for V2Ray, Xray-core, Trojan-Go, Clash and Leaf, with replaced CN IPv4 CIDR available from ipip.net, appended CIDR lists and more.## Table of contents
* [Documentation](#documentation)
* [How to Use](#how-to-use)
* [Preparation](#preparation)
* [Download Binary](#download-binary)
* [Download Rules](#download-rules)
* [Reset Port 53](#reset-port-53)
* [Update Configuration](#update-configuration)
* [Run as Systemd Service](#run-as-systemd-service)
* [CN Users](#cn-users)
* [Appendix](#appendix)## Documentation
Mosdns Official Wiki: https://irine-sistiana.gitbook.io/mosdns-wiki/
Know DNS Providers: https://adguard-dns.io/kb/general/dns-providers/
## How to Use
### Preparation
Create a new directory for mosdns
```bash
mkdir -p /etc/mosdns
```Create sub directories
```bash
sudo mkdir -p /etc/mosdns/{ips,domains,downloads,custom,scripts}
sudo touch /etc/mosdns/cache.dump
```Make sure you have the following file structure present on your host:
```
# /etc/mosdns
./
|-- cache.dump
|-- config.yml
|-- custom
|-- domains
|-- downloads
|-- scripts
`-- ips5 directories, 2 files
```> [!NOTE]
> There is a dedicated `bootstrap playbook` to automate this, [check it out](./playbooks/auto-artifact-export.yml).### Download Binary
Download the latest mosdns binary from the [GitHub Release](https://github.com/IrineSistiana/mosdns/releases) Page
```bash
MOSDNS_PATH=/etc/mosdns
curl -o $MOSDNS_PATH/downloads/mosdns.zip https://github.com/IrineSistiana/mosdns/releases/download/{VERSION}/mosdns-{PLATFORM}-{ARCH}.zip
# e.g
# wget https://github.com/IrineSistiana/mosdns/releases/download/v5.1.3/mosdns-linux-amd64.zip
unzip $MOSDNS_PATH/downloads/mosdns.zip
sudo install -Dm755 $MOSDNS_PATH/downloads/mosdns /usr/bin
```### Download Rules
Available Rules -
Download and unzip the `geoip.zip` and `geosite.zip` files to `./ips/` and `./domains` respectively.
```bash
MOSDNS_PATH=/etc/mosdns
curl --progress-bar -JL -o $MOSDNS_PATH/downloads/geoip.zip https://github.com/techprober/v2ray-rules-dat/raw/release/geoip.zip
curl --progress-bar -JL -o $MOSDNS_PATH/downloads/geosite.zip https://github.com/techprober/v2ray-rules-dat/raw/release/geosite.zip
unzip -o $MOSDNS_PATH/downloads/geoip.zip -d $MOSDNS_PATH/ips
unzip -o $MOSDNS_PATH/downloads/geosite.zip -d $MOSDNS_PATH/domains
```> [!NOTE]
> Alternatively, you may use a dedicated script to automatically download and extract the geodata artifacts. See [./scripts/geodata-update.sh](https://github.com/techprober/mosdns-lxc-deploy/blob/master/scripts/geodata-update.sh)```bash
curl -L -o /usr/local/etc/mosdns/scripts/geodata-update.sh https://github.com/techprober/mosdns-lxc-deploy/raw/master/scripts/geodata-update.sh
```### Reset Port 53
```bash
mkdir -p /etc/systemd/resolved.conf.d# /etc/systemd/resolved.conf.d/mosdns.conf
[Resolve]
DNS=127.0.0.1
DNSStubListener=no
```Specifying `127.0.0.1` as DNS server address is necessary because otherwise the nameserver will be `127.0.0.53` which doesn’t work without DNSStubListener.
Activate another resolv.conf file:
```bash
sudo mv /etc/resolv.conf /etc/resolv.conf.backup
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
```Restart DNSStubListener:
```bash
systemctl daemon-reload
systemctl restart systemd-resolved
```### Update Configuration
> [!WARNING]
> Please take a look at the content of `config-{VERSION}.yml` before you copy it to `/etc/mosdns`. It is a boilerplate template which intends to provide users a reference to start with customizing their own config.Get the latest config file, namely `config-{VERSION}.yml`, from `./mosdns` folder in this repository, copy it to `/etc/mosdns`, and update params to fit your need.
### Run as Systemd Service
```bash
sudo tee /etc/systemd/system/mosdns.service <