海运的博客

dnsmasq的dns缓存cache设置

发布时间:October 31, 2018 // 分类: // No Comments

#缓存的数量
cache-size=10240
#如果查询的域名没ttl,则使用此设置为缓存ttl时间
neg-ttl=600
#指定允许返回给客户端最大ttl时间
max-ttl=600
#dnsmasq服务器缓存最大时间设定
max-cache-ttl=3600
#dnsmasq服务器缓存最小时间设定
min-cache-ttl=3600

总结:
想要客户端的ttl时间小于域名ttl,使用max-ttl,返回客户端为max-ttl设定值,但是dnsmasql缓存时间以域名ttl为准。

想要dnsmasq缓存时间小于域名ttl,使用max-cache-ttl,首次返回客户端ttl为域名ttl,再次请求返回的ttl则是dnsmasq缓存剩余时间ttl,配合max-ttl实现dnsmasq缓存ttl和客户端ttl一致。

想要dnsmasq缓存时间大于域名ttl,使用min-cache-ttl,首次返回客户端ttl为域名ttl,再次请求返回的ttl则是dnsmasq缓存剩余时间ttl,此值dnsmasq限制最高为1小时,更高需重新编译。

想要客户端ttl时间大于域名ttl时间,使用dnsmasq修改min ttl时间 patch,首次请求返回给客户端min-ttl时间,服务器缓存时间以域名ttl时间为准,可配合min-cache-ttl使用。
参考:
http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

git clone指定branch或tag/commit

发布时间:October 28, 2018 // 分类: // No Comments

取完整:

git clone https://github.com/arvidn/libtorrent.git
cd libtorrent/

查看branch:

git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/RC_1_0
  remotes/origin/RC_1_1

使用指定branch:

git checkout origin/RC_1_1

查看tag:

git tag
libtorrent-1_1_8
libtorrent-1_1_9
libtorrent-1_2_0_RC

使用指定tag:

git checkout libtorrent-1_1_9

也可以在clone的时间指定tag或branch:

git clone -b RC_1_1 https://github.com/arvidn/libtorrent.git 
git clone -b libtorrent-1_1_9 https://github.com/arvidn/libtorrent.git 

选择指定commit:

git checkout ac0ab0c916197f4daf674272a4d0b89cb8b0f7aa

k2p下潘多拉/openwrt配置ipv6地址

发布时间:October 27, 2018 // 分类:K2P // 1 Comment

我这宽带分配ipv6使用dhcpv6-pd方式,潘多拉默认配置ipv6就能正常使用,由于使用虚拟机和未使用自带的firewall走了一些坑,顺便将openwrt的ipv6分配了解了下。
wan6接口的dhcpv6客户端获取ipv6公网前缀:
2018-10-27_110916.png

路由获取IPV6前缀后向局域网内机器分发址使用RA路由通告和dhcpv6方式:
支持IPV6的主机会主动发路由器询问报文,然后路由器RA返回是否使用DHCPV6分配或用IP前缀、网关,机器根据MAC生成IPV6地址,最新的RA协议支持RDNSS可配置DNS,Windows 10最新系统才支持。

dhcpv6支持有状态和无状态,有状态类似于DHCPV4,无状态使用RA通告配置IP,DHCPV6配置DNS、NTP等扩展配置信息,据说android系统不支持dhcpv6。

有公网前缀的不要单独使用有状态的,不然pppoe重新报号前缀改变内网机器前缀不改。
有状态的+无状态的,使用dhcpv6有状态分配地址,同时如果有公网前缀也使用无状态分配,无前缀只使用DHCPV6有状态分配。

RA和DHCPV6模式有:服务器模式、中继模式、混合模式,前缀分配使用服务器模式,如果运营商不支持dhcpv6-pd可使用中继方式,中继模式要将wan6的dhcp客户端设置成master,lan的dhcp相当于slave。
混合模式会根据配置自动选择使用中继还是服务器模式。
If the interface was master, then hybrid means relay or disabled. If there was no slave relay in the other interfaces, then it will be configured to disabled.

If the interface was not master, then hybrid means relay or server. If there was no master, then the interface will be configured to server.

默认lan接口的dhcpv6服务器配置:
2018-10-27_111135.png
通告的DNS地址就是RDNSS,填写此项客户端可通过RA通告配置DNS地址,如果客户端支持RDNSS关闭DHCPV6服务也能正常使用了。

总结分配IP方式使用RA+DHCPV6无状态或RA+RDNSS不用DHCPV6就可以了。
配置iptables:

ip6tables -F
ip6tables -X
ip6tables -Z
ip6tables -P INPUT   DROP
ip6tables -P OUTPUT  ACCEPT
ip6tables -P FORWARD DROP

ip6tables -A INPUT -i lo -j ACCEPT
ip6tables -A INPUT -i br-lan -j ACCEPT
#路由通告使用icmpv6协议,类型133-137
ip6tables -A INPUT -p icmpv6 -j ACCEPT
#这个一定要允许,不然获取不到公网ipv6前缀
ip6tables -A INPUT -m conntrack --ctstate NEW -m udp -p udp --sport 547 --dport 546 -s fe80::/64 -d fe80::/64 -j ACCEPT
#ip6tables -A INPUT -s fe80::/10 -d fe80::/10 -p udp -m udp --sport 547 --dport 546 -j ACCEPT
#ip6tables -A INPUT -p icmpv6 --icmpv6-type echo-request -j ACCEPT
ip6tables -A INPUT -i pppoe-wan -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
ip6tables -A FORWARD -i br-lan -o pppoe-wan  -j ACCEPT
ip6tables -A FORWARD -i br-lan -o br-lan  -j ACCEPT
ip6tables -A FORWARD -i pppoe-wan -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT

ip6tables -t mangle -F
ip6tables -t mangle -X
ip6tables -t mangle -Z
ip6tables -t mangle -A POSTROUTING -o pppoe-wan -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu 

参考:
https://community.arubanetworks.com/t5/Controller-Based-WLANs/Explain-the-M-and-O-bit-in-IPv6-DHCP-server-configuration-What/ta-p/177442
https://github.com/gnu4cn/ccna60d/blob/master/d07-IPv6.md
https://www.v2ex.com/t/486379
http://www.right.com.cn/forum/thread-338106-1-1.html
https://qiita.com/kwi/items/c002cd3c466504c96391
https://i-meto.com/lede-ipv6/
https://openwrt.org/docs/techref/odhcpd

n1盒子ubuntu使用netplan配置wifi无线连接

发布时间:October 25, 2018 // 分类:N1 // 2 Comments

ubuntu 18.04使用netplan配置网络信息,后端使用Network Manager或systemd-networkd管理网络,默认使用systemd-networkd,systemd-networkd本身不支持无线,使用wpasupplicant连接无线。

apt install iproute2 wpasupplicant

查看无线网卡名称:

iw dev          

网卡名称为wlan0,开启:

ip lin set wlan0 up

搜索路由ssid:

iw dev wlan0 scan

netplan配置:

network:
  version: 2
  renderer: networkd
  wifis:
    wlan0:
      dhcp4: yes
      dhcp6: no
      access-points:
        "ssid":
          password: "password"

netplan更多配置示例:https://netplan.io/examples

n1盒子armbian下载址及写入u盘软件

发布时间:October 20, 2018 // 分类:N1 // No Comments

armbian下载地址:
https://yadi.sk/d/pHxaRAs-tZiei
https://yadi.sk/d/_rQgn_FosYuW0g
写入u盘linux下使用dd,windows下可使用以下:
https://etcher.io/
https://www.alexpage.de/usb-image-tool/download/

更新:
最好不要使用linux虚拟机dd到u盘,速度太慢还不稳定。

分类
最新文章
最近回复
  • 海运: 恩山有很多。
  • swsend: 大佬可以分享一下固件吗,谢谢。
  • Jimmy: 方法一 nghtp3步骤需要改成如下才能编译成功: git clone https://git...
  • 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
  • 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
  • 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...
  • 孤狼: 擦。。。。apcupsd会失联 nut在冲到到100的时候会ONBATT进入关机状态,我想想办...
  • 海运: 网络,找到相应的url编辑重发请求,firefox有此功能,其它未知。
  • knetxp: 用浏览器F12网络拦截或监听后编辑重发请求,修改url中的set为set_super,将POS...
  • Albert: 啊啊啊啊啊啊啊啊啊 我太激动了,终于好了英文区搜索了半天,翻遍了 pve 论坛没找到好方法,博...