openwrt - tips

 

 


Boot faster

 

/boot/grub/grub.cfg

set timeout="1"

 


Disable IPv6 modules

 

cp -a /etc/modules.d /etc/modules.d.bak

sed -i '/_ipv6/s/^/#/g' /etc/modules.d/*

reboot

lsmod | grep ipv6

nf_defrag_ipv6    # nf_conntrack
nf_reject_ipv6    # nft_reject_inet
nft_fib_ipv6      # nft_fib_inet

另見: OS Settings

 


wrt 上的 vi 使用

 

1) replace string:

:%s/string1/string2/g

2) auto indentation:

:set noai  <-- 相反 (set ai)

 


Redirect Wan Traffic to Another Wan Server

 

# Redirect incoming port 1110 to ServerIP

Diagram

Traffic  --1110/tcp-->  \ $WanNic, $RouterIP
                     [Router]
$ServerIP <--1110/tcp-- /

Code

WanNic=br-wan
RouterIP=n.n.n.n
ServerIP=x.x.x.x

iptables -A FORWARD -d $ServerIP -i $WanNic -p tcp -m tcp --dport 1110 -j ACCEPT
iptables -t nat -A PREROUTING -d $RouterIP -p tcp -m tcp --dport 1110 -j DNAT --to-destination $ServerIP