├── .gitattributes ├── .gitignore ├── 01.md ├── 02.md ├── 03.md ├── 04.md ├── 05.md ├── 06.md ├── 07.md └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text eol=lf 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Temp file of Gedit 2 | *~ 3 | .gitignore~ 4 | 5 | -------------------------------------------------------------------------------- /01.md: -------------------------------------------------------------------------------- 1 | # 基本系统安装及配置 2 | ## ArchLinux 安装的絮絮叨叨 3 | 绝大部分参见 [官方Wiki的新手指南](https://wiki.archlinux.org/index.php/Beginners%27_guide),看wiki还是优先看英文的,中文的更新慢,有的时候会坑死,中文wiki那部分有大陆必看的部分,你懂的。 4 | 5 | 下镜像之后烧录,UltraISO 不好用了,Win下使用 [Win32diskimager](http://sourceforge.net/projects/win32diskimager/),Linux下使用dd,制作完成之后想要恢复原来的容量需要[清除第一个扇区](https://wiki.archlinux.org/index.php/USB_flash_installation_media#How_to_restore_the_USB_drive)。 6 | 7 | 因为Arch是个滚动发行版,没有具体的版本一说,所以只要不是太老的版本都可以,网络非常重要,没网络是没法安装Arch的。 8 | 首先确认启动模式是否为UEFI 9 | ``` 10 | # efivar -l 11 | ``` 12 | 默认是英文键盘布局,一般没人改,如果修改布局,有几个文件要连带修改。 13 | 14 | 接着准备网络,如果通过DHCP的先ping一下,看看连通性。**必须用`ip link`看自己的设备名称,然后写下来**,特殊设备准备好firmware,比如内核不支持的无线网卡什么的,特殊的还是先看看wiki再说。 15 | 16 | 安装过程的无线网可以先使用`# wifi-menu your-wireless-device`,安装完之后使用`netctl`或者装X用NetworkManager。NetworkManager和netctl会有冲突,安完DE之后可以考虑彻底关闭netctl了。 17 | 18 | 通过parted,fdisk,cfdisk等创建分区表,分区之后要创建文件系统,mkfs神马的,别忘了。 19 | 20 | 正式安装之前如果有swap一定先挂载上,一是不怕没空间,二是生成fstab的时候会创建swap的条目。 21 | 22 | 挂载分区都是挂到 /mnt, 一定先挂根,接着`mkdir -p`挂上其余的,用lsblk检验。 23 | 24 | 刚开始一定选个速度快,与官方同步快的mirror,要不慢死了。 25 | 26 | **pacstrap, pacman执行过程中死了也不要终止它执行,非常重要要说两遍的,懒得复制了,还有必读[pacman](https://wiki.archlinux.org/index.php/Pacman)的说明** 27 | 28 | chroot之后别忘再次设置网络,不然哭死。 29 | 30 | 单系统没有时钟问题,双系统的话最好bios使用UTC时间,底下单独列了一项。 31 | 32 | 创建ramdisk注意修改`/etc/mkinitcpio.conf`中的hook;如果是vps里安装Arch而且使用了virtio的驱动(如果看到的是 `/dev/vdX` 就别犹豫了),需要添加 `virtio virtio_pci virtio_blk virtio_ring` 到 MODULE 中;如果在 `mkinitcpio` 的时候出现提示可能缺少firmware的情况,需要先用 `modinfo` 看一下是做什么用的,接下来去安装,一般在AUR中,包名一般为XXX-firmware。 33 | 34 | 单系统安装grub的时候一定安装到磁盘而不是分区,也就是不要用sdaX;Windows和Arch的双系统,尤其是安装在同一块硬盘上,需要加上 `--debug --force` 参数强迫grub-install工作,详见[wiki](https://wiki.archlinux.org/index.php/GRUB#Install_to_partition_or_partitionless_disk)。 35 | 36 | 为了保险,最后可以`umount -R /mnt`,一般来说在`reboot`的时候能够正确处理。 37 | 38 | 总之安装确保基础的有了,然后网络通了,安装CLI的浏览器,比如w3m,links,elinks去查wiki。 39 | 40 | 安装完了之后进新系统,别高兴太早,先创建普通用户,装vim,用visudo修改sudo权限的用户,没什么事不用root。 41 | 42 | [系统维护](https://wiki.archlinux.org/index.php/System_maintenance)和[提高系统稳定性](https://wiki.archlinux.org/index.php/Enhance_system_stability)要仔细看。 43 | 44 | 中文社区archlinuxcn的仓库和yaourt的archlinuxfr仓库尽量加上。Multilib最好打开,不是高手别开各种Testing。 45 | 46 | 如果发现更新包比较慢,一般是坑爹的网络环境导致的,比如连接 dl.google.com 的包(典型例子为google-chrome)更新,先在 pacman.conf 中IgnorePkg,然后在早晨大约05:00~07:00的时段更新这类包,一般能达到满速。 47 | 48 | Arch已经全面systemd了,以前的SysVInit脚本也可以用,但还是学习一下怎么写xxx.service文件吧。 49 | 50 | 至于GUI,驱动方面尽量没有特殊需求不用“官方驱动”,开源才是王道,顺便Fuck you nVidia。 51 | 52 | 安装Xorg之后解决驱动问题,刚开始要用xterm和twm简单`startx`测试一下安装的驱动和X的配合效果,接下来再安装DM、DE,有另外需求的可以安装其他的WM,双显卡笔记本最恶心,暂时用的[bumblebee](https://wiki.archlinux.org/index.php/Bumblebee),NVIDIA GTX660的显卡用nouveau的开源驱动+linux 3.19.2会出现X随机死掉的现象,貌似是个bug,已经换用nvidia闭源驱动。 53 | 54 | DM是帮助自动开X的,可以选择,WM看自己需求,写代码多的用平铺式的,像我这种渣渣就先用DE里面的,比如KDE的kWin。DE是一揽子解决方案,目前用KDE,的确很花哨。 55 | 56 | 防火墙还是用iptables吧,安装之后默认是空规则,需要自己加。Arch的iptables你不弄他就和没有一样。 57 | 58 | 字体需要安装一堆,少安点也可以,它们也不怎么占地方,中文的话喜欢思源黑体,文泉驿大家都用,ttf-fantasque-sans的等宽字体貌似也可以,还没试过。之后是安装语言、中文输入法。 59 | 60 | 网络工具需要安装`net-tools`,dns相关的dig,nslookup在`extra/bind-tools`中。 61 | 62 | Qt 和 GTK 应用程序要装主题的,不然你会后悔的。主题有theme engine。 63 | 64 | shell还是zsh强大,zsh的话有个[oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)比较傻瓜化。 65 | 66 | 多线程压缩:针对gzip的pigz,针对bzip2的pbzip2,至于xz,从版本5.2开始可以开启 `-T 0` 选项,也可以直接 `export XZ_OPT="--threads=0"`。 67 | 68 | ### ArchLinux 和 Windows 10 x64 解决时间问题(可开时间同步) 69 | 70 | 首先要 **搞定Windows** 的默认设置,否则M$自动同步时间会将BIOS时钟搞乱。 71 | 72 | 在windows x64中: 73 | `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\RealTimeIsUniversal`建立一个**QWORD值**,十六进制1,设置 Asia/Shanghai 时区,或者直接导入下面的注册表脚本,存为 .reg 文件。 74 | 75 | ``` 76 | Windows Registry Editor Version 5.00 77 | 78 | [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation] 79 | "RealTimeIsUniversal"=hex(b):01,00,00,00,00,00,00,00 80 | ``` 81 | 82 | 接下来进入Arch,将bios时钟同步成UTC,首先设置好timezone,一般在装系统的时候已经设置为 Asia/Shanghai 了,接下来: 83 | 84 | 1. `pacman -S ntp`安装时钟同步工具 85 | 2. 正确设置时区,这步一般都没问题 86 | 3. 运行 `# ntpd -qg` 手动通过网络进行时间同步. 87 | 4. 运行 `# hwclock --systohc` 将当前UTC软件时间写入到硬件时钟. 88 | 89 | 重启进入Windows,这时候查看时钟应该是正常了,可以用自带的时间同步了。 90 | 91 | 上述设置完再次重启进入Arch的时候会出现时间FIX的条目,应该是修改文件系统内部日志的时间信息,我这里是EXT4,一般不用人工干预,自动处理结束之后看一下Arch的时间,一般已经正常。 92 | 93 | 这样设置可以开启windows里的时间同步功能,两个系统的时间同步操作都不会搞乱BIOS时钟。 94 | 95 | ## Ubuntu 基础配置 96 | ### 双系统引导 97 | 98 | #### 单硬盘安装 Windows 和 Linux 双系统 99 | ##### 1. 按照如下表格,设定分区,Grub 安装到 /boot 分区 100 | 101 | |分区格式|挂载点|分区大小|位置| 102 | |:------:|:-----:|:-------:|:-----| 103 | |EXT4|/|45 GiB|/dev/sdb2| 104 | |EXT3|/boot|200 MiB|/dev/sdb7| 105 | |——|swap|512 MiB|/dev/sdb8| 106 | |EXT4|/usr| 50 GiB|/dev/sdb9| 107 | |EXT4|/var| 18 GiB|/dev/sdb10| 108 | |EXT4|/home| 60 GiB|/dev/sdb11| 109 | 110 | ##### 2. 进入 Live USB 模式 111 | 112 | # dd if=/dev/sdb7 of=ubuntu.pbr bs=512 count=1 /* mbr 文件名任意,与下面一致 */ 113 | 114 | ##### 3. 进入 Win 系统,拷贝 ubuntu.pbr 到 C 根目录,然后分别执行以下内容 115 | 116 | bcdedit /enum >> c:\list.txt //导出一个名为list的文本文件,包含目前的配置 117 | bcdedit /create /d "ubuntu" /application bootsector //新建一个启动项,下文{ID}之的就是这个值 118 | bcdedit /set {ID} device partition=c: //设置MRB文件所在的分区 119 | bcdedit /set {ID} path \ubuntu.pbr //设置MRB文件所在的路径 120 | bcdedit /displayorder {ID} /addlast //添加启动项到最后 121 | bcdedit /default {ID} //设置默认启动项为ubuntu 122 | bcdedit /timeout 3 //设置时间为3s 123 | 124 | ##### 4. (可选) NTbootautofix 更改 bootmgr 为 Legacy 模式,更改超时时间 125 | 126 | 127 | #### 双硬盘安装 Windows 和 Linux 双系统 (每个盘一个系统) 128 | 129 | ##### 1. 安装类似单硬盘,正常分区,一般 / 和 /boot 分为 主分区,Grub 安装在 Linux 所在硬盘上,不在分区中 130 | 131 | ##### 2. 在 Win 下使用 EasyBCD 添加新条目-->Linux/BSD-->新版本添加一个 Grub2 的,老版本添加 Grub(Legacy),看见\NST\AutoNeoGrub0.mbr 这个项就成功了 132 | 133 | ### 上网 (PPPoE) 134 | 135 | #### 终端命令配置 136 | 137 | >你被询问是否需要'noauth'和'defaultroute'选项和去掉'nodetach',这里选择"Yes" 138 | >Use peer DNS - 选择 "Yes" 139 | >Limited MSS problem - 选择 "Yes" 140 | >当你被询问是否在需要在进入系统的时候自动连接,你可以选择"Yes" 141 | 142 | ##### 1. 打开终端配置上网 143 | 144 | # ifconfig eth0 up 145 | # pppoeconf 146 | 147 | 开始配置上网,出来的是终端界面,因为是笔记本记得还有一个让选择网卡的,选择有线猫的那个就行,之后输入宽带用户名 **删除 username** 和密码。 148 | 149 | ##### 2. 联网: 150 | 151 | # pon dsl-provider 152 | 153 | ##### 3. 断网: 154 | 155 | # poff 156 | 157 | ##### 4. 查看日志( 断网下) 158 | 159 | $ plog 160 | 161 | ##### 5. 查看接口信息( 联网下) 162 | 163 | $ ifconfig ppp0 164 | 165 | #### 测试延迟和路由追踪 166 | 167 | 在Windows中我们可以使用 `tracert`来追踪路由,不过到了Linux,就要使用这两个命令了 168 | 169 | tracepath www.baidu.com /* 这条很类似于 tracert */ 170 | mtr www.baidu.com /* 这条可以实时返回追踪路由信息和ping延时 */ 171 | traceroute www.baidu.com /* 这条也可以,可以理解为win的tracert */ 172 | 173 | #### 图形界面方法 174 | 175 | 点击任务栏右上角联网图标,“编辑连接”选择“DSL添加 176 | 用户名:你宽带的用户名 177 | 服务: 一般不变 178 | 密码:宽带用户对应的密码 179 | Ipv4设置:自动 180 | PPPoE勾上自动连接,每次开机只需要点击右上角的DSL ******(连接名称自己改一个,我的为ADSL) 连接就可以了! 181 | 182 | 183 | #### 频繁断网问题解决办法: 184 | 185 | 检查pppoe的配置文件 `# vim /etc/ppp/options`,看到其中的两条: 186 | 187 | lcp-echo-failure 4 188 | lcp-echo-interval 30 189 | 190 | 意思大概为30秒内连接4次失败就断网,把4改成20试了试。我索性改成了30,这样之后就没出现过断网事件! 191 | 192 | #### Network Manager显示设备未托管的解决办法 193 | 194 | ##### 方法一 更改相关设置 195 | 196 | 配置网络连接管理文件 197 | 198 | # gedit /etc/NetworkManager/NetworkManager.conf 199 | 200 | 打开后,找到 201 | [ifupdown] managed=false 202 | 203 | 修改成: 204 | 205 | [ifupdown] managed=true 206 | 运行 207 | # gedit /etc/network/interfaces 208 | 只保留 209 | auto lo 210 | iface lo inet loopback 211 | 212 | # cp /etc/resolv.conf /etc/resolv.conf_backup //删除dns设置 213 | # service network-manager restart //重启 network-manager服务 214 | # /etc/init.d/network-manager restart //或者这个重启服务 215 | 216 | ##### 方法二 使用新版的NetworkManager 217 | 218 | ###### 从 PPA 更新 network-manager 219 | 220 | # apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BC8EBFE8 221 | 222 | 在/etc/apt/sources.list最后加上 223 | 224 | /* 添加 PPA */ 225 | deb http://ppa.launchpad.net/network-manager/trunk/ubuntu precise main 226 | deb-src http://ppa.launchpad.net/network-manager/trunk/ubuntu precise main 227 | 228 | /* 使用 aptitude 比较安全 */ 229 | # aptitude update 230 | # aptitude safe-upgrade 231 | 232 | ### 软件源 233 | 234 | # cp /etc/apt/sources.list /etc/apt/sources.list_backup 235 | 236 | 先备份原来的文件,保留 237 | 238 | > extras.ubuntu.com 239 | > security.ubuntu.com 240 | 241 | 使用如下软件源 242 | ``` 243 | #-----------------------------bjtu-----IPv4 Only-------------------------------------# 244 | deb http://mirror.bjtu.edu.cn/ubuntu/ trusty main multiverse restricted universe 245 | deb http://mirror.bjtu.edu.cn/ubuntu/ trusty-backports main multiverse restricted universe 246 | deb http://mirror.bjtu.edu.cn/ubuntu/ trusty-proposed main multiverse restricted universe 247 | deb http://mirror.bjtu.edu.cn/ubuntu/ trusty-security main multiverse restricted universe 248 | deb http://mirror.bjtu.edu.cn/ubuntu/ trusty-updates main multiverse restricted universe 249 | deb-src http://mirror.bjtu.edu.cn/ubuntu/ trusty main multiverse restricted universe 250 | deb-src http://mirror.bjtu.edu.cn/ubuntu/ trusty-backports main multiverse restricted universe 251 | deb-src http://mirror.bjtu.edu.cn/ubuntu/ trusty-proposed main multiverse restricted universe 252 | deb-src http://mirror.bjtu.edu.cn/ubuntu/ trusty-security main multiverse restricted universe 253 | deb-src http://mirror.bjtu.edu.cn/ubuntu/ trusty-updates main multiverse restricted universe 254 | #-----------------------------aliyun------更新source必备-----------------------------# 255 | deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 256 | deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 257 | deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 258 | deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 259 | deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 260 | deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 261 | deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 262 | deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 263 | deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 264 | deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 265 | ``` 266 | 其中 163 网易的源测试起来比较好,另外,阿里云也有镜像了,速度也不错 267 | 268 | ### 包管理简介 269 | >dpkg绕过apt包管理数据库对软件包进行操作,所以你用dpkg安装过的软件包用apt可以再安装一遍,系统不知道之前安装过了,将会覆盖之前dpkg的安装。dpkg是用来安装.deb文件,但不会解决模块的依赖关系,且不会关心ubuntu的软件仓库内的软件,可以用于安装本地的deb文件。apt会解决和安装模块的依赖问题,并会咨询软件仓库, 但不会安装本地的deb文件, apt是建立在dpkg之上的软件管理工具。aptitude 是 Debian GNU/Linux 系统中, 非常神奇的的软件包管理器,基于大名鼎鼎的 APT 机制, 整合了 dselect 和 apt-get的所有功能, 并提供的更多特性,特别是在依赖关系处理上。aptitude与 apt-get 一样,是 Debian 及其衍生系统***能极其强大的包管理工具。与 apt-get 不同的是,aptitude在处理依赖问题上更佳一些。举例来说,aptitude在删除一个包时,会同时删除本身所依赖的包。这样,系统中不会残留无用的包,整个系统更为干净。 270 | 271 | ##### 安装软件包 272 | # dpkg -i package_name.deb #安装本地软件包,不解决依赖关系 273 | # apt-get install package #在线安装软件包 274 | # aptitude install pattern #同上 275 | # apt-get install package --reinstall #重新安装软件包 276 | # apitude reinstall package #同上 277 | ##### 移除软件包 278 | # dpkg -r package #删除软件包 279 | # apt-get remove package #同上 280 | # aptitude remove package #同上 281 | # dpkg -P #删除软件包及配置文件 282 | # apt-get remove package --purge #删除软件包及配置文件 283 | # apitude purge pattern #同上 284 | ##### 自动移除软件包 285 | # apt-get autoremove #删除不再需要的软件包 286 | 287 | 注:aptitude 没有,它会**自动解决**这件事 288 | ##### 清除下载的软件包 289 | # apt-get clean #清除 /var/cache/apt/archives 目录 290 | # aptitude clean #同上 291 | # apt-get autoclean #清除 /var/cache/apt/archives 目录,不过只清理过时的包 292 | # aptitude autoclean #同上 293 | ##### 编译相关 294 | # apt-get source package #获取源码 295 | # apt-get build-dep package #解决编译源码 package 的依赖关系 296 | # aptitude build-dep pattern #解决编译源码 pattern 的依赖关系 297 | ##### 平台相关 298 | # apt-cross --arch ARCH --show package 显示属于 ARCH 构架的 package 软件包信息 299 | # apt-cross --arch ARCH --get package #下载属于 ARCH 构架的 package 软件包 300 | # apt-cross --arch ARCH --install package #安装属于 ARCH 构架的 package 软件包 301 | # apt-cross --arch ARCH --remove package #移除属于 ARCH 构架的 package 软件包 302 | # apt-cross --arch ARCH --purge package #移除属于 ARCH 构架的 package 软件包 303 | # apt-cross --arch ARCH --update #升级属于 ARCH 构架的 package 软件包 304 | 305 | 注:慎重考虑要不要用这种方法来安装不同构架的软件包,这样会**破坏系统**。对于 amd64 的用户可能需要**强制安装某些 i386 的包**,千万不要把原来 amd64 本身的文件给 replace 了。最好只是安装一些 lib 到 /usr/lib32 目录下。同样地,可以用 apt-file 看某个其它构架的软件包包含哪些文件,或者是文件属于哪个包,不过记得最先要用 `apt-file --architecture ARCH update` 来升级 apt-file 的数据库,在 search 或 show 时也要**指定 ARCH**。 306 | ##### 更新源 307 | # apt-get update #更新源 308 | # aptitude update #同上 309 | ##### 更新系统 310 | # apt-get upgrade #更新已经安装的软件包 311 | # aptitude safe-upgrade #同上 312 | # apt-get dist-upgrade #升级系统 可能删除某些包,慎用! 313 | # aptitude full-upgrade #同上 314 | 315 | 316 | #### 卸载依赖关系错误的软件包 317 | 318 | ##### 1、通过deb包安装的情况: 319 | 安装.deb包: 320 | # dpkg -i package_file.deb 321 | 322 | 反安装.deb包: 323 | # dpkg -r package_name 324 | 325 | ##### 2、通过apt-get安装的情况: 326 | 安装 327 | # apt-get install package_name 328 | 329 | 反安装 330 | # apt-get remove package_name 331 | 332 | # dpkg -p package_name卸载软件包及其配置文件,但无法解决依赖关系! 333 | # aptitude purge pkgname卸载软件包及其配置文件与依赖关系包! 334 | 335 | ##### 3、清除所有已删除包的残余配置文件 336 | 337 | # dpkg -l |grep ^rc|awk '{print $2}' |# xargs dpkg -P 338 | 339 | 如果报如下错误,证明你的系统中没有残留配置文件了,无须担心。 340 | >dpkg: --purge needs at least one package name argument 341 | >Type dpkg --help for help about installing and deinstalling packages [*]; 342 | >Use dselect' or aptitude' for user-friendly package management; 343 | >Type dpkg -Dhelp for a list of dpkg debug flag values; 344 | >Type dpkg --force-help for a list of forcing options; 345 | >Type dpkg-deb --help for help about manipulating *.deb files; 346 | >Type dpkg --license for copyright license and lack of warranty (GNU GPL) [*]. 347 | >Options marked [*] produce a lot of output - pipe it through less' or more' ! 348 | 349 | 注: dpkg安裝的可以用apt卸载,反之亦可 350 | 351 | ##### 4、常用apt命令 352 | 353 | # apt-cache search # ------(package 搜索包) 354 | # apt-cache show #------(package 获取包的相关信息,如说明、大小、版本等) 355 | # apt-get install # ------(package 安装包) 356 | # apt-get install # -----(package - - reinstall 重新安装包) 357 | # apt-get -f install # -----(强制安装#"-f = --fix-missing"修复安装...) 358 | # apt-get remove #-----(package 删除包) 359 | # apt-get remove --purge # ------(package 删除包,包括删除配置文件等) 360 | # apt-get autoremove --purge # ----(package 删除包及其依赖的软件包+配置文件等(只对6.10有效,强烈推荐)) 361 | # apt-get update #------更新源 362 | # apt-get upgrade #------更新已安装的包 363 | # apt-get dist-upgrade # ---------升级系统 364 | # apt-get dselect-upgrade #------使用 dselect 升级 365 | # apt-cache depends #-------(package 了解使用依赖) 366 | # apt-cache rdepends # ------(package 了解某个具体的依赖?#当是查看该包被哪些包依赖吧...) 367 | # apt-get build-dep # ------(package 安装相关的编译环境) 368 | # apt-get source #------(package 下载该包的源代码) 369 | # apt-get clean # --------清理下载文件的存档 370 | # apt-get autoclean # --------只清理过时的包 371 | # apt-get check #-------检查是否有损坏的依赖 372 | 373 | #### 几种常见的包管理工具命令对照 374 | 375 | Debian使用的是apt和dpkg,Gentoo用的是emerge,Redhat的yum、Suse的zypper、Arch的pacman、Slackware的slackpkg 376 | 377 | 更新源: 378 | 379 | # apt-get update 380 | # emerge --sync 381 | # yum check-update 382 | # zypper refresh 383 | # pacman -Syu 384 | # slackpkg update 385 | 386 | 搜索包: 387 | 388 | # apt-cache search 389 | # emerge --search 390 | # yum search 391 | # zypper search 392 | # pacman -Qs 393 | # slackpkg search 394 | 395 | 查看包的详细信息: 396 | 397 | # apt-cache show 398 | # emerge -udpv 399 | # yum info 400 | # zypper info 401 | # pacman -Qi 402 | # -- 403 | 404 | 显示依赖关系: 405 | 406 | # apt-cache depends 407 | # emerge --emptytree --pretend 408 | # yum deplist 409 | # -- 410 | # -- 411 | # -- 412 | 413 | 安装包: 414 | 415 | # apt-get install 416 | # emerge 417 | # yum install 418 | # zypper install 419 | # pacman -S 420 | # slackpkg install 421 | 422 | 删除包: 423 | 424 | # apt-get remove 425 | # emerge --unmerge 426 | # yum erase 427 | # zypper remove 428 | # pacman -R 429 | # slackpkg remove 430 | 431 | 显示可用更新: 432 | 433 | # apt-get upgrade -> n 434 | # -- 435 | # yum list updates 436 | # zypper list-updates 437 | # -- 438 | # -- 439 | 440 | 更新全部已安装的包: 441 | 442 | # apt-get upgrade 443 | # emerge -Nua world 444 | # yum update 445 | # zypper update 446 | # pacman -Syu 447 | # slackpkg update-all 448 | 449 | 更新整个系统: 450 | 451 | # apt-get dist-upgrade 452 | # emerge -NuDa world 453 | # yum upgrade 454 | # zypper dup 455 | # -- 456 | # -- 457 | 458 | 列出已安装的包: 459 | 460 | # dpkg -l 461 | # equery l (需要安装gentoolkit) 462 | # rpm -qa 463 | # rpm -qa 464 | # pacman -Qii 465 | # ls /var/log/packages/ 466 | 467 | 删除缓存中的旧包: 468 | 469 | # apt-get clean 470 | # rm -r /usr/portage/distfiles 471 | # yum clean 472 | # -- 473 | # 手动去 /var 里面找,不过不建议删除旧包 474 | # -- 475 | 476 | 删除不需要的依赖关系: 477 | 478 | # apt-get autoremove 479 | # emerge --depclean 480 | # -- 481 | # -- 482 | # -- 483 | # -- 484 | 485 | 486 | ### apt-get 配置 487 | #### 1. 方法一:利用配置文件 488 | 489 | # touch /etc/apt/apt/apt.conf // 创建空文件之后去 doc 中有 example 490 | # gedit /etc/apt/apt.conf 491 | 492 | 添加 493 | 494 | Acquire::http::Proxy “http://yourproxyaddress:proxyport”; 495 | Acquire::https::Proxy “http://yourproxyaddress:proxyport”; 496 | Acquire::ftp::Proxy “http://yourproxyaddress:proxyport”; 497 | 498 | 之后使用命令 499 | 500 | # apt-get -c=/path/to/apt.conf update 501 | 502 | #### 2. 方法二:直接命令设置apt-get代理 503 | 504 | # apt-get -o Acquire::http::proxy="http://127.0.0.1:8087/" update 505 | 506 | #### 常用 apt-get 实例 507 | 508 | # apt-cache search packagename 搜索包 509 | # apt-cache show packagename 获取包的相关信息,如说明、大小、版本等 510 | # apt-get install packagename 安装包 511 | # apt-get install packagename --reinstall 重新安装包 512 | # apt-get -f install 修复安装 ”-f = –fix-missing” 513 | # apt-get remove packagename 删除包 514 | # apt-get remove packagename --purge 删除包,包括删除配置文件等 515 | # apt-get update 更新源 516 | # apt-get upgrade 更新已安装的包 517 | # apt-get dist-upgrade 升级系统 518 | # apt-get dselect-upgrade 使用 dselect 升级 519 | # apt-cache depends packagename 了解使用依赖 520 | # apt-cache rdepends packagename 是查看该包被哪些包依赖 521 | # apt-get build-dep packagename 安装相关的编译环境 522 | # apt-get source packagename 下载该包的源代码 523 | # apt-get clean 清理无用的包 524 | # apt-get autoclean 清理无用的包 525 | # apt-get check 检查是否有损坏的依赖 526 | # apt-get autoremove 自动移除包 527 | 528 | ### 改变桌面程序 529 | 530 | #### 从 Unity 转为 GNOME 531 | > *【首先请确保没有设置自动登录】* 532 | 533 | ##### 1. 安装GNOME 3 534 | 535 | # apt-get install gnome-shell 536 | # apt-get install gnome-tweak-tool 537 | # apt-get install gnome-themes* // 或者简单的选择 # apt-get install gnome-themes-standard 538 | /* GNOME 2 */ 539 | # apt-get install gnome-session-fallback 540 | # apt-get install gnome-panel // 或者这个 541 | 542 | ##### 2. 如果希望自动登录,这时候可以做的是: 543 | 544 | # /usr/lib/lightdm/lightdm-set-defaults -s gnome-classic //自动登入GNOME SHELL CLASSIC 545 | # /usr/lib/lightdm/lightdm-set-defaults -s gnome-shell //如果喜欢GNOME3 546 | 547 | ##### 3. 删除UNITY: 548 | 549 | /* 一般现在不卸载了,笔者测试容易出问题 */ 550 | # apt-get -y --auto-remove purge unity 551 | # apt-get -y --auto-remove purge unity-common 552 | # apt-get -y --auto-remove purge unity-lens* 553 | # apt-get -y --auto-remove purge unity-services 554 | # apt-get -y --auto-remove purge unity-asset-pool 555 | 556 | > 注意:不能用 # apt-get --auto-remove purge unity* 557 | > unity-greeter 必须保留 558 | 559 | ### 改变输入法 560 | 561 | #### 从 iBus 转为 Fcitx 562 | 563 | ##### 1. 卸载Ibus输入法 564 | 565 | # killall ibus-daemon //杀掉后台进程 566 | # apt-get purge ibus ibus-gtk ibus-gtk3 ibus-pinyin* ibus-sunpinyin ibus-table python-ibus 567 | $ rm -rf ~/.config/ibus //删除配置文件 568 | # apt-get purge indicator-keyboard //去掉键盘提示 569 | 570 | ##### 2. 安装fcitx输入法,之后重启 571 | 572 | 14.04.1 LTS 进入[搜狗输入法网页](http://pinyin.sogou.com/linux/?r=pinyin),一般下载 x64 版本即可,deb包会自动安装fcitx,如有必要可重启,一般注销重新登陆即可 573 | 574 | ### 安装显卡驱动 575 | 576 | #### 单独立显卡安装 手工安装Ubuntu nvidia驱动 577 | 578 | 579 | ##### 1. 官方下载最新的Ubuntu nvidia驱动 类似 NVIDIA-Linux-x86-173.14.12.run 580 | ##### 2. 删除原Ubuntu nvidia驱动包 581 | 582 | # apt-get –purge remove nvidia-glx nvidia-glx-new 583 | # apt-get –purge remove nvidia-settings nvidia-kernel-common 584 | 585 | ##### 3. Ubuntu nvidia安装头文件和编译环境 586 | 587 | # apt-get install linux-headers-$(uname -r) build-essential 588 | 589 | ##### 4. 禁止系统使用默认的驱动 此步骤可以两次运行 NVIDIA-Linux-x86-173.14.12.run 文件,第一次运行有提示添加屏蔽 nouveau 驱动的步骤,添加之后重启,然后再运行即可安装,每次运行之前必须关闭 X Server 590 | 591 | # gedit /etc/default/linux-restricted-modules-common // 最后的双引号中添加nv,即“”改成“nv” 592 | 593 | ##### 5. 备份当前的显示设置,预防启动X失败时恢复到原来的设置 594 | 595 | # cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup 596 | 597 | ##### 6. 接着离开桌面执行,按Ctrl+Alt+F1,登录,停止gdm (或lightdm) 598 | 599 | # /etc/init.d/gdm stop 600 | # service lightdm stop 601 | 602 | ##### 7. 开始安装 603 | 604 | $ cd /path/to/nvidia-linux-x86-1.0-9631-pkg1.run 605 | $ chmod +x nvidia-linux-x86-1.0-9631-pkg1.run 606 | # ./nvidia-linux-x86-1.0-9631-pkg1.run 607 | 608 | >进入安装界面后,首先接受协议,选“接受” 609 | >提示有旧驱动,询问是否删除旧驱动,选Yes; 610 | >提示缺少某某模块(modules),询问是否上网下载,选no; 611 | >提示编译模块,询问是否进行编译,选ok 612 | >提示将要修改xorg.conf,询问是否答应,选Yes 613 | 614 | ##### 8. 安装完成回到终端,重启GDM 615 | 616 | # /etc/init.d/gdm start 617 | # service lightdm start 618 | 619 | >此时会看到NV的logo,驱动安装成功。 620 | 621 | ##### 9. 查看显卡是否装好 622 | 623 | $ glxinfo | grep rendering 624 | 625 | >显示”direct rendering: Yes”,则已安装 626 | 627 | ##### 10. 宽屏改变分辨率 628 | 629 | # nvidia-settings 630 | 631 | >进入便可以改变分辨率。必须用root权限运行,否则配置无法保存到xorg.conf里面。 632 | 633 | ##### 11. 安装完Ubuntu nvidia驱动后,莫名奇妙的出现:打开各类窗口,发现窗口右上方的最小化、还原、关闭按钮都不见了,整个顶部标题栏都消失了,更改外观主题也没有用。以为是窗口管理器的问题,在网上找了很多方法都不行,最后发现 634 | 635 | $ metacity - -replace 636 | 637 | 就能OK。 638 | 639 | #### 笔记本双显卡安装 640 | 641 | 待定 642 | 643 | 644 | ### FireFox 配置 Adobe Flash Player Plugin 645 | 646 | #### 1. FireFox升级最新版本 647 | #### 2. 从adobe官方网站下载flash的安装包(install_flash_player_xx_linux..tar.gz) 648 | #### 3. 执行以下命令 649 | 650 | $ tar zxvf install_flash_player_xx_linux..tar.gz 651 | # cp libflashplayer.so /usr/lib/mozilla/plugins/ 652 | # ln -sf /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/firefox-addons/plugins/ 653 | # ln -sf /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/xulrunner-addons/plugins/ 654 | 655 | #### 4. 未尽事宜参照包中 README 656 | #### 5. 重启浏览器 657 | 658 | 659 | ### 科学上网工具配置 660 | 661 | **注意导入 CA 证书到浏览器中** 662 | 663 | #### Firefox 的 Autoproxy 扩展 664 | 665 | [链接](https://github.com/wongsyrone/Scripts/blob/master/autoproxy20131215.xpi) 666 | 667 | #### Goagent 668 | 669 | ##### 1. 安装基础依赖 670 | 671 | |名称|作用|是否必选| 672 | |:----:|:-----|:---:| 673 | |python2|建议安装python2.7,如需在Linux上传或安装gevent需先安装python-dev| Y| 674 | |gevent 1.0|提升多线程性能,强烈建议安装| N| 675 | |greenlet|gevent的依赖,一般安装gevent会自动安装| N| 676 | |python-vte|基于GTK的简单GUI所需| N| 677 | |python-openssl|生成证书所需,强烈建议安装,如删除了goagent自动证书则必须安装|N| 678 | |pycrypto|RC4加密所需,建议安装|N| 679 | |python-appindicator|Unity桌面下的托盘组件,其他桌面不必安装|N| 680 | 681 | # apt-get install python-dev python-greenlet python-gevent python-vte python-openssl python-crypto 682 | 683 | >如果gevent版本是0.13则需要用下面的方法安装1.0版 684 | >python-appindicator为ubuntu专有,其他系统用户不用管 685 | >python-vte 为gtk托盘窗口所需,其他发行版请自行根据对应系统安装所需软件 686 | 687 | ##### 2. 安装gevent (14.04.1 已经不需要手动安装) 688 | 689 | > 需要在安装 python-dev 之后才能正确安装 gevent 和上传server, 690 | > 安装gevent需要安装了 gcc(Linux/Unix) 或 xcode(Mac OSX). 691 | 692 | # apt-get install python-dev python-pip 693 | # pip install gevent --upgrade 694 | 695 | 也可以手动编译安装 696 | 697 | > 如果greenlet版本低于0.4.0会导致gevent装不上,请先使用以下命令安装greenlet(0.4.2) 698 | 699 | $ wget http://mirrors.aliyun.com/pypi/packages/source/g/greenlet/greenlet-0.4.2.zip && unzip greenlet-0.4.2.zip && cd greenlet-0.4.2 700 | # python setup.py install 701 | 702 | > 安装gevent(1.0) 703 | 704 | $ wget http://mirrors.aliyun.com/pypi/packages/source/g/gevent/gevent-1.0.tar.gz && tar xvzpf gevent-1.0.tar.gz && cd gevent-1.0 705 | # python setup.py install 706 | 707 | 如果不想安装gevent可以下载 gevent-1.0-py2.7-linux.egg gevent-1.0dev-macosx-intel.egg 放local文件夹 708 | 709 | ##### 3. 上传 710 | 711 | $ cd /path/to/goagent/server 712 | $ python uploader.zip 713 | 714 | ##### 4. 运行 715 | 716 | $ cd /path/to/goagent/local 717 | # python proxy.py 718 | 719 | >也可以赋予proxy.py可执行权限之后直接双击proxy.py。在proxy.py上面右击,属性的权限中勾选允许以程序执行文件 720 | >直接运行goagent-gtk.py可以使用gtk托盘方式运行goagent。 运行addto-startup.py即可加入开机启动。也可以自行添加一个启动项,命令为 721 | 722 | # python /path/to/goagent/local/goagent-gtk.py 723 | 724 | >其中路径修改为自己系统中goagent-gtk.py的路径 使用#提权之后可以自动导入证书,部分浏览器请自行手动导入证书 725 | 726 | ##### 5. 退出 727 | 728 | >如果是直接终端使用"python proxy.py"运行,在终端按"Ctrl+C"组合键可终止运行; 729 | >如果使用gtk托盘,在托盘图标上右键菜单有退出选项。直接关闭终端窗口也会退出。 730 | >如果以后台进程运行,先用"ps aux | grep proxy.py"找到goagent的PID,然后直接kill对应的PID 。 731 | 732 | ps aux|grep proxy.py|grep -v "grep"|awk '{print $2}'|xargs kill 733 | 734 | #### Wallproxy 735 | 736 | ##### 1. 基本同 Goagent 配置 737 | 738 | 附上appid列表 739 | 740 | Wallproxy: 741 | 742 | > wongloveg21|wongloveg22|wongloveg23|wongloveg24|wongloveg25|wongloveg26|wongloveg27|wongloveg28|wongloveg29|wongloveg30|wongloveg09|wongloveg10|wongloveg31|wongloveg32|wongloveg33|wongloveg34|wongloveg35|wongloveg36|wongloveg37|wongloveg38|wongloveg39|wongloveg40|wongloveg41|wongloveg42|wongloveg43|wonglovehtc|wongloveg11|wongloveg12|wongloveg13|wongloveg14|wongloveg15|wongloveg16|wongloveg17|wongloveg18|wongloveg19|wongproxy001|wongproxy002|wongproxy003|wongproxy004|wongproxy005|wongproxy006|wongproxy007|wongproxy008|wongproxy009|wongproxy010|wongproxy011|wongproxy012|wongproxy013|wongproxy014|wongproxy015|fancproxy001|fancproxy002|fancproxy003|fancproxy004|fancproxy005|fancproxy006|fancproxy007|fancproxy008|fancproxy009|fancproxy010|fancproxy011|fancproxy012|fancproxy013|fancproxy014|fancproxy015|fancproxy016|fancproxy017|fancproxy018|fancproxy019|fancproxy020|fancproxy021|fancproxy022|fancproxy023|fancproxy024|fancproxy025|maziproxy001|maziproxy002|maziproxy003|maziproxy004|maziproxy005|maziproxy006|maziproxy007|maziproxy008|maziproxy009|maziproxy010|maziproxy011|maziproxy012|maziproxy013|maziproxy014|maziproxy015|maziproxy016|maziproxy017|maziproxy018|maziproxy019|maziproxy020|maziproxy021|maziproxy022|maziproxy023|maziproxy024|maziproxy025|luckmonkey001|luckmonkey002|luckmonkey003|luckmonkey005|luckmonkey006|luckmonkey007|luckmonkey008|luckmonkey009|luckmonkey010|luckmonkey011|luckmonkey012|luckmonkey013|luckmonkey014|luckmonkey015|luckmonkey016|luckmonkey017|luckmonkey018|luckmonkey019|luckmonkey020|luckmonkey021|luckmonkey022|luckmonkey023|luckmonkey024|luckmonkey025|luckmonkey026 743 | 744 | Goagent: 745 | 746 | > qq541236405|wonglikewin8|syronelikewin8|qqlikewin8|hjjingyi|hjjingyilovewin8|qqlovewin8|syronelovewin8|wonglovewin8|huotui026|huotui027|huotui028|huotui029|huotui030|huotui031|huotui032|huotui033|huotui034|huotui035|huotui036|huotui037|huotui038|huotui039|huotui040|huotui001|huotui002|huotui003|huotui004|huotui005|huotui006|huotui007|huotui008|huotui009|huotui010|huotui011|huotui012|huotui013|huotui014|huotui015|huotui016|huotui017|huotui018|huotui019|huotui020|huotui021|huotui022|huotui023|huotui024|huotui025|wongloveg20|wongloveg01|wongloveg02|wongloveg03|wongloveg04|wongloveg05|wongloveg06|wongloveg07|wongloveg08|wongloveg44|wongloveg45|wongloveg46|wongloveg47|wongloveg48|wongloveg49|wongloveg50|wongloveg51|wongloveg52|wongloveg53|wongloveg54|wongloveg55|wongloveg56|wongloveg57|wongloveg58 747 | 748 | 749 | ##### 用户配置文件 750 | 751 | Goagent的 `proxy.user.ini` 752 | 753 | [listen] 754 | visible = 0 755 | 756 | [gae] 757 | appid = qq541236405|wonglikewin8|syronelikewin8|qqlikewin8|hjjingyi|hjjingyilovewin8|qqlovewin8|syronelovewin8|wonglovewin8|huotui026|huotui027|huotui028|huotui029|huotui030|huotui031|huotui032|huotui033|huotui034|huotui035|huotui036|huotui037|huotui038|huotui039|huotui040|huotui001|huotui002|huotui003|huotui004|huotui005|huotui006|huotui007|huotui008|huotui009|huotui010|huotui011|huotui012|huotui013|huotui014|huotui015|huotui016|huotui017|huotui018|huotui019|huotui020|huotui021|huotui022|huotui023|huotui024|huotui025|wongloveg20|wongloveg01|wongloveg02|wongloveg03|wongloveg04|wongloveg05|wongloveg06|wongloveg07|wongloveg08|wongloveg44|wongloveg45|wongloveg46|wongloveg47|wongloveg48|wongloveg49|wongloveg50|wongloveg51|wongloveg52|wongloveg53|wongloveg54|wongloveg55|wongloveg56|wongloveg57|wongloveg58 758 | password = wongsyrone 759 | 760 | [iplist] 761 | google_cn = 163.28.116.38|103.1.139.166|210.153.73.50|58.145.238.49|95.143.84.163|193.192.226.183|193.90.147.53|212.188.7.119|64.15.119.233|93.183.211.216|85.182.250.84|220.255.5.103|91.213.30.170|212.188.10.119|220.255.5.241|62.1.38.153|64.233.166.35|41.201.128.49|62.1.38.182|212.188.15.57|41.84.159.15 762 | google_hk = 163.28.116.38|103.1.139.166|210.153.73.50|58.145.238.49|95.143.84.163|193.192.226.183|193.90.147.53|212.188.7.119|64.15.119.233|93.183.211.216|85.182.250.84|220.255.5.103|91.213.30.170|212.188.10.119|220.255.5.241|62.1.38.153|64.233.166.35|41.201.128.49|62.1.38.182|212.188.15.57|41.84.159.15 763 | 764 | 765 | Wallproxy 的 `user.ini` 766 | 767 | [gae] 768 | appid = wongloveg21|wongloveg22|wongloveg23|wongloveg24|wongloveg25|wongloveg26|wongloveg27|wongloveg28|wongloveg29|wongloveg30|wongloveg09|wongloveg10|wongloveg31|wongloveg32|wongloveg33|wongloveg34|wongloveg35|wongloveg36|wongloveg37|wongloveg38|wongloveg39|wongloveg40|wongloveg41|wongloveg42|wongloveg43|wonglovehtc|wongloveg11|wongloveg12|wongloveg13|wongloveg14|wongloveg15|wongloveg16|wongloveg17|wongloveg18|wongloveg19|wongproxy001|wongproxy002|wongproxy003|wongproxy004|wongproxy005|wongproxy006|wongproxy007|wongproxy008|wongproxy009|wongproxy010|wongproxy011|wongproxy012|wongproxy013|wongproxy014|wongproxy015|fancproxy001|fancproxy002|fancproxy003|fancproxy004|fancproxy005|fancproxy006|fancproxy007|fancproxy008|fancproxy009|fancproxy010|fancproxy011|fancproxy012|fancproxy013|fancproxy014|fancproxy015|fancproxy016|fancproxy017|fancproxy018|fancproxy019|fancproxy020|fancproxy021|fancproxy022|fancproxy023|fancproxy024|fancproxy025|maziproxy001|maziproxy002|maziproxy003|maziproxy004|maziproxy005|maziproxy006|maziproxy007|maziproxy008|maziproxy009|maziproxy010|maziproxy011|maziproxy012|maziproxy013|maziproxy014|maziproxy015|maziproxy016|maziproxy017|maziproxy018|maziproxy019|maziproxy020|maziproxy021|maziproxy022|maziproxy023|maziproxy024|maziproxy025|luckmonkey001|luckmonkey002|luckmonkey003|luckmonkey005|luckmonkey006|luckmonkey007|luckmonkey008|luckmonkey009|luckmonkey010|luckmonkey011|luckmonkey012|luckmonkey013|luckmonkey014|luckmonkey015|luckmonkey016|luckmonkey017|luckmonkey018|luckmonkey019|luckmonkey020|luckmonkey021|luckmonkey022|luckmonkey023|luckmonkey024|luckmonkey025|luckmonkey026 769 | password = wongsyrone 770 | 771 | [gae] 772 | profile = google_hk 773 | 774 | [google_hk] 775 | mode = https 776 | hosts = 163.28.116.38|103.1.139.166|210.153.73.50|58.145.238.49|95.143.84.163|193.192.226.183|193.90.147.53|212.188.7.119|64.15.119.233|93.183.211.216|85.182.250.84|220.255.5.103|91.213.30.170|212.188.10.119|220.255.5.241|62.1.38.153|64.233.166.35|41.201.128.49|62.1.38.182|212.188.15.57|41.84.159.15 777 | 778 | #### 其他应用 779 | ##### 1. 设置 git 代理,仅用于网络状况很不好的情况,比如铁通 780 | /* 全局代理,包括git和apt */ 781 | export https_proxy="127.0.0.1:8087" // 设置全局变量 782 | export http_proxy="127.0.0.1:8087" 783 | git config --global http.sslVerify false // 关闭SSL证书验证 784 | /* 局部代理 */ 785 | git config --global http.proxy 127.0.0.1:8087 786 | git config --global https.proxy 127.0.0.1:8087 787 | /* 取消局部代理 */ 788 | git config --global http.proxy "" 789 | git config --global https.proxy "" 790 | 791 | 这样git clone就是走代理了,其实这个设置完以后apt-get的操作也是通过代理的了 792 | 793 | ##### 2. 设置 apt-get 代理,见上文 794 | 795 | ### Vim 编译安装 796 | 797 | #### 1. 首先清除自带的老版本 798 | 799 | # apt-get purge vim vim-common vim-runtime 800 | 801 | > 通过UBUNTU源安装的VIM不带有GDB调试功能 802 | 803 | #### 2. 安装相应库 804 | 805 | 806 | # apt-get install build-essential //安装编译工具 807 | # apt-get install xorg-dev libgtk2.0-dev libncurses5-dev //注意,选取 libncurses5-dev 而非 ncurses-dev 808 | # apt-get build-dep vim-gtk //安装编译vim-gtk的依赖包 809 | # apt-get build-dep vim //现在一般用这个安装依赖包 810 | 811 | 如果不安装ncurses开发包,make时会产生如下错误: 812 | 813 | > no terminal library found 814 | > checking for tgetent()... configure: error: NOT FOUND! 815 | > You need to install a terminal library; for example ncurses. 816 | > Or specify the name of the library with --with-tlib. 817 | 818 | /* GUI needed */ 819 | # apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev 820 | 821 | 822 | #### 3. 下载源码 823 | 824 | 首先我们需要下载VIM的源码,文件名一般为 `vim-.tar.bz2` 825 | 826 | #### 4. 源码编译 827 | 828 | 运行以下命令,解压VIM源码,准备编译过程 829 | 830 | $ cd /path/to/vim/sources 831 | $ tar jxvf vim-.tar.bz2 832 | 833 | #### 5. 开始编译并安装 834 | 835 | $ ./configure --enable-gnome-check --enable-gui=gnome2 --with-x --enable-xim --with-features=huge --enable-pythoninterp --enable-python3interp --enable-cscope --enable-fontset --enable-rubyinterp --enable-perlinterp --enable-tclinterp --enable-multibyte 836 | $ make -j4 837 | # make install 838 | 839 | #### 6. 定制VIM功能 840 | 841 | 缺省的VIM配置已经适合大多数人,但有些时候你可能需要一些额外的功能,这时就需要自己定制一下VIM。定制VIM很简单,进入vim/src目录,编辑Makefile文件。这是一个注释很好的文档,根据注释来选择: 842 | 843 | $ cd ~/vim74/src 844 | $ vim Makefile 845 | 846 | 然后修改配置 847 | 848 | -gtk2支持,也能使用gnome,打开 `--enable-gui=gkt2` 849 | 850 | -最大特性 支持,打开 `--with-features=huge` (必须打开,否则编译成功vim,运行后设置语法高亮时,产生如下错误 851 | 852 | >Vim: Caught deadly signal ABRT 853 | >Vim: Finished. 854 | >Aborted 855 | 856 | - 如果你想把perl, python, tcl, ruby等接口编译进来的话,打开相应的选项,例如,打开了--enable-tclinterp选项; 857 | - 如果你想在VIM中使用cscope的话,打开 --enable-cscope 选项; 858 | - 如果你希望在vim使用中文,使能 --enable-multibyte 和 --enable-xim选项; 859 | - 可通过--with-features=XXX选项来选择所编译的VIM特性集,缺省是 --with-features=normal; 860 | - 如果你没有root权限,可以把VIM装在自己的home目录,这时需要打开 --prefix = $(HOME) 选项;这里打开了这一项,把VIM安装在home目录下。 861 | 862 | 编辑好此文件后,就执行可以编辑安装vim了。如果你需要更细致的定制VIM,可以修改config.h文件,打开/关闭你想要的特性。 863 | 864 | 在VIM中运行下面的命令以生成帮助文件索 引: 865 | 866 | :helptags ~/.vim/doc 867 | 868 | #### 7. 简单配置VIM 869 | 870 | 编译安装的VIM,需要建立配置文件,在~目录下建立.vimrc文件,建立 .vim 文件夹,包含 plugin, colors, ftplugin 等等 871 | 872 | $ vim ~/.vimrc 873 | 874 | 编辑之后 `:wq` 保存退出 875 | 876 | #### 8. 把编译的VIM代替先前的VIM 877 | 878 | 执行如下命令,就可以把自己编译的VIM,代替以前安装的VIM,以后启动VIM时,就不需要在切换到对应目录下,直接输入VIM,就可以启动自己编译的VIM 879 | 880 | /* setup soft link file */ 881 | # ln -s 882 | # ln -s 883 | 884 | 未尽事宜参见 [vim_files repository](https://github.com/wongsyrone/vim_files) 885 | 886 | #### 9. 开启 vim 256色支持 887 | ###### 1. 先检查终端(一般为 XTerm)当前配置状态 888 | 889 | 终端运行 `echo $TERM` 如果返回 `xterm` 而非 `xterm-256color` 则不支持 256色,也可使用脚本 `terminalcolors.py` 脚本进行检验,详情参见 [Scripts repository](https://github.com/wongsyrone/Scripts) 890 | 891 | ###### 2. 添加命令 892 | 在 `~/.bashrc` 中添加 893 | 894 | if [ "$TERM" == "xterm" ]; then 895 | export TERM=xterm-256color 896 | fi 897 | 898 | 在 `~/.vimrc` 中添加 899 | 900 | set t_Co=256 901 | 902 | ###### 3.载入 256色配色方案 验证是否生效 903 | 904 | ### Wine编译安装 905 | 906 | #### 1. 先安装依赖的库 907 | 908 | # apt-get install flex bison qt4-qmake 909 | # apt-get install libfreetype6-dev 910 | # apt-get install libjpeg-dev libpng-dev libxslt-dev libxml2-dev 911 | # apt-get install libxrender-dev 912 | # apt-get install libgl1-mesa-dev 913 | # apt-get install libglu1-mesa-dev 914 | # apt-get install freeglut3-dev 915 | # apt-get install prelink 916 | # apt-get install libasound2-dev 917 | 918 | 注意: 也可使用 `install-wine-deps.sh` 脚本,仅可用于 Ubuntu 12.04 LTS以下的版本(含 12.04),详情参照 [Scripts repository](https://github.com/wongsyrone/Scripts) 919 | 920 | #### 2. 下载最新的源代码 921 | 922 | 形如 wine-.tar.bz2 923 | 924 | #### 3. 解压源码,准备编译 925 | 926 | $ tar jxvf wine-.tar.bz2 927 | $ cd wine-/ 928 | $ ./configure --enable-win64 --prefix=/path/you/want/to/install 929 | $ make 930 | # make install 931 | 932 | #### 4. 后续设置 933 | 934 | wine64 --version //检查版本 935 | /* 创建软连接 避免程序不能用 比如 winecfg*/ 936 | # ln -s /usr/local/bin/wine64 /usr/local/bin/wine 937 | 938 | ### VMware 虚拟机安装配置 939 | 940 | #### 1. 下载安装文件 941 | 942 | 一般网络连接地址 https://download3.vmware.com/software/wkst/file 943 | 到官网找文件名 直接 wget 944 | 比如 https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-10.0.2-1744117.x86_64.bundle 945 | 946 | #### 2. 安装 947 | 948 | $ chmod +x VMware-Workstation-Full-10.0.2-1744117.x86_64.bundle 949 | # ./VMware-Workstation-Full-10.0.2-1744117.x86_64.bundle 950 | 951 | #### 3. 解决 GTK 和 找不到模块文件问题 952 | 953 | 错误提示为 954 | >Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine" 955 | 956 | 因为你需要 32 位的软件包 gtk2-engines-murrine. 957 | 958 | # apt-get install --reinstall gtk2-engines-murrine:i386 // 通常这个就够了 959 | # apt-get install --reinstall gtk2-engines-murrine:amd64 960 | # apt-get install --reinstall gtk2-engines-murrine 961 | 962 | 错误提示 963 | >找不到模块文件 "*.so" 964 | 965 | # locate .so 966 | 967 | 例如 968 | >/usr/lib/x86_64-linux-gnu/gtk-2.0/modules/libcanberra-gtk-module.so 969 | >/usr/lib/x86_64-linux-gnu/gtk-3.0/modules/libcanberra-gtk-module.so 970 | 971 | 把上面的路径添加到 /etc/ld.so.conf.d/x86_64-linux-gnu.conf 中,然后 972 | 973 | # ldconfig //重新加载模块 974 | 975 | ### 清理旧内核 976 | 977 | 请**至少保留一个旧内核**,以免新内核不稳定不兼容造成问题。 978 | 979 | #### 方法一 980 | 981 | ##### 1. 查看系统内存在的内核版本列表: 982 | 983 | # dpkg --get-selections | grep linux 984 | 985 | ##### 2. 查看当前Ubuntu系统使用的内核版本 986 | 987 | $ uname -a 988 | 989 | ##### 3. 删除多余内核: 990 | 991 | **清除headers不带generic 清除image带generic** 992 | 993 | # apt-get purge linux-headers-3.0.0-12 linux-image-3.0.0-12-generic 994 | 995 | ##### 4. 更新grub: 996 | 997 | # update-grub 998 | 999 | #### 方法二 1000 | 1001 | ``` 1002 | # apt-get install aptitude 1003 | # aptitude purge ~ilinux-image-.*\(\!`uname -r`\) 1004 | ``` 1005 | 这条命令的作用:删除当前系统没有正在使用的所有内核,一般系统使用的都是最新的内核版本 1006 | 1007 | ### Java (JRE) 运行环境配置 1008 | 1009 | ##### 1. 下载 JRE amd64版本 1010 | 1011 | 文件名形如 `jre.tar.gz` 1012 | 1013 | ##### 2. 直接解压 JRE 文件到目录中 1014 | 1015 | $ cd /usr/local 1016 | # mkdir java 1017 | $ cd java 1018 | # tar zxvf jre.tar.gz 1019 | 1020 | ##### 3. 编辑环境变量 1021 | `# vim /etc/envirionment`修改为 1022 | ``` 1023 | PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/wong/wine1.7/bin:/usr/local/java/jre1.7.0_55/bin" 1024 | CLASSPATH=".:/usr/local/java/jre1.7.0_55/lib" 1025 | JAVA_HOME="/usr/local/java/jre1.7.0_55" 1026 | ``` 1027 | **注意保留系统自带变量** 1028 | 1029 | ##### 4. 给 Firefox添加 Java支持 1030 | 1031 | $ cd /usr/lib/mozilla/plugins 1032 | # ln -s /usr/local/java/jre/lib/amd64/libnpjp2.so 1033 | 1034 | ### Linux 下的 NTFS 内核模块 ( Paragon ) 1035 | 1036 | 一般来说,有两种情况,一种是自带的,老式使用 `ntfs-3g` 有的时候会比较慢,像 Ubuntu 12.04 LTS 已经在内核支持 NTFS 的挂载和读写了,但是效能可能不是那么令人满意。第二种是专门专注于这方面的公司,比如 `Paragon` , 它在 Android 下的工具比较好用,不过在 Linux 下提供的免费版本 `Express` 不支持 DKMS 这个动态内核模块的框架,一旦升级内核之后,还要重新编译,如果购买 `Professional` 版本,还要花费 $39.95 , 对于笔者这样的来说,是一笔巨大的开支,后来研究官方脚本和[GitHub上的脚本](https://github.com/bySabi/paragon-dkms)之后,自己修改了一个可用的Shell脚本,详情参见 [Paragon-DKMS repository](https://github.com/wongsyrone/Paragon-DKMS) 1037 | -------------------------------------------------------------------------------- /02.md: -------------------------------------------------------------------------------- 1 | # Ubuntu 基本开发环境搭建 2 | 3 | ## 一. 安装C/C++程序的开发环境 4 | 5 | 1. sudo apt-get install build-essential //安装主要编译工具 包括gcc, g++, make 6 | 2. sudo apt-get install autoconf automake //安装时apt-get 推荐用 automake 代替 automake1.9 7 | 3. sudo apt-get install flex bison //flex 经常和自由软件 Bison 语法分析器生成器一起使用 8 | 4. sudo apt-get install manpages-dev //安装C语言函数man文档 9 | 5. sudo apt-get install binutils-doc cpp-doc gcc-doc glibc-doc stl-manual //安装相关文档 10 | 11 | ## 二. 安装Gnome桌面程序的开发环境 12 | 13 | 1. sudo apt-get install gnome-core-devel //安装核心文件 14 | 2. sudo apt-get install pkg-config 15 | 3. sudo apt-get install devhelp //安装GTK文档查看程序 16 | 4. sudo apt-get install libglib2.0-doc libgtk2.0-doc //安装 API参考手册及其它帮助文档 17 | 5. sudo apt-get instal glade libglade2-dev //安装GTK界面构造程序 18 | 19 | ## 三. 安装JAVA开发环境 20 | 21 | 1. sudo apt-get install sun-java6-jdk sun-java6-doc sun-java6-source //安装核心开发用具,相关文档 22 | 2. sudo update-alternatives --config java //通常给出两个或多个JRE选择路径 选择:/usr/lib/jvm/java-1.5.0-sun/jre/bin/java作为你的JAVA运行环境 23 | 3. sudo vim /etc/environment //配置环境变量,添加如下两行: 24 | CLASSPATH=/usr/lib/jvm/java-6-sun/lib 25 | JAVA_HOME=/usr/lib/jvm/java-6-sun 26 | 4. sudo apt-get install eclipse //安装eclipse 27 | 5. sudo update-java-alternatives -s java-6-sun //SUN版本的JAVA 设置为系统默认 JDK 28 | 6. sudo vim /etc/jvm //编辑 JVM 配置文件, 将文件中的/usr/lib/jvm/java-6-sun放到配 置文件的顶部 29 | 7. sudo vim /etc/eclipse/java_home //操作如上 30 | -------------------------------------------------------------------------------- /03.md: -------------------------------------------------------------------------------- 1 | # 从源码编译的一般方法 2 | 3 | 4 | 1. autoscan 产生 configure.in 5 | 2. aclocal 6 | 3. autoconf 7 | 4. (可选)autoheader 8 | 5. automake --add-missing 9 | 6. ./configure --help 可显示帮助,调整compile switch 10 | 7. make 可添加 -j CORE_NUMBER 来加快速度 11 | 8. make check 检测编译结果是否符合要求,有的 Makefile 可能不存在这个功能 12 | 9. sudo make install 如果要安装到全局 就添加超级权限,安装到本用户可以加 --prefix=/path/you/want/to/install 13 | 14 | --- 15 | 16 | 一般安装不需要全部步骤,首先参考 `INSTALL` 或者 `README` 这类的文件,一般都有安装提示,或者去直接查看 `Makefile` 寻找一些开关。或者找一下网络上的教程。 17 | 18 | 19 | -------------------------------------------------------------------------------- /04.md: -------------------------------------------------------------------------------- 1 | # dd 使用 2 | 3 | ## 使用 dd 拷贝数据,从小分区到大分区 4 | 因为`dd` 是 `扇区对扇区` 的命令,也就是 **原样无脑复制** 5 | 6 | sudo dd if= of= 7 | sudo e2fsck -f 8 | sudo resize2fs 9 | 10 | 然后查看分区状态,应该由 `dirty` 变成 `clean`了 11 | 12 | ## 用于复制文件系统的命令 13 | 14 | 当需要复制或移动各个文件、文件系统的某些部分或完整的文件系统时,可以使用下面的工具。 15 | 16 | 下表是几个备份命令。 17 | 18 | |命令名称|是否可识别文件系统边界?|是否支持多卷备份?|物理复制还是逻辑复制?| 19 | |:------:|:-----:|:-------:|:-----:| 20 | |tar|否|否|逻辑| 21 | |cpio|否|是 |逻辑| 22 | |dd|是|否|物理| 23 | 24 | 下表介绍了其中某些命令的优点和缺点。 25 | 26 | |命令|功能|优点|缺点| 27 | |:------:|:-----|:-------|:-----| 28 | |tar|用于将文件和目录子树复制到单个磁盘。|可以在大多数 UNIX 操作系统中使用,可以轻松访问公共域版本|无法识别文件系统边界;全路径名的长度不能超过 255 个字符| 29 | |cpio|用于复制需要多个磁盘的文件、特殊文件或文件系统|与使用 tar 命令相比,可以更有效地将数据打包到磁盘;恢复时可跳过磁盘中的任何坏点;提供以不同的头格式编写文件的选项(如 tar、ustar、crc、odc、bar),以实现不同系统类型之间的可移植性|该命令语法比 tar 或 pax 命令更难。| 30 | 31 | 32 | ## 附:跨文件系统复制 33 | 34 | 很多时候,需要跨越不同的文件系统复制,甚至 ext3 到 ext4 的复制使用 dd 工具都不太合适,毕竟物理结构不完全一样,直接复制会产生后果。而使用 `cp -R` 的复制其实会影响到时间相关的属性以及符号链接的问题,我们可以使用`find`和`cpio`结合的方法。 35 | 36 | 1. 切换 root 用户或使用 sudo 37 | 2. 切换到要复制的目录 38 | 3. 使用下面的命令 39 | 40 | ``` 41 | find . -print -depth | cpio -pdum /target/path 42 | ``` 43 | 其中: 44 | 45 | `.` 从当前工作目录开始。 46 | 47 | `-print` 列出文件名。 48 | 49 | `-depth` 向下派生目录分层结构并从下到上列出文件名。 50 | 51 | `-p` 创建文件列表。 52 | 53 | `-d` 根据需要创建目录。 54 | 55 | `-m` 在目录中设置正确的修改时间。 56 | 57 | 可能还要指定 `-u `选项。此选项将强制执行无条件复制。否则,旧文件不会替换新文件。在需要目录的精确副本且复制的某些文件可能已存在于目标目录中时,此选项可能非常有用。 58 | 59 | 复制的过程中不会有提示,复制结束之后会显示复制的 block 数. 60 | 61 | ## 修复长久未用磁盘问题 62 | 63 | 长久不使用的硬盘会引起读写迟滞的问题,如果发现,可以使用如下命令 64 | 65 | sudo dd if= of= 66 | 67 | 也就是将自己的东西复制出来再写回自己的文件中,这样重新布置磁场,原来的读写迟滞就能缓解了。 68 | 69 | ## 使用 信号 来显示 dd 进度 70 | 71 | linux下显示dd命令的进度: 72 | 73 | dd if=/dev/zero of=/tmp/zero.img bs=10M count=100000 74 | 75 | 想要查看上面的dd命令的执行进度,可以使用下面几种方法: 76 | 比如:每5秒输出dd的进度 77 | 方法一: 78 | 79 | watch -n 5 pkill -USR1 ^dd$ 80 | 81 | 方法二: 82 | 83 | watch -n 5 killall -USR1 dd 84 | 85 | 方法三: 86 | 87 | while killall -USR1 dd; do sleep 5; done 88 | 89 | 方法四: 90 | 91 | while (ps auxww |grep " dd " |grep -v grep |awk '{print $2}' |while read pid; do kill -USR1 $pid; done) ; do sleep 5; done 92 | 93 | 上述四种方法中使用三个命令:`pkill、killall、kill`向 dd 发送`SIGUSR1`信息,dd命令进程接收到信号之后就打印出自己当前的进度。 94 | 95 | PS: 发送信号使daemon重新载入configure file 96 | 97 | kill -HUP $pid 98 | 99 | ## dd 备份的替代方式 100 | 101 | rsync -av // have an installed Linux instead Live CD 102 | 103 | 或者寻找 `g4l` (ghostforlinux) -------------------------------------------------------------------------------- /05.md: -------------------------------------------------------------------------------- 1 | # DNS相关工具配置,包括 DNSCrypt-proxy 和 DNSmasq 2 | ##### 在 Ubuntu 12.04 LTS 测试,为了尝鲜最新版本,这里采用编译安装方式,同时禁用 Ubuntu 自带的 DNSmasq 3 | 4 | ## IPtables 开机应用 5 | 6 | **没必要更新 GFW 污染IP了,目前使用了全新的动态污染,基本上一天换一批污染ip,这个方法已经没有什么作用了。** 7 | 8 | PS:对于白名单的使用可以参考[我这个私人配置](https://github.com/wongsyrone/OpenWrt/blob/master/freerouter-whitelist/README.md),这个方法的性能主要依赖于VPN,所以暂时不准备写在这个repo里面了,如果有想看的注意区分一下配置文件。 9 | 10 | #### IPtables u32模块 防污染 ~~(需要定期更新GFW IP)~~ 11 | ```sh 12 | iptables -I INPUT -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0x01010101,0xffffffff,0x4a7d7f66,0x4a7d9b66,0x4a7d2766,0x4a7d2771,0xd155e58a,0x042442b2,0x0807c62d,0x253d369e" -j DROP 13 | iptables -I INPUT -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0x2e52ae44,0x3b1803ad,0x402158a1,0x4021632f,0x4042a3fb,0x4168cafc,0x41a0db71,0x422dfced,0x480ecd68,0x480ecd63" -j DROP 14 | iptables -I INPUT -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0x4e10310f,0x5d2e0859,0x80797e8b,0x9f6a794b,0xa9840d67,0xc043c606,0xca6a0102,0xcab50755,0xcba1e6ab,0xcb620741" -j DROP 15 | iptables -I INPUT -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0xcf0c5862,0xd0381f2b,0xd1913632,0xd1dc1eae,0xd1244921,0xd35e4293,0xd5a9fb23,0xd8ddbcb6,0xd8eab30d,0xf3b9bb03" -j DROP 16 | iptables -I INPUT -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0xf3b9bb27,0x1759053c,0x31027b38,0x364c8701,0x4d04075c,0x76053106,0xbc050460,0xbda31105,0xc504040c,0xfd9d0ea5" -j DROP 17 | iptables -I INPUT -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0xf9812e30" -j DROP 18 | iptables -I FORWARD -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0x01010101,0xffffffff,0x4a7d7f66,0x4a7d9b66,0x4a7d2766,0x4a7d2771,0xd155e58a,0x042442b2,0x0807c62d,0x253d369e" -j DROP 19 | iptables -I FORWARD -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0x2e52ae44,0x3b1803ad,0x402158a1,0x4021632f,0x4042a3fb,0x4168cafc,0x41a0db71,0x422dfced,0x480ecd68,0x480ecd63" -j DROP 20 | iptables -I FORWARD -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0x4e10310f,0x5d2e0859,0x80797e8b,0x9f6a794b,0xa9840d67,0xc043c606,0xca6a0102,0xcab50755,0xcba1e6ab,0xcb620741" -j DROP 21 | iptables -I FORWARD -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0xcf0c5862,0xd0381f2b,0xd1913632,0xd1dc1eae,0xd1244921,0xd35e4293,0xd5a9fb23,0xd8ddbcb6,0xd8eab30d,0xf3b9bb03" -j DROP 22 | iptables -I FORWARD -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0xf3b9bb27,0x1759053c,0x31027b38,0x364c8701,0x4d04075c,0x76053106,0xbc050460,0xbda31105,0xc504040c,0xfd9d0ea5" -j DROP 23 | iptables -I FORWARD -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0xf9812e30" -j DROP 24 | ``` 25 | 26 | #### IPtables string模块 防污染 ~~(需要定期更新GFW IP)~~ 27 | 28 | 这个模块的缺点是相对来说CPU消耗比 u32 要高,以前的linux系统中默认都不会包含这个 mod.相对 u32 模块只能精确匹配 4 个字节的弱势(这也是 u32 节约资源的重要原因,因为指定位置后不存在搜索的运算),string模块提供了字符串搜索能力,只要返回的数据里有特定的字符就可以识别出来,这样就不用担心不同类型的DNS服务器返回的数据格式不同了。 29 | ```sh 30 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01010101|" --from 60 --to 180 -j DROP 31 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01014333|" --from 60 --to 180 -j DROP 32 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01017F2D|" --from 60 --to 180 -j DROP 33 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01020304|" --from 60 --to 180 -j DROP 34 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0121AA44|" --from 60 --to 180 -j DROP 35 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0121BC3E|" --from 60 --to 180 -j DROP 36 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0121BE46|" --from 60 --to 180 -j DROP 37 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0121BEE4|" --from 60 --to 180 -j DROP 38 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0121BF3A|" --from 60 --to 180 -j DROP 39 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01D1D0C8|" --from 60 --to 180 -j DROP 40 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01E25393|" --from 60 --to 180 -j DROP 41 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01EA045B|" --from 60 --to 180 -j DROP 42 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01EA1553|" --from 60 --to 180 -j DROP 43 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01EA1D28|" --from 60 --to 180 -j DROP 44 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01EA270E|" --from 60 --to 180 -j DROP 45 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01EA4650|" --from 60 --to 180 -j DROP 46 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01EA5368|" --from 60 --to 180 -j DROP 47 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|01F473AC|" --from 60 --to 180 -j DROP 48 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|02010102|" --from 60 --to 180 -j DROP 49 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|02BBFD79|" --from 60 --to 180 -j DROP 50 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|02E47B07|" --from 60 --to 180 -j DROP 51 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|02E49A08|" --from 60 --to 180 -j DROP 52 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|04118F83|" --from 60 --to 180 -j DROP 53 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|04154609|" --from 60 --to 180 -j DROP 54 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|041E0DA8|" --from 60 --to 180 -j DROP 55 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|041EBB09|" --from 60 --to 180 -j DROP 56 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|041EEBE5|" --from 60 --to 180 -j DROP 57 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|041F8B92|" --from 60 --to 180 -j DROP 58 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0422B4B2|" --from 60 --to 180 -j DROP 59 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|04236414|" --from 60 --to 180 -j DROP 60 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0423EAC8|" --from 60 --to 180 -j DROP 61 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|042442B2|" --from 60 --to 180 -j DROP 62 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|043511D7|" --from 60 --to 180 -j DROP 63 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|043B4FCE|" --from 60 --to 180 -j DROP 64 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|044EA7C4|" --from 60 --to 180 -j DROP 65 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|044F817A|" --from 60 --to 180 -j DROP 66 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|04C15000|" --from 60 --to 180 -j DROP 67 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0509051A|" --from 60 --to 180 -j DROP 68 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|05094169|" --from 60 --to 180 -j DROP 69 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0509766F|" --from 60 --to 180 -j DROP 70 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0509788C|" --from 60 --to 180 -j DROP 71 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|050988D2|" --from 60 --to 180 -j DROP 72 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0509F2E8|" --from 60 --to 180 -j DROP 73 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|050A44BB|" --from 60 --to 180 -j DROP 74 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|050A44BC|" --from 60 --to 180 -j DROP 75 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|050A451D|" --from 60 --to 180 -j DROP 76 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|050A4D48|" --from 60 --to 180 -j DROP 77 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|050A6929|" --from 60 --to 180 -j DROP 78 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0523FB6C|" --from 60 --to 180 -j DROP 79 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|05649818|" --from 60 --to 180 -j DROP 80 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0564E1CC|" --from 60 --to 180 -j DROP 81 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0564E4CE|" --from 60 --to 180 -j DROP 82 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0564E71B|" --from 60 --to 180 -j DROP 83 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0564F8D0|" --from 60 --to 180 -j DROP 84 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|05908114|" --from 60 --to 180 -j DROP 85 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0807C62D|" --from 60 --to 180 -j DROP 86 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0822A196|" --from 60 --to 180 -j DROP 87 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|08695400|" --from 60 --to 180 -j DROP 88 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0A0A0A0A|" --from 60 --to 180 -j DROP 89 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0C578500|" --from 60 --to 180 -j DROP 90 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|0E66F912|" --from 60 --to 180 -j DROP 91 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|103F9B00|" --from 60 --to 180 -j DROP 92 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|14141414|" --from 60 --to 180 -j DROP 93 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|148B3800|" --from 60 --to 180 -j DROP 94 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|17170EC0|" --from 60 --to 180 -j DROP 95 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|1759053C|" --from 60 --to 180 -j DROP 96 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|1833B800|" --from 60 --to 180 -j DROP 97 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|1C0DD800|" --from 60 --to 180 -j DROP 98 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|1C797E8B|" --from 60 --to 180 -j DROP 99 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|1F16043C|" --from 60 --to 180 -j DROP 100 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|1F19BF86|" --from 60 --to 180 -j DROP 101 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|1FA95A04|" --from 60 --to 180 -j DROP 102 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|1FAA0808|" --from 60 --to 180 -j DROP 103 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|1FD29CD4|" --from 60 --to 180 -j DROP 104 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|1FDEB9CA|" --from 60 --to 180 -j DROP 105 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|22FEF797|" --from 60 --to 180 -j DROP 106 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2501CD15|" --from 60 --to 180 -j DROP 107 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2501CF81|" --from 60 --to 180 -j DROP 108 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|253A4E4F|" --from 60 --to 180 -j DROP 109 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|253B195F|" --from 60 --to 180 -j DROP 110 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|253D369E|" --from 60 --to 180 -j DROP 111 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2563C294|" --from 60 --to 180 -j DROP 112 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|258CEE23|" --from 60 --to 180 -j DROP 113 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|25BB8696|" --from 60 --to 180 -j DROP 114 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|25BB9581|" --from 60 --to 180 -j DROP 115 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|25BBFB23|" --from 60 --to 180 -j DROP 116 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|25FC7AB8|" --from 60 --to 180 -j DROP 117 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|267562E7|" --from 60 --to 180 -j DROP 118 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|294F1409|" --from 60 --to 180 -j DROP 119 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2BFDC70C|" --from 60 --to 180 -j DROP 120 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2E140D64|" --from 60 --to 180 -j DROP 121 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2E147EFC|" --from 60 --to 180 -j DROP 122 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2E1ED4C6|" --from 60 --to 180 -j DROP 123 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2E2618D1|" --from 60 --to 180 -j DROP 124 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2E52AE44|" --from 60 --to 180 -j DROP 125 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2E89DB07|" --from 60 --to 180 -j DROP 126 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2EA5E790|" --from 60 --to 180 -j DROP 127 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2EE5AF5F|" --from 60 --to 180 -j DROP 128 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|2EF306AA|" --from 60 --to 180 -j DROP 129 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|31027B38|" --from 60 --to 180 -j DROP 130 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|31D49980|" --from 60 --to 180 -j DROP 131 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3212B7E9|" --from 60 --to 180 -j DROP 132 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|32390B0C|" --from 60 --to 180 -j DROP 133 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|323FCA0D|" --from 60 --to 180 -j DROP 134 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3257948C|" --from 60 --to 180 -j DROP 135 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3257A94D|" --from 60 --to 180 -j DROP 136 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|325DCF65|" --from 60 --to 180 -j DROP 137 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3261865B|" --from 60 --to 180 -j DROP 138 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|327406A2|" --from 60 --to 180 -j DROP 139 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3644A682|" --from 60 --to 180 -j DROP 140 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|364C8701|" --from 60 --to 180 -j DROP 141 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|365333BF|" --from 60 --to 180 -j DROP 142 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36561540|" --from 60 --to 180 -j DROP 143 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3656DFCA|" --from 60 --to 180 -j DROP 144 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3658FC5B|" --from 60 --to 180 -j DROP 145 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36AE28B6|" --from 60 --to 180 -j DROP 146 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36BB2726|" --from 60 --to 180 -j DROP 147 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36BB881E|" --from 60 --to 180 -j DROP 148 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36BFC18A|" --from 60 --to 180 -j DROP 149 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36C80320|" --from 60 --to 180 -j DROP 150 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36CE627F|" --from 60 --to 180 -j DROP 151 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36D157BA|" --from 60 --to 180 -j DROP 152 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36D1EE1C|" --from 60 --to 180 -j DROP 153 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36DA26C6|" --from 60 --to 180 -j DROP 154 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36E593B7|" --from 60 --to 180 -j DROP 155 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36EBC79A|" --from 60 --to 180 -j DROP 156 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36F4164D|" --from 60 --to 180 -j DROP 157 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36F6A920|" --from 60 --to 180 -j DROP 158 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|36F6CAFA|" --from 60 --to 180 -j DROP 159 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3B1803AD|" --from 60 --to 180 -j DROP 160 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3B7C4A1C|" --from 60 --to 180 -j DROP 161 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3D361C06|" --from 60 --to 180 -j DROP 162 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3E4BDD1F|" --from 60 --to 180 -j DROP 163 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3E5C11D5|" --from 60 --to 180 -j DROP 164 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|3E8A7323|" --from 60 --to 180 -j DROP 165 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|400E4829|" --from 60 --to 180 -j DROP 166 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|40166E22|" --from 60 --to 180 -j DROP 167 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|402158A1|" --from 60 --to 180 -j DROP 168 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4021632F|" --from 60 --to 180 -j DROP 169 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4022A18E|" --from 60 --to 180 -j DROP 170 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4032B385|" --from 60 --to 180 -j DROP 171 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4042A3FB|" --from 60 --to 180 -j DROP 172 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|404F45FA|" --from 60 --to 180 -j DROP 173 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|404F548D|" --from 60 --to 180 -j DROP 174 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|405BFE61|" --from 60 --to 180 -j DROP 175 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4096B862|" --from 60 --to 180 -j DROP 176 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4168CAFC|" --from 60 --to 180 -j DROP 177 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|41A0DB71|" --from 60 --to 180 -j DROP 178 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|41B7278B|" --from 60 --to 180 -j DROP 179 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|42273DA1|" --from 60 --to 180 -j DROP 180 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|422DFCED|" --from 60 --to 180 -j DROP 181 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|42379794|" --from 60 --to 180 -j DROP 182 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|425586BA|" --from 60 --to 180 -j DROP 183 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|426093A0|" --from 60 --to 180 -j DROP 184 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|429202F1|" --from 60 --to 180 -j DROP 185 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|42BBCC32|" --from 60 --to 180 -j DROP 186 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|42CE0BC2|" --from 60 --to 180 -j DROP 187 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4389E30B|" --from 60 --to 180 -j DROP 188 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|43E1DCF8|" --from 60 --to 180 -j DROP 189 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|44473A12|" --from 60 --to 180 -j DROP 190 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4510C471|" --from 60 --to 180 -j DROP 191 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|451E170A|" --from 60 --to 180 -j DROP 192 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4532C0DA|" --from 60 --to 180 -j DROP 193 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|453D3C7A|" --from 60 --to 180 -j DROP 194 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|45A7ACA2|" --from 60 --to 180 -j DROP 195 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|45AB0D31|" --from 60 --to 180 -j DROP 196 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|45AEF4DD|" --from 60 --to 180 -j DROP 197 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|45AF4BCA|" --from 60 --to 180 -j DROP 198 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|45C37C5A|" --from 60 --to 180 -j DROP 199 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|462AF321|" --from 60 --to 180 -j DROP 200 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4805016D|" --from 60 --to 180 -j DROP 201 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|480ECD63|" --from 60 --to 180 -j DROP 202 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|480ECD68|" --from 60 --to 180 -j DROP 203 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|48146E32|" --from 60 --to 180 -j DROP 204 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|481D5EF0|" --from 60 --to 180 -j DROP 205 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|482004F3|" --from 60 --to 180 -j DROP 206 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|482FE44F|" --from 60 --to 180 -j DROP 207 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4834F438|" --from 60 --to 180 -j DROP 208 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|48A7200A|" --from 60 --to 180 -j DROP 209 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4A52A6A6|" --from 60 --to 180 -j DROP 210 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4A75398A|" --from 60 --to 180 -j DROP 211 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4A75757A|" --from 60 --to 180 -j DROP 212 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4A7CC349|" --from 60 --to 180 -j DROP 213 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4A7D1F71|" --from 60 --to 180 -j DROP 214 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4A7D2766|" --from 60 --to 180 -j DROP 215 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4A7D2771|" --from 60 --to 180 -j DROP 216 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4A7D7F66|" --from 60 --to 180 -j DROP 217 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4A7D822F|" --from 60 --to 180 -j DROP 218 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4A7D9B66|" --from 60 --to 180 -j DROP 219 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4A7DCC79|" --from 60 --to 180 -j DROP 220 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4ACFECAE|" --from 60 --to 180 -j DROP 221 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4AD07DB8|" --from 60 --to 180 -j DROP 222 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4ADCD743|" --from 60 --to 180 -j DROP 223 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4B62AFA6|" --from 60 --to 180 -j DROP 224 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4CA4D974|" --from 60 --to 180 -j DROP 225 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4D04075C|" --from 60 --to 180 -j DROP 226 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4E10310F|" --from 60 --to 180 -j DROP 227 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4E188763|" --from 60 --to 180 -j DROP 228 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4E6CB21A|" --from 60 --to 180 -j DROP 229 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4E8CAC21|" --from 60 --to 180 -j DROP 230 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4F62223C|" --from 60 --to 180 -j DROP 231 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4F7F7F44|" --from 60 --to 180 -j DROP 232 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|4F887D31|" --from 60 --to 180 -j DROP 233 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5046B876|" --from 60 --to 180 -j DROP 234 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|50482992|" --from 60 --to 180 -j DROP 235 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|505275D1|" --from 60 --to 180 -j DROP 236 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5052C99A|" --from 60 --to 180 -j DROP 237 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|505C7584|" --from 60 --to 180 -j DROP 238 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|50BE601A|" --from 60 --to 180 -j DROP 239 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|50F15CB4|" --from 60 --to 180 -j DROP 240 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|50F1D113|" --from 60 --to 180 -j DROP 241 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|50F5AB46|" --from 60 --to 180 -j DROP 242 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|52912F75|" --from 60 --to 180 -j DROP 243 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|537D767A|" --from 60 --to 180 -j DROP 244 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|53DE05AB|" --from 60 --to 180 -j DROP 245 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|53DE7CBB|" --from 60 --to 180 -j DROP 246 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|547C3BA5|" --from 60 --to 180 -j DROP 247 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5519AB67|" --from 60 --to 180 -j DROP 248 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|555C86E5|" --from 60 --to 180 -j DROP 249 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|556F128A|" --from 60 --to 180 -j DROP 250 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|55BE006E|" --from 60 --to 180 -j DROP 251 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|576A39D1|" --from 60 --to 180 -j DROP 252 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|57E62E32|" --from 60 --to 180 -j DROP 253 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|58C64565|" --from 60 --to 180 -j DROP 254 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|58D6C343|" --from 60 --to 180 -j DROP 255 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|591E7DCC|" --from 60 --to 180 -j DROP 256 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|591F376A|" --from 60 --to 180 -j DROP 257 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|596C7681|" --from 60 --to 180 -j DROP 258 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|596FB54A|" --from 60 --to 180 -j DROP 259 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|59BA5F0B|" --from 60 --to 180 -j DROP 260 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5A9CC92A|" --from 60 --to 180 -j DROP 261 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5B79F59A|" --from 60 --to 180 -j DROP 262 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5BBA1C29|" --from 60 --to 180 -j DROP 263 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5BC6812F|" --from 60 --to 180 -j DROP 264 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5BD94916|" --from 60 --to 180 -j DROP 265 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5BDD2523|" --from 60 --to 180 -j DROP 266 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5BDFAF19|" --from 60 --to 180 -j DROP 267 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5BEE1E36|" --from 60 --to 180 -j DROP 268 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5BEFC910|" --from 60 --to 180 -j DROP 269 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5C356009|" --from 60 --to 180 -j DROP 270 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5C356AAF|" --from 60 --to 180 -j DROP 271 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5C3F6EAE|" --from 60 --to 180 -j DROP 272 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5D2E0859|" --from 60 --to 180 -j DROP 273 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5D5DBB31|" --from 60 --to 180 -j DROP 274 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5D73F094|" --from 60 --to 180 -j DROP 275 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5D9E7948|" --from 60 --to 180 -j DROP 276 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5DBBCD02|" --from 60 --to 180 -j DROP 277 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5E17938E|" --from 60 --to 180 -j DROP 278 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5E179C0B|" --from 60 --to 180 -j DROP 279 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5E17C1E0|" --from 60 --to 180 -j DROP 280 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5E17C790|" --from 60 --to 180 -j DROP 281 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5E88BC1E|" --from 60 --to 180 -j DROP 282 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5E8D1F8C|" --from 60 --to 180 -j DROP 283 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5F5516A3|" --from 60 --to 180 -j DROP 284 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5FA35F2F|" --from 60 --to 180 -j DROP 285 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5FD33A61|" --from 60 --to 180 -j DROP 286 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5FD39646|" --from 60 --to 180 -j DROP 287 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|5FD3E59C|" --from 60 --to 180 -j DROP 288 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|601E3394|" --from 60 --to 180 -j DROP 289 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|607E610F|" --from 60 --to 180 -j DROP 290 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|607FACDD|" --from 60 --to 180 -j DROP 291 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|614A5016|" --from 60 --to 180 -j DROP 292 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6281E5CA|" --from 60 --to 180 -j DROP 293 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|629E989F|" --from 60 --to 180 -j DROP 294 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|629EB28D|" --from 60 --to 180 -j DROP 295 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|681C0116|" --from 60 --to 180 -j DROP 296 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|681C0E70|" --from 60 --to 180 -j DROP 297 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|681C140E|" --from 60 --to 180 -j DROP 298 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|681C1E3B|" --from 60 --to 180 -j DROP 299 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|68C81FE2|" --from 60 --to 180 -j DROP 300 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6ABA789D|" --from 60 --to 180 -j DROP 301 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6ABB2750|" --from 60 --to 180 -j DROP 302 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6B062265|" --from 60 --to 180 -j DROP 303 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6C3DFADA|" --from 60 --to 180 -j DROP 304 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6CA8D7E6|" --from 60 --to 180 -j DROP 305 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6CA8FA03|" --from 60 --to 180 -j DROP 306 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6CB3C44D|" --from 60 --to 180 -j DROP 307 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6CB3FA6A|" --from 60 --to 180 -j DROP 308 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6D475182|" --from 60 --to 180 -j DROP 309 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6D7B73CD|" --from 60 --to 180 -j DROP 310 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6DCEADD4|" --from 60 --to 180 -j DROP 311 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6DEA9F26|" --from 60 --to 180 -j DROP 312 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6E4AA328|" --from 60 --to 180 -j DROP 313 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|6EAD9A8E|" --from 60 --to 180 -j DROP 314 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|70AF3C1F|" --from 60 --to 180 -j DROP 315 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|710BC2BE|" --from 60 --to 180 -j DROP 316 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|71A0665A|" --from 60 --to 180 -j DROP 317 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|76053106|" --from 60 --to 180 -j DROP 318 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|769111B8|" --from 60 --to 180 -j DROP 319 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|76DBFDF5|" --from 60 --to 180 -j DROP 320 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|77095E53|" --from 60 --to 180 -j DROP 321 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|77123E82|" --from 60 --to 180 -j DROP 322 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|77EB3952|" --from 60 --to 180 -j DROP 323 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|77F5D99B|" --from 60 --to 180 -j DROP 324 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|78595DF8|" --from 60 --to 180 -j DROP 325 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|7AD602AB|" --from 60 --to 180 -j DROP 326 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|7ADA65BE|" --from 60 --to 180 -j DROP 327 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|7B1EAF1D|" --from 60 --to 180 -j DROP 328 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|7B3231AB|" --from 60 --to 180 -j DROP 329 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|7B7EF9EE|" --from 60 --to 180 -j DROP 330 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|7DE69430|" --from 60 --to 180 -j DROP 331 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|7F000002|" --from 60 --to 180 -j DROP 332 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|80797E8B|" --from 60 --to 180 -j DROP 333 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|80C7B4A2|" --from 60 --to 180 -j DROP 334 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|852A3003|" --from 60 --to 180 -j DROP 335 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|85C0B542|" --from 60 --to 180 -j DROP 336 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|85F2A518|" --from 60 --to 180 -j DROP 337 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|898781AF|" --from 60 --to 180 -j DROP 338 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|8D08C32F|" --from 60 --to 180 -j DROP 339 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|8D08C34E|" --from 60 --to 180 -j DROP 340 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|8D08E150|" --from 60 --to 180 -j DROP 341 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|8D657666|" --from 60 --to 180 -j DROP 342 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|8E04056D|" --from 60 --to 180 -j DROP 343 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|904C150D|" --from 60 --to 180 -j DROP 344 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|904C6AE8|" --from 60 --to 180 -j DROP 345 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|904C7F72|" --from 60 --to 180 -j DROP 346 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|91FDB717|" --from 60 --to 180 -j DROP 347 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|9357F420|" --from 60 --to 180 -j DROP 348 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|9B5CB676|" --from 60 --to 180 -j DROP 349 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|9D078FD1|" --from 60 --to 180 -j DROP 350 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|9DCD2040|" --from 60 --to 180 -j DROP 351 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|9F32584D|" --from 60 --to 180 -j DROP 352 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|9F6A794B|" --from 60 --to 180 -j DROP 353 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|9FFD14B3|" --from 60 --to 180 -j DROP 354 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|A29FF365|" --from 60 --to 180 -j DROP 355 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|A2F389A3|" --from 60 --to 180 -j DROP 356 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|A2FD2186|" --from 60 --to 180 -j DROP 357 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|A46D60E8|" --from 60 --to 180 -j DROP 358 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|A48ADD44|" --from 60 --to 180 -j DROP 359 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|A89CA815|" --from 60 --to 180 -j DROP 360 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|A9840D67|" --from 60 --to 180 -j DROP 361 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|AB118235|" --from 60 --to 180 -j DROP 362 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|AB19CC8D|" --from 60 --to 180 -j DROP 363 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|ADC0DB3B|" --from 60 --to 180 -j DROP 364 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|ADC27F90|" --from 60 --to 180 -j DROP 365 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|ADC9D806|" --from 60 --to 180 -j DROP 366 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|ADE0D10E|" --from 60 --to 180 -j DROP 367 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|ADECE46C|" --from 60 --to 180 -j DROP 368 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|ADF4B80A|" --from 60 --to 180 -j DROP 369 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|ADFFC2AE|" --from 60 --to 180 -j DROP 370 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|ADFFE6C4|" --from 60 --to 180 -j DROP 371 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|AE8E1619|" --from 60 --to 180 -j DROP 372 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|AE8E718E|" --from 60 --to 180 -j DROP 373 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B00A2551|" --from 60 --to 180 -j DROP 374 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B039D891|" --from 60 --to 180 -j DROP 375 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B21252D8|" --from 60 --to 180 -j DROP 376 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B2206F88|" --from 60 --to 180 -j DROP 377 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B2209C3B|" --from 60 --to 180 -j DROP 378 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B220F752|" --from 60 --to 180 -j DROP 379 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B221D4A2|" --from 60 --to 180 -j DROP 380 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B2318487|" --from 60 --to 180 -j DROP 381 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B23E4B63|" --from 60 --to 180 -j DROP 382 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B23EF29C|" --from 60 --to 180 -j DROP 383 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B24FB6F8|" --from 60 --to 180 -j DROP 384 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B2ECB14D|" --from 60 --to 180 -j DROP 385 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B457B6E3|" --from 60 --to 180 -j DROP 386 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B499E1A8|" --from 60 --to 180 -j DROP 387 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B4B3AB79|" --from 60 --to 180 -j DROP 388 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B5E09B29|" --from 60 --to 180 -j DROP 389 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B76F8D5F|" --from 60 --to 180 -j DROP 390 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B848FDE8|" --from 60 --to 180 -j DROP 391 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B89A0A92|" --from 60 --to 180 -j DROP 392 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B8A984F4|" --from 60 --to 180 -j DROP 393 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B919962D|" --from 60 --to 180 -j DROP 394 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|B9353D32|" --from 60 --to 180 -j DROP 395 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|BC050460|" --from 60 --to 180 -j DROP 396 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|BC286C0D|" --from 60 --to 180 -j DROP 397 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|BC84FABA|" --from 60 --to 180 -j DROP 398 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|BCA51F18|" --from 60 --to 180 -j DROP 399 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|BCE2CFFB|" --from 60 --to 180 -j DROP 400 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|BDA31105|" --from 60 --to 180 -j DROP 401 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C043C606|" --from 60 --to 180 -j DROP 402 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C05F62CA|" --from 60 --to 180 -j DROP 403 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C0682C06|" --from 60 --to 180 -j DROP 404 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C079976A|" --from 60 --to 180 -j DROP 405 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C13060DA|" --from 60 --to 180 -j DROP 406 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C139F475|" --from 60 --to 180 -j DROP 407 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C15B1A84|" --from 60 --to 180 -j DROP 408 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C169919E|" --from 60 --to 180 -j DROP 409 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C1A94258|" --from 60 --to 180 -j DROP 410 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C1CB3012|" --from 60 --to 180 -j DROP 411 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C1EAE995|" --from 60 --to 180 -j DROP 412 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C1EE9762|" --from 60 --to 180 -j DROP 413 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C1EF842C|" --from 60 --to 180 -j DROP 414 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C2439046|" --from 60 --to 180 -j DROP 415 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C295FA14|" --from 60 --to 180 -j DROP 416 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C2B97301|" --from 60 --to 180 -j DROP 417 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C2BB5E06|" --from 60 --to 180 -j DROP 418 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C3025844|" --from 60 --to 180 -j DROP 419 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C3087D40|" --from 60 --to 180 -j DROP 420 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C32B52AA|" --from 60 --to 180 -j DROP 421 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C331C91E|" --from 60 --to 180 -j DROP 422 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C332C30F|" --from 60 --to 180 -j DROP 423 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C34A263E|" --from 60 --to 180 -j DROP 424 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C34A4E15|" --from 60 --to 180 -j DROP 425 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C34DF1F2|" --from 60 --to 180 -j DROP 426 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C392EB21|" --from 60 --to 180 -j DROP 427 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C395D2D3|" --from 60 --to 180 -j DROP 428 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C39AF397|" --from 60 --to 180 -j DROP 429 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C3BF9567|" --from 60 --to 180 -j DROP 430 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C3D348C8|" --from 60 --to 180 -j DROP 431 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C504040C|" --from 60 --to 180 -j DROP 432 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C639CD85|" --from 60 --to 180 -j DROP 433 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C639DE58|" --from 60 --to 180 -j DROP 434 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C63A7C44|" --from 60 --to 180 -j DROP 435 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C68F8F24|" --from 60 --to 180 -j DROP 436 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C71544DE|" --from 60 --to 180 -j DROP 437 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C74F3F53|" --from 60 --to 180 -j DROP 438 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C7A71F8E|" --from 60 --to 180 -j DROP 439 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C862EA0E|" --from 60 --to 180 -j DROP 440 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C8E5CE73|" --from 60 --to 180 -j DROP 441 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|C94DD38F|" --from 60 --to 180 -j DROP 442 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CA066019|" --from 60 --to 180 -j DROP 443 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CA6A0102|" --from 60 --to 180 -j DROP 444 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CAB50755|" --from 60 --to 180 -j DROP 445 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CADADB0A|" --from 60 --to 180 -j DROP 446 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CB620741|" --from 60 --to 180 -j DROP 447 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CB71AD16|" --from 60 --to 180 -j DROP 448 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CB85EEAC|" --from 60 --to 180 -j DROP 449 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CBA1E6AB|" --from 60 --to 180 -j DROP 450 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CBC73951|" --from 60 --to 180 -j DROP 451 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CE6C335B|" --from 60 --to 180 -j DROP 452 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CE719646|" --from 60 --to 180 -j DROP 453 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CF0C5862|" --from 60 --to 180 -j DROP 454 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CF3AB1A6|" --from 60 --to 180 -j DROP 455 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CF7E3B1B|" --from 60 --to 180 -j DROP 456 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|CF8C95F7|" --from 60 --to 180 -j DROP 457 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D02B21C2|" --from 60 --to 180 -j DROP 458 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D02B866B|" --from 60 --to 180 -j DROP 459 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D0381F2B|" --from 60 --to 180 -j DROP 460 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D049D3A4|" --from 60 --to 180 -j DROP 461 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D0569A70|" --from 60 --to 180 -j DROP 462 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D05D0096|" --from 60 --to 180 -j DROP 463 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D06D8A37|" --from 60 --to 180 -j DROP 464 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D06DCDE8|" --from 60 --to 180 -j DROP 465 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D070667A|" --from 60 --to 180 -j DROP 466 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D1244921|" --from 60 --to 180 -j DROP 467 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D12B0182|" --from 60 --to 180 -j DROP 468 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D1389E2A|" --from 60 --to 180 -j DROP 469 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D13E9A5E|" --from 60 --to 180 -j DROP 470 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D155E58A|" --from 60 --to 180 -j DROP 471 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D174476D|" --from 60 --to 180 -j DROP 472 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D17E6AB6|" --from 60 --to 180 -j DROP 473 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D18D3023|" --from 60 --to 180 -j DROP 474 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D1913632|" --from 60 --to 180 -j DROP 475 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D1BC07BA|" --from 60 --to 180 -j DROP 476 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D1CC9416|" --from 60 --to 180 -j DROP 477 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D1DC1EAE|" --from 60 --to 180 -j DROP 478 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D1EBE019|" --from 60 --to 180 -j DROP 479 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D2AFFF9A|" --from 60 --to 180 -j DROP 480 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D2D16EC7|" --from 60 --to 180 -j DROP 481 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D2E6C0B7|" --from 60 --to 180 -j DROP 482 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D2F27D14|" --from 60 --to 180 -j DROP 483 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D3058512|" --from 60 --to 180 -j DROP 484 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D308451B|" --from 60 --to 180 -j DROP 485 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D32BCB21|" --from 60 --to 180 -j DROP 486 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D35E4293|" --from 60 --to 180 -j DROP 487 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D42D34DB|" --from 60 --to 180 -j DROP 488 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D4442A43|" --from 60 --to 180 -j DROP 489 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D44D681D|" --from 60 --to 180 -j DROP 490 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D4E36282|" --from 60 --to 180 -j DROP 491 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D513A18D|" --from 60 --to 180 -j DROP 492 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D56C4215|" --from 60 --to 180 -j DROP 493 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D5856F66|" --from 60 --to 180 -j DROP 494 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D5A9FB23|" --from 60 --to 180 -j DROP 495 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D5AE9E6C|" --from 60 --to 180 -j DROP 496 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D5BA2105|" --from 60 --to 180 -j DROP 497 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D5CF5594|" --from 60 --to 180 -j DROP 498 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D5EEA6E3|" --from 60 --to 180 -j DROP 499 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D80CCD02|" --from 60 --to 180 -j DROP 500 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D826005C|" --from 60 --to 180 -j DROP 501 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D846581D|" --from 60 --to 180 -j DROP 502 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D85C3A25|" --from 60 --to 180 -j DROP 503 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D88BD590|" --from 60 --to 180 -j DROP 504 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D8B2F165|" --from 60 --to 180 -j DROP 505 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D8C6F667|" --from 60 --to 180 -j DROP 506 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D8DDBCB6|" --from 60 --to 180 -j DROP 507 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D8EAB30D|" --from 60 --to 180 -j DROP 508 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D8FA7390|" --from 60 --to 180 -j DROP 509 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D91EB8A1|" --from 60 --to 180 -j DROP 510 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D9A02A55|" --from 60 --to 180 -j DROP 511 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|D9ACB709|" --from 60 --to 180 -j DROP 512 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|DA2CFBD4|" --from 60 --to 180 -j DROP 513 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|DC6E965A|" --from 60 --to 180 -j DROP 514 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|DCF7E008|" --from 60 --to 180 -j DROP 515 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|DD08451B|" --from 60 --to 180 -j DROP 516 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|DDD53195|" --from 60 --to 180 -j DROP 517 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|DE7A38DB|" --from 60 --to 180 -j DROP 518 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|F3B9BB03|" --from 60 --to 180 -j DROP 519 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|F3B9BB1E|" --from 60 --to 180 -j DROP 520 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|F3B9BB27|" --from 60 --to 180 -j DROP 521 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|F9812E30|" --from 60 --to 180 -j DROP 522 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|FD9D0EA5|" --from 60 --to 180 -j DROP 523 | iptables -t mangle -I PREROUTING -p udp --sport 53 -m string --algo bm --hex-string "|FFFFFFFF|" --from 60 --to 180 -j DROP 524 | ``` 525 | 526 | `-m string`表示启用string模块进行匹配,`–algo bm`表示启用贝叶(Boyer-Moore)字符串搜索算法,另一种算法是kmp(Knuth-Pratt-Morris) 527 | 528 | `–hex-string`就是要匹配的IP地址的HEX格式了,注意这里前面不要有0x表示16进制了,直接写16进制数据就行,后面跟着的就是IP地址的16进制格式. 529 | 530 | `–from 60 –to 180`都是表示搜索的偏置范围(offset),从第60 byte开始到180 byte结束,一般来说DNS返回包的长度很少有超过180字节,而IP值的位置因为协议格式的关系,基本上不可能出现在60字节之前,所以指定这个范围是足够的,同时也可以大大减轻搜索算法的运算压力.如果你担心有什么奇葩DNS返回的结果在这范围之外,删除这两个偏置选项就行了,这样会默认搜索整个字符串,但相应的搜索消耗的CPU资源就更多了. 531 | 532 | #### 开机自动加载iptables配置 533 | 534 | iptables配置完成后,如果不做设置,机器重启后,规则会丢失 535 | 536 | iptables配置完成后执行: 537 | 538 | ``` 539 | $ passwd root 540 | $ su root 541 | sudo iptables-save > /etc/init.d/iptables.up.rules 542 | ``` 543 | 544 | 将当前配置保存在 `iptables.up.rules` 文件中,文件名可以随意。 545 | 546 | 修改网卡配置文件,在网卡IP配置文件 `/etc/network/interfaces` 末行加入 547 | 548 | ``` 549 | sudo gedit /etc/network/interfaces 550 | /* add the line below */ 551 | pre-up iptables-restore < /etc/init.d/iptables.up.rules 552 | ``` 553 | 554 | 最后重启验证 555 | 556 | ## DNSCrypt-proxy 557 | 558 | ### 编译安装过程 559 | 560 | #### 编译安装依赖 libsodium 561 | 562 | ##### 1. 下载源代码 563 | 564 | 点击链接找最新的[tarball of libsodium](https://download.libsodium.org/libsodium/releases/),比如 `libsodium-.tar.gz` 565 | 566 | ##### 2. 验证完整性 567 | 568 | 计算 SHA256: 569 | 570 | $ openssl dgst -sha256 libsodium-.tar.gz 571 | 572 | 使用 dig 验证SHA256: 573 | 574 | $ dig +dnssec +short txt libsodium-.tar.gz.download.libsodium.org 575 | 576 | 如果匹配则继续下面的操作,否则去官方 GitHub 报告,**不要继续进行** 577 | 578 | ##### 3. 编译安装 579 | 580 | $ tar zxvf libsodium-.tar.gz 581 | $ cd libsodium-/ 582 | $ ./configure 583 | $ make -j CORE_NUMBER && make check 584 | # make install 585 | # ldconfig /* root 下重新载入模块 */ 586 | 587 | #### 编译安装 dnscrypt-proxy 588 | 589 | ##### 1. 下载源代码 590 | 591 | 从这里下载: [dnscrypt download](https://github.com/jedisct1/dnscrypt-proxy/releases) 592 | 593 | ##### 2. 验证完整性 594 | 595 | 计算 SHA256: 596 | 597 | $ openssl dgst -sha256 dnscrypt-proxy-.tar.bz2 598 | 599 | 使用 dig 验证SHA256: 600 | 601 | $ dig +dnssec TXT dnscrypt-proxy-.tar.bz2.download.dnscrypt.org 602 | 603 | 如果匹配则继续下面的操作,否则去官方 GitHub 报告,**不要继续进行** 604 | 605 | ##### 3. 编译安装 606 | 607 | /* 在 Fedora, RHEL and CentOS 上安装 必须在 `ldconfig` 之前 */ 608 | $ su root 609 | # echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf 610 | # ldconfig 611 | # exit 612 | /* Ubuntu 标准安装 */ 613 | $ bunzip2 -cd dnscrypt-proxy-*.tar.bz2 | tar xvf - 614 | $ cd dnscrypt-proxy-*/ 615 | $ ./configure && make -j CORE_NUMBER 616 | # make install 617 | # ldconfig 618 | 619 | 默认安装在 `/usr/local/sbin/dnscrypt-proxy` 620 | 621 | man 8 dnscrypt-proxy # 查看详细帮助信息 622 | 623 | ### 启动脚本配置以及使用 624 | 625 | #### 1. 创建专用系统账户 626 | 627 | /* 理论上都可以使用 未完全测试,建议创建 带有空家目录的专用无权限系统账户 */ 628 | # adduser --system --home /home/dnscrypt --disabled-password --disabled-login dnscrypt 629 | # useradd --home-dir /home/dnscrypt --create-home --system --user-group dnscrypt 630 | 631 | #### 2. 配置启动脚本 632 | 633 | 创建脚本文件 `# touch /etc/init/dnscrypt.conf` 634 | 635 | 脚本中不需要出现 daemon 的内容,比如这里的 `--daemonize` 636 | 其中的 `--resolver-name` 可以在[public DNS resolvers supporting DNSCrypt](https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv)中的 `Name` 列找,目前使用的是 `opendns` 637 | 其中 `--tcp-only` 因为性能问题不建议使用,除非必须要用来突破DNS污染 638 | 639 | 640 | description "dnscrypt startup script" 641 | 642 | start on (local-filesystems and started dbus and stopped udevtrigger) 643 | stop on runlevel [016] 644 | 645 | script 646 | exec /usr/local/sbin/dnscrypt-proxy --resolver-name=cloudns-can --local-address=127.0.0.9:35535 --user=dnscrypt --logfile=/var/log/dnscrypt.log --pidfile=/var/run/dnscrypt.pid 647 | end script 648 | 649 | 之后软连接到 `/etc/init.d` 目录下 650 | 651 | # ln -s /lib/init/upstart-job /etc/init.d/dnscrypt 652 | 653 | 654 | 注: `--resolver-name=cloudns-can` 有 DNSSEC, No-log 和 Namecoin , 方便突破封鎖 655 | 656 | #### 3. 启动和停止 657 | 658 | # killall -KILL dnscrypt-proxy // 或者使用 pid 659 | # start dnscrypt // 在 /etc/init.d 中的名称 660 | 661 | ## DNSmasq 662 | 663 | ### 禁用 Ubuntu 自带 DNSmasq 664 | 665 | `# vim /etc/NetworkManager/NetworkManager.conf`,把 dns=dnsmasq 注释掉,之后重启服务 666 | 667 | # service network-manager restart 668 | 669 | ### 编译安装过程 670 | 671 | ##### 1. 下载源代码 672 | 673 | 从这里下载: [DNSmasq](http://www.thekelleys.org.uk/dnsmasq/),比如 `dnsmasq-.tar.gz` 674 | 675 | ##### 2. 编译安装 676 | 677 | /* Ubuntu 标准安装 */ 678 | $ tar zxvf dnsmasq-.tar.gz 679 | $ cd dnsmasq-/ 680 | $ make -j CORE_NUMBER 681 | # make install 682 | 683 | 默认安装在 `/usr/local/sbin/dnsmasq` 684 | 685 | man 8 dnsmasq # 查看详细帮助信息 686 | 687 | ### 启动脚本配置以及使用 688 | 689 | #### 1. 创建专用系统账户 690 | 691 | /* 理论上都可以使用 未完全测试,建议创建 带有空家目录的专用无权限系统账户 */ 692 | # adduser --system --home /home/dnsmasq --disabled-password --disabled-login dnsmasq 693 | # useradd --home-dir /home/dnsmasq --create-home --system --user-group dnsmasq 694 | 695 | #### 2. 配置启动脚本 696 | 697 | 创建脚本文件 `# touch /etc/init/dnsmasq.conf` 698 | 699 | 脚本中不需要出现 daemon 的内容 700 | 701 | description "dnsmasq startup script" 702 | 703 | start on (local-filesystems and started dbus and stopped udevtrigger) 704 | stop on runlevel [016] 705 | 706 | script 707 | exec /usr/local/sbin/dnsmasq --conf-file=/etc/dnsmasq.conf 708 | end script 709 | 710 | 之后软连接到 `/etc/init.d` 目录下 711 | 712 | # ln -s /lib/init/upstart-job /etc/init.d/dnsmasq 713 | 714 | #### 3. 启动和停止 715 | 716 | # killall -KILL dnsmasq // 或者使用 pid 717 | # start dnsmasq // 在 /etc/init.d 中的名称 718 | 719 | #### 4. 卸载 720 | 721 | # make uninstall // dnsmasq 一般没有 uninstall 字段 722 | # make clean 723 | $ chmod +x clean_compile_soft.py 724 | # ./clean_compile_soft.py 725 | 726 | 727 | 卸载脚本 `clean_compile_soft.py` 在[Scripts repository](https://github.com/wongsyrone/Scripts) 728 | 729 | #### 4. 配置 dnsmasq 730 | 731 | NetworkManager 设置当前连接DNS为 `127.0.0.1` 即可使用本地 DNSmasq 进行解析和缓存 732 | 733 | 创建默认位置配置文件 `# touch /etc/dnsmasq.conf`,我们可以把大量文本配置放在`/etc/dnsmasq.d`文件夹中,然后使用`conf-dir`选项指定配置文件目录,目录中**不要**放置其他文件,这样看起来也比较整洁。另外dnsmasq配置文件可参考我的[OpenWRT配置](https://github.com/wongsyrone/OpenWrt) 734 | 735 | no-resolv 736 | no-poll 737 | all-servers 738 | 739 | conf-dir=/etc/dnsmasq.d 740 | user=dnsmasq 741 | group=dnsmasq 742 | 743 | listen-address=127.0.0.1 744 | 745 | # log for debug purpose 746 | # log-queries 747 | # log-facility=/var/log/dnsmasq.log 748 | 749 | # Find more rules there, including accelerate and ISP block rules 750 | # (https://github.com/felixonmars/dnsmasq-china-list) 751 | 752 | # special forward rules 753 | server=/launchpad.net/8.8.8.8 754 | 755 | 756 | ## 启动模板以及使用 757 | 758 | ### 模板内容 759 | 760 | description "" 761 | 762 | start on (local-filesystems and started dbus and stopped udevtrigger) 763 | stop on runlevel [016] 764 | 765 | script 766 | exec 767 | end script 768 | 769 | 770 | ### 添加到系统 771 | 772 | # cp .conf /etc/init/ 773 | # ln -s /lib/init/upstart-job /etc/init.d/ 774 | 775 | ### 使用 776 | 777 | # start 778 | # stop 779 | 780 | -------------------------------------------------------------------------------- /06.md: -------------------------------------------------------------------------------- 1 | # OpenWRT 编译环境搭建 2 | 3 | ## 配置编译环境 4 | 5 | 必须使用**非root用户**,ArchLinux需要创建新用户。 6 | 7 | ### 安装依赖包 8 | ``` 9 | // Ubuntu 14.04 必选 10 | # apt-get install asciidoc bash bc binutils bzip2 fastjar flex git-core g++ build-essential util-linux gawk libgtk2.0-dev intltool jikespg zlib1g-dev genisoimage libncurses5-dev libssl-dev patch perl-modules python2.7-dev rsync ruby sdcc unzip wget gettext xsltproc libboost1.55-dev libboost1.55-tools-dev libxml-parser-perl libusb-dev bin86 bcc bzr ecj sharutils openjdk-7-jdk zip gcc-multilib quilt libglib2.0-dev gperf 11 | // Ubuntu 14.04 可选 12 | # apt-get install subversion mercurial cvs 13 | // ArchLinux 必选 14 | # pacman -S base-devel 15 | # pacman -S [--needed] asciidoc b43-fwcutter bash bc bin86 boost binutils bzip2 cdrkit fastjar flex gawk gettext git gtk2 intltool jdk7-openjdk libusb libxslt ncurses openssl patch perl python2 rsync ruby sdcc sharutils unzip util-linux wget zlib gcc make perl-extutils-makemaker findutils libstdc++5 lib32-libstdc++5 gperf 16 | // 根据wiki,ArchLinux部分必选包在AUR里面 17 | // 从 2015-12-11 开始,bcc和jikes貌似从AUR里消失了,可能是 C++ ABI 更新的缘故,不安装这两个貌似也可以 18 | $ yaourt -S bcc jikes 19 | // ArchLinux 可选 20 | # pacman -S subversion 21 | ``` 22 | 23 | ### 首次配置需要检出源代码,这里用 Git 检出开发 trunk 分支 24 | 25 | $ git clone git://git.openwrt.org/openwrt.git 26 | 27 | 这时,就会出现名为`openwrt`的文件夹,这就是将来我们的工作目录。 28 | 如果已经有了以前的版本库,需要按照下面的命令更新,其他情况参照 Git 的 Manpage 29 | 30 | // 必须进入工作目录才能更新 31 | $ cd openwrt/ 32 | $ git pull 33 | 34 | ### 更新和安装feeds(需要VPN) 35 | 36 | 在下载之前可以通过查看`feeds.conf.default`文件,来检查哪些文件需要包含在环境中,如果已经有了`feeds.conf`则需要看这个文件。更新只需要重复命令即可 37 | 38 | $ cd openwrt/ 39 | $ ./scripts/feeds update -a 40 | $ ./scripts/feeds install -a 41 | 42 | ### 配置编译信息 43 | 44 | 必须先选择好目标(target)类型才能执行 `make defconfig` 45 | 46 | $ make defconfig 47 | $ make prereq 48 | $ make menuconfig 49 | 50 | 其中斜线(/)可以进行搜索。 51 | 刚开始可以考虑选择编译SDK用于开发,编译ImageGenerator(a.k.a ImageBuilder)简单打包自己需要的Package和配置文件进入固件中,也可以同时打包好工具链(ToolChain)方便以后使用,这样的话时间会稍微长一些。 52 | 53 | ## 开始编译 54 | 55 | 一般情况,进行全部编译时使用一个简单的命令,因为编译过程会下载很多文件,目前许多项目的repo都迁移到GitHub上了,一般情况下不必使用VPN,但是如果网络条件很差,可以考虑使用一个靠谱的VPN服务提供商。 56 | 57 | $ make V=99 58 | 59 | 编译一个单独的软件包(例如cups软件包) 60 | 61 | $ make package/cups/compile V=99 62 | 63 | 如果特殊原因需要分析编译报错信息: 64 | 65 | $ make V=99 2>&1 |tee build.log |grep -i error 66 | 67 | 则将编译的所有输出信息保存在`build.log`中,将error信息打印在屏幕上。 68 | 69 | 还发现一个记录log的好办法,打开`make menuconfig`里面的Advanced configuration options (for developers),接着开启Enable log files during build process,这样在使用`make V=99`的时候自动会生成logs文件夹,里面详细记录了各个阶段的日志文件,相比上述输出日志的形式,这种更加全面,实际使用过程发现好像反应稍微慢了点,不过没有错误才是最好的,不是么? 70 | 71 | 72 | ### 编译结束 73 | 74 | 编译结束后,所有的文件都会放在编译根目录下的 bin/yourtarget/ ,例如 /bin/ar71xx 75 | 76 | $ ls bin/* 77 | 78 | 编译之后的文件主要有以下几类: 79 | 80 | 1. bin/.trx 文件: 路由器固件。如果没有另外一种也不必惊慌。关于.bin和.trx的区别,一种说法是,第一次刷路由器的时候,需要用.bin文件,如果需要再升级,则不能再使用 .bin文件,而需要用 .trx文件。原因是 .bin是将路由器的相关配置信息和 .trx封装在一起而生成的封包,也就是说是包含路由器版本信息的 .trx 在第一次刷固件的时候,我们需要提供这样的信息,而在后续升级时则不再需要,用 .trx文件即可。 81 | 2. packages文件夹: 里面包含了我们在配置文件里设定的所有编译好的软件包。 82 | 3. (可选)OpenWrt-SDK.**.tar.bz2: 这个也就是我们定制编译好的OpenWRT SDK环境。我们将用这个来进行OpenWrt软件包的开发。我的 TP-Link WR841N v7 编译的SDK文件名是`OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2` 83 | 4. (可选)OpenWrt-ImageBuilder-**.tar.bz2: 这个可以简单打包自己需要的Package和配置文件进入固件中。我的文件名为`OpenWrt-ImageBuilder-ar71xx_generic-for-linux-x86_64.tar.bz2` 84 | 5. (可选)OpenWrt-Toolchain-**.tar.bz2: 这个是交叉编译工具链。我的是`OpenWrt-Toolchain-ar71xx-for-mips_34kc-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2` 85 | 6. md5sums 文件: 这个文件记录了所有我们编译好的文件的MD5值,来保证文件的完整性。 86 | 87 | 88 | 编译完成后,一定要将**编译好的bin目录进行备份** 89 | 90 | 91 | ## 清理以及再编译 92 | 93 | 建议现在清理编译产生的文件,以免下次编译时造成冲突,也就是每次编译完成之后把需要的东西复制到别处,然后立即清理(因为要生成的文件如果存在的话,可能不会被替换),执行`make clean` 94 | 95 | 注意:在执行clean命令,确保已经将编译好的Image进行了备份。清理工作会清除bin目录。 96 | 97 | $ make clean 98 | 99 | 除了清除生成的目录,还想清除交叉编译工具(以及工具链目录) 100 | 101 | $ make dirclean 102 | 103 | 清除所有相关的东西,包括下载的软件包,配置文件,feed内容等(不建议使用) 104 | 105 | $ make distclean 106 | 107 | 对于更新feeds后出现的错误:ERROR:please fix package/feeds/packages/mc/Makefile 等类似的问题,需要执行这条语句进行系统的清理 108 | 109 | 对于清理组件,比如软件包的清理 110 | 111 | 比如清理 linux 112 | 113 | $ make target/linux/clean 114 | 115 | 清理 base-files 软件包 116 | 117 | $ make package/base-files/clean 118 | 119 | 清理 Luci 120 | 121 | $ make package/luci/clean 122 | 123 | ## 和官方仓库保持同步 124 | 125 | 很多时候,我们在自己的某个Repository里面进行修改或者开发操作,所以要保证我们的代码与官方的代码保持同步。 126 | 127 | 官方仓库的地址是 `git://git.openwrt.org/openwrt.git` 或者 `http://git.openwrt.org/openwrt.git`。其他在GitHub上的仓库貌似都是镜像,比如[openwrt-es](https://github.com/openwrt-es/openwrt)以及[openwrt-mirror](https://github.com/openwrt-mirror/openwrt)。 128 | 129 | 如果还没进行过多少修改的代码,可以直接fork给出的repo,然后可以方便的使用github本身看我们的分支和官方的代码有多少的超前和滞后提交,可以作为一个提醒。 130 | 131 | 接下来,我们建立一个远程仓库名为`upstream`: 132 | 133 | $ git remote -v // 首先列出远程仓库,一般只有一个origin 134 | 135 | $ git remote add upstream http://git.openwrt.org/openwrt.git 136 | 137 | 这样就建立好了,我们可以接着列出远程仓库看一下.如果需要变更或者删除远程仓库的话,请参考git remote的manpage. 138 | 139 | 有的人喜欢使用`git pull`,但是官方推荐的是使用fetch然后merge,这样有什么区别还有冲突都一目了然. 140 | 141 | $ git fetch upstream master // 从官方拉下来最新代码,一般只取得master就行了,其他分支根据需求选择 142 | 143 | $ git checkout master // 切换到主分支,或者是切换到你需要merge到的分支 144 | 145 | $ git merge upstream/master // 自动merge进上面切换到的分支中,可以自动或者手动解决冲突 146 | 147 | 这种方法进行的是三方合并,每次都会产生一个合并的commit,看一下git log顿时瞎眼,对于强迫症而言怎么能忍? 148 | 149 | 另外一种单线git log的方式,适用于各种强迫症患者: 150 | 151 | 既然是单线方式,最有可能的也就是`git-rebase`了,基本思路是本地建立一个upstream分支,跟踪上游的变化,只使用`git-fetch`拉取上游,定期在本地master上进行rebase. 152 | 153 | $ git fetch upstream master // 继续拉取上游最新commit 154 | 155 | $ git checkout -b upstream upstream/master //以 upstream/master 为分界点取出一个名为upstream的分支 156 | 157 | $ git checkout master // 切换到主分支 158 | 159 | $ git rebase -i upstream // 将 upstream 分支rebase进本地的主分支 160 | 161 | $ git branch -d upstream // 最后可以删除upstream分支,如果没有完全rebase进来的话是不会让你删除这个分支的 162 | 163 | 上面的方法有一个shortcut,前提设置好upstream作为远程跟踪,之后使用 164 | 165 | $ git pull upstream master --rebase 166 | 167 | 如果使用 `git pull --rebase` 则是默认对 origin master 进行操作。 168 | 169 | 当然git-rebase我也用不好,如果发现方法不对或者有更好办法欢迎PR 170 | 171 | 这样,我们就能时刻和官方保持一致了. 172 | 173 | ## OpenWRT 编译 doc 文件 174 | 175 | 在 OpenWrt 的 trunk 分支中有一个文件夹名为 `doc`,在这个文件夹中包含一部分文档可供参考,是用 LaTeX 写的,我们需要编译之后才能阅读的更顺畅,编译之后默认生成 .pdf 和 .htm 文件。 176 | 177 | 在 Ubuntu 我们可以使用 apt-get 从网络上直接下载包来安装。 178 | 179 | 我们用到的三个比较重要的命令有 `apt-cache search` 、`apt-cache show` 和 `sudo apt-get install` 180 | 181 | 首先使用 182 | 183 | $ apt-cache search latex 184 | 185 | 我们可以看到许多包被列出。选择安装`texlive-latex-base`, 它的描述是:Tex Live: Basic LaTex packages 186 | 187 | sudo apt-get install texlive-latex-base 188 | 189 | 这样就安装好Latex了,可以直接使用。 但编译中文时,由于没有安装CJK中文环境,会提示找不到CJK包。 190 | 191 | $ apt-cache search cjk 192 | 193 | 选择安装`latex-cjk-all`, 它的描述是:Installs all LaTex CJK packages. 194 | 195 | sudo apt-get install latex-cjk-all 196 | 197 | 这样就可以使用中文环境了。 198 | 199 | 有些.sty文件可能没有安装,例如:lastpage.sty. 这个时候不要到网络上去询问是因为什么, Latex的输出错误信息已经很明显了。 200 | 使用下面的命令来查找相应的包。 **注意不要加.sty文件后缀** 201 | 202 | $ apt-cache search lastpage 203 | 204 | 可以看到需要下面的包,以及对这个包的描述:texlive-latex-extra - TeX Live: LaTeX supplementary packages 选择安装即可: 205 | 206 | sudo apt-get install texlive-latex-extra 207 | 208 | 完成上面的这三步,就可以基本满足平时的应用需求了。如果以后需要使用新的包,可以使用上面的方法来查找相应的安装包,并选择安装即可。 209 | 210 | ## 增加设备支持 211 | 212 | ##### 前提 213 | 214 | 如果是专业搞过嵌入式开发的,懂得架构以及其他必要知识的可以忽略这个前提,接下来就是我要说的了,找一款和你想要添加的设备**很相近**且官方已经有了支持的型号,至少要是相同的平台,比如ar71xx.这部分基本上围绕这个前提来展开。 215 | 216 | ##### 所需 217 | 218 | 完整 OpenWrt 开发环境. 包括编辑器, 配置好的 `quilt` 工具. 219 | 220 | 假设之前已经编译过 bin, 有**完整的 .config 和 toolchain**. 221 | 222 | 目前看到的很多教程教人直接修改现有的 patch 文件或者是 tmp/ 文件夹下的文件,更甚者胡乱猜测,这样会导致一些问题。 223 | 224 | 比如源码更新的时候,许多 Patch 文件的偏移(offset)会发生变更,主要体现在 linux 内核版本升级的时候,这样直接修改现成的 Patch 就会增添许多烦恼,其实官方有一个很好的东东,那就是这个 quilt,它是用来管理代码树中的 patch 的嵌入式内核开发利器! 225 | 226 | 227 | ##### 增加 Device-Specific 支持文件 228 | 229 | 这个部分的文件是单独的,与其他的文件比如各种 Patch 没有较大的关联,在重新编译之前只需要`make clean`就行。 230 | 231 | 我们以添加 TP-Link TL-WR2041N v1 版本为例子进行说明: 232 | 233 | 新手刚开始添加支持的时候最好在取出最新的 trunk 代码之后立即进行,防止其他文件干扰,如果之前做过类似的操作或者懂得目录结构、知道文件是做什么用的,可以忽略这个建议。 234 | 235 | **删除 tmp/ 目录**,这个是大坑,因为这个文件夹内的内容全是生成的,没必要进行更改。 236 | 237 | $ rm -rf tmp/ 238 | 239 | 首先,如同前文所述,确定好相近的型号,方便添加支持。我这个型号的板子与国外的 WDR3500 相似,与国内的 TP-Link TL-WR941N v6 相同,我是通过 WDR3500 进行添加的。 240 | 241 | 搜索以下相关的文件,以确定需要修改什么文件,之后照猫画虎。 242 | 243 | 运行 `grep wdr3500 trunk/* -r -l` 得到的结果如下,我已经做好了分类: 244 | 245 | ``` 246 | // 这部分是Device-Specific的 247 | trunk/target/linux/ar71xx/base-files/etc/diag.sh 248 | trunk/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds 249 | trunk/target/linux/ar71xx/base-files/etc/uci-defaults/02_network 250 | trunk/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 251 | trunk/target/linux/ar71xx/base-files/lib/ar71xx.sh 252 | trunk/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr3500.c 253 | // 这部分是制作镜像的相关文件 254 | trunk/target/linux/ar71xx/image/Makefile 255 | trunk/target/linux/ar71xx/generic/profiles/tp-link.mk 256 | trunk/tools/firmware-utils/src/mktplinkfw.c 257 | // 这部分是内核支持相关的文件 258 | trunk/target/linux/ar71xx/config-3.10 259 | trunk/target/linux/ar71xx/patches-3.10/610-MIPS-ath79-openwrt-machines.patch 260 | ``` 261 | 262 | 得到的文件就是基本的支持文件了,我们一个一个说。 263 | 264 | ##### diag.sh 265 | 266 | 这个文件是 openwrt 初始化时闪烁的灯的配置,一般的路由启动的时候只闪烁 System 灯或者电源灯,基本没有修改的价值,仿照修改即可。 267 | 268 | 比如2041n v1: 269 | ```sh 270 | tl-wdr3500 | \ 271 | tl-wr2041n-v1 | \ 272 | ........ 273 | tl-wr941nd) 274 | status_led="tp-link:green:system" 275 | ``` 276 | 添加到该位置就行。 277 | 278 | ##### uci-defaults/01_leds 279 | 280 | 这个文件是定义 led 的信息的,简单的比如 `ucidef_set_led_netdev` 多用于定义 WAN 口,修改最后的 eth0 为你对应的设备名称; `ucidef_set_led_wlan` 多用于定义 WLAN 口,最后的 `phyxtpt` 目前见到的只有 x=0 和1两种情况,这个和设备初始出来的phy物理设备相关; `ucidef_set_led_switch` 用来定义交换机的配置,最后的 0x00 部分是端口掩码,一般的顺序如下。 281 | 282 | 至于更详细的定义过程,需要参考 `packages/base-files/files/lib/functions` 目录的 `uci-defaults.sh` 脚本。(目前新加的文件 `uci-defaults-new.sh` 文件,看样子是通过 JSON 传值的,应该是应用于新的设备或者新的架构的) 283 | 284 | 比如2041n v1: 285 | ```sh 286 | tl-wr2041n-v1) 287 | ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0" 288 | ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x02" 289 | ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x04" 290 | ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x08" 291 | ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x10" 292 | ucidef_set_led_netdev "wlan" "WLAN" "tp-link:green:wlan" "wlan0" 293 | ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy1tpt" 294 | ;; 295 | ``` 296 | 297 | ##### uci-defaults/02_network 298 | 299 | 该文件定义初始化网络信息,主要是交换机和 vlan,~~不过我遇到怪异的事情是,`ucidef_set_interfaces_lan_wan` 紧跟着的第一个参数是定义 wan 的,第二个是定义 lan 的,比如下面的 eth0 是 wan 而 eth1 是 lan 。~~(貌似是在设备 mach 文件中定义的问题,看了一下网络初始化的脚本 `uci-defaults.sh` 中的定义,应该第一个参数是 lan ,第二个是 wan) 300 | 比如 wr2041n v1: 301 | ```sh 302 | tl-wr2041n-v1) 303 | ucidef_set_interfaces_lan_wan "eth0" "eth1" 304 | ucidef_add_switch "switch0" "1" "1" 305 | ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4" 306 | ;; 307 | ``` 308 | 309 | ##### uci-defaults的说明 310 | 311 | 从 https://github.com/openwrt/openwrt/commit/dd300dc979eb65b189656b34e8b2cfaeba0f6afb 以及之前的一些commit来看,官方使用原来的 uci-defaults-new.sh代替了uci-defaults.sh,主要影响的应该就是02_network的添加了,而且目前是统一放在 `/etc/board.d`里作为原来的`/etc/uci-defaults`. 对于switch部分,基本构成是"数字|@或者:|数字",用"@"的应该是cpu port和switch口相连的,用":"的应该是写vlan的,写在最前面的数字(@和:前)是对应设备lan wan插口,书写顺序可能是按照switch端口从0开始递增,先写lan部分再写wan部分。官方目前还没写注释,新写法依然存在困惑。 312 | 对于 wr2041n v1: 313 | ```sh 314 | tl-wr2041n-v1) 315 | ucidef_set_interfaces_lan_wan "eth0" "eth1" 316 | ucidef_add_switch "switch0" \ 317 | "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" 318 | ;; 319 | ``` 320 | 321 | ##### lib/upgrade/platform.sh 322 | 323 | 该文件是定义系统更新时验证的,基本上不用怎么更改。 324 | 325 | 比如 2041n v1: 326 | ```sh 327 | tl-wdr3500 | \ 328 | tl-wr2041n-v1 | \ 329 | ``` 330 | 添加到了wdr3500的下方。 331 | 332 | ##### lib/ar71xx.sh 333 | 334 | 第一个是硬件 magic number,可以用 WinHex 打开固件文件,查看对应的偏移即可找到,model 定义的是显示的设备名称,下面的 `*"TL-WR2041N v1"` 要对应设备支持的 mach C语言设备文件中定义好的名称;同样的, name 定义的是内部传递的值,最好与上面添加的行一致。简单来说,涉及到型号名称的最好都保持一致。 335 | 336 | 比如 2041n v1: 337 | ```sh 338 | "204100"*) 339 | model="TP-Link TL-WR2041N" 340 | ;; 341 | 342 | *"TL-WR2041N v1") 343 | name="tl-wr2041n-v1" 344 | ;; 345 | ``` 346 | 347 | ##### files/arch/mips/ath79/mach-tl-wdr3500.c 348 | 349 | 这个就是很重要的设备支持 C语言文件了,开头的前缀 mach 最好保留,mach后的名称需要与以后添加的linux patch支持名称保持一致。 350 | 351 | 一般用于定义 led、flash 以及 PHY4 等等涉及到的端口信息,有的mach文件还涉及到 ART 的偏移量(offset),ART是存储无线数据的分区,如果设置不当会导致路由没有无线。 352 | 353 | 为了最快的添加路由支持,可以采用sed, awk工具批量改名的方法,写出一个设备支持文件来,当然也可以使用 vim, emacs批量完成。 354 | 355 | 比如 2041n v1: 356 | 新建文件 target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr2041n-v1.c,详情请[戳这里](https://github.com/wongsyrone/openwrt-1/blob/master/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr2041n-v1.c) 357 | 358 | 值得注意的是: 359 | `MIPS_MACHINE(ATH79_MACH_TL_WR2041N_V1, "TL-WR2041N-v1", "TP-LINK TL-WR2041N v1", wr2041n_setup);` 360 | 第一部分要与 `config-3.10` 文件中添加的内容以及后面添加的linux kernel patch中的内容一致;`"TL-WR2041N-v1"` 是定义的设备名称,最好与 image 的 Makefile一致;"TP-LINK TL-WR2041N v1" 与前面涉及到的 `lib/ar71xx.sh` 文件相关;最后的 `wr2041n_setup` 是设备初始化的主函数名称。 361 | 362 | #### 镜像生成的相关文件 363 | 364 | ##### trunk/target/linux/ar71xx/image/Makefile 365 | 366 | 该文件主要修改如下两行,剩下的内容需要仔细学习 Makefile的写法才能看懂。 367 | 368 | $(eval $(call MultiProfile,TLWR2041,TLWR2041NV1)) 369 | 370 | 该行定义多Profile,一般是一个型号生成多个硬件版本支持的定义 371 | 372 | $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLWR2041NV1,tl-wr2041n-v1,TL-WR2041N-v1,ttyS0,115200,0x20410001,1,4Mlzma)) 373 | 374 | 该行是单独设备的支持信息,第一个参数是使用什么生成办法,2041n v1是使用 `TPLINK-LZMA` 方法,前面有对应的说明,从里面也可以看到我们需要修改 bin/mktplinkfw 文件的源代码,该源代码在 `trunk/tools/firmware-utils/src/mktplinkfw.c` 中 接下来可以根据对 TPLINK-LZMA 的定义看到依次传进去的参数,TLWR2041NV1 是 Profile 名称,tl-wr2041n-v1 是生成的镜像名称,也(可能)是传进去的设备型号,TL-WR2041N-v1 最好对应前面 mach 文件 MIPS_MACHINE 函数的信息,主要是在内核日志和系统日志中体现设备型号,后面的是默认 tty 信息以及 baudrate 波特率,接下来的 magic number是设备的硬件ID,1 是版本,一般不用变,4Mlzma是生成固件的layout信息,该值和硬件ID都在 mktplinkfw.c 中定义。 375 | 376 | ##### trunk/target/linux/ar71xx/generic/profiles/tp-link.mk 377 | 378 | 该文件定义 Profile 信息,主要定义 NAME,会显示在 `make menuconfig` 之后的设备选项里; PACKAGES 定义默认编译安装的包,一般是网卡驱动以及其他必备的包,如 usb支持。 379 | 380 | 比如 2041n v1: 381 | ```mk 382 | define Profile/TLWR2041 383 | NAME:=TP-LINK TL-WR2041N 384 | PACKAGES:= 385 | endef 386 | 387 | define Profile/TLWR2041/Description 388 | Package set optimized for the TP-LINK TL-WR2041N. 389 | endef 390 | $(eval $(call Profile,TLWR2041)) 391 | ``` 392 | 393 | ##### trunk/tools/firmware-utils/src/mktplinkfw.c 394 | 395 | 该文件是生成固件文件的工具,里面包含 TP-LINK 固件 bin 文件的结构和 md5 hash 验证算法,比如定义硬件 magic number,flash layout, 以及其他信息。 396 | 397 | 比如 2041n v1: 398 | ```c 399 | #define HWID_TL_WR2041N_V1 0x20410001 //定义硬件ID 400 | 401 | { 402 | .id = "TL-WR2041Nv1", 403 | .hw_id = HWID_TL_WR2041N_V1, 404 | .hw_rev = 1, 405 | .layout_id = "4Mlzma", 406 | }, 407 | ``` 408 | 定义使用的信息。 409 | 410 | ##### config-3.10 411 | 412 | 添加内核支持的 config 信息,与其他的保持一致就好。 413 | 414 | 比如 2041n v1: 415 | 416 | CONFIG_ATH79_MACH_TL_WR2041N_V1=y 417 | 418 | CONFIG_ 后面的内容和上面 mach 硬件支持文件中定义的保持一致。 419 | 420 | ##### patches-3.10/610-MIPS-ath79-openwrt-machines.patch 421 | 422 | 这个是内核支持的patch文件,需要使用 quilt 创建以及以后维护,前一阵子trunk将大部分分散的补丁都移动到这个patch中了,如果要将patch提交到官方尽量放在这里,自己用的话不要干扰其他patch的应用就可以了。我这里将补丁编号为920,一般来说是最后一个应用的patch了。 423 | 424 | #### 管理补丁文件 425 | 426 | 请通过软件包管理器安装 quilt,当然一般如同上文配置好编译环境就已经安装好了 quilt。 427 | 428 | 然后写入以下配置文件到 `~/.quiltrc` 429 | 430 | ``` 431 | cat > ~/.quiltrc < 620 | 621 | 通过如下命令更新Patch: 622 | 623 | $ make toolchain/gcc/minimal/update V=99 624 | 625 | 对于其余的binutils, gdb, glibc之类的由于没有细分阶段,所以直接按照软件包那样的格式套用就行了。 626 | 627 | 比如 `make toolchain/(gdb|glibc|binutils)/{clean,prepare} V=99 QUILT=1`, `make toolchain/(gdb|glibc|binutils)/update V=99` 628 | 629 | ##### 刷新Patch 630 | 631 | 当软件包更新或者内核更新时,现有的patch文件可能不会完全应用或者存在其他提示。想要重新构建Patch列表中的全部patch可以使用make目标:refresh. 632 | 633 | $ make package/example/refresh V=s // 软件包 634 | $ make target/linux/refresh V=s // 内核 635 | 636 | ##### 不清理代码树重复修改补丁 637 | 638 | 当需要引入新功能做更改时,经常需要多次修改补丁。为了加速,可以在编辑操作(edit)之间保留做完准备操作的代码树. 639 | 640 | 1. 刚开始如上文所述准备好代码树; 641 | 2. 切换到准备好的代码目录; 642 | 3. 前往需要修改的patch位置; 643 | 4. 修改文件并保存对patch文件的更改; 644 | 5. 通过 `quilt push -a` 命令完全应用剩下的补丁文件; 645 | 6. 切换到顶层目录运行 `make package/example/{compile,install}` ,如果是内核的补丁,使用 `make target/linux/{compile,install}` 命令; 646 | 7. 测试二进制文件。如果再次需要进行更改,从第二步重复操作; 647 | 8. 最后使用 `make package/example/update` 命令 ,如果是内核补丁,使用 `make target/linux/update` 命令将patch文件应用到buildroot中。 648 | 649 | 650 | ##### 准备 linux 内核 patch(旧) 651 | 652 | 到这里基本就完成了 OpenWrt 的设备支持代码. 为了支持我们的设备, Linux 代码树的部分文件也需要做改动, OpenWrt 采用了 patch 的方式实现. 653 | 654 | 回退到源代码的根目录 `~/trunk` . 655 | 656 | 清理并准备 patch 树: 657 | 658 | $ make target/linux/{clean,prepare} V=s QUILT=1 659 | 660 | 进入内核代码目录: 661 | 662 | $ cd build_dir/target-*/linux-ar71xx_generic/linux-3.x/ 663 | 664 | 这里就是内核代码树了, 里面的代码是已经打过所有 patch 的, 可以用 `quilt push` 检查看是不是这样: 665 | 666 | $ quilt push 667 | 668 | > File series fully applied, ends at patch platform/xxx-xxxxxxxxxxxxxx.patch. 669 | 670 | 这条输出也告诉我们, 当前最顶的 patch 是 platform/xxx 671 | 672 | 为我的 WL-WR2041N v1 新建个 patch: 673 | 674 | $ quilt new platform/920-MIPS-ath79-add-TL-WR2041N-v1-support.patch 675 | 676 | 选择的数字需要大于刚才的那个 xxx , 然后 quilt 会自动把这个 patch 设置为当前 patch, 所有的改动都针对这个 patch. 677 | 678 | 注意修改文件之前一定要看自己位于哪个patch下,否则修改都会更新到那个patch. 679 | 680 | 然后就是增加代码了 681 | 682 | $ quilt edit arch/mips/ath79/Kconfig 683 | $ quilt edit arch/mips/ath79/Makefile 684 | $ quilt edit arch/mips/ath79/machtypes.h 685 | 686 | 至于怎么改, 参考这些文件里其他硬件的配置 687 | 688 | 比如 2041n v1: 689 | ```patch 690 | --- a/arch/mips/ath79/Kconfig 691 | +++ b/arch/mips/ath79/Kconfig 692 | @@ -900,6 +900,16 @@ config ATH79_MACH_TL_WR1043ND_V2 693 | select ATH79_DEV_USB 694 | select ATH79_DEV_WMAC 695 | 696 | +config ATH79_MACH_TL_WR2041N_V1 697 | + bool "TP-LINK TL-WR2041N v1 board support" 698 | + select SOC_AR934X 699 | + select ATH79_DEV_AP9X_PCI if PCI 700 | + select ATH79_DEV_ETH 701 | + select ATH79_DEV_GPIO_BUTTONS 702 | + select ATH79_DEV_LEDS_GPIO 703 | + select ATH79_DEV_M25P80 704 | + select ATH79_DEV_WMAC 705 | + 706 | config ATH79_MACH_TL_WR2543N 707 | bool "TP-LINK TL-WR2543N/ND support" 708 | select SOC_AR724X 709 | --- a/arch/mips/ath79/Makefile 710 | +++ b/arch/mips/ath79/Makefile 711 | @@ -116,6 +116,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WR841N_V9) += 712 | obj-$(CONFIG_ATH79_MACH_TL_WR941ND) += mach-tl-wr941nd.o 713 | obj-$(CONFIG_ATH79_MACH_TL_WR1041N_V2) += mach-tl-wr1041n-v2.o 714 | obj-$(CONFIG_ATH79_MACH_TL_WR1043ND) += mach-tl-wr1043nd.o 715 | +obj-$(CONFIG_ATH79_MACH_TL_WR2041N_V1) += mach-tl-wr2041n-v1.o 716 | obj-$(CONFIG_ATH79_MACH_TL_WR1043ND_V2) += mach-tl-wr1043nd-v2.o 717 | obj-$(CONFIG_ATH79_MACH_TL_WR2543N) += mach-tl-wr2543n.o 718 | obj-$(CONFIG_ATH79_MACH_TL_WR703N) += mach-tl-wr703n.o 719 | --- a/arch/mips/ath79/machtypes.h 720 | +++ b/arch/mips/ath79/machtypes.h 721 | @@ -134,6 +134,7 @@ enum ath79_mach_type { 722 | ATH79_MACH_TL_WR1041N_V2, /* TP-LINK TL-WR1041N v2 */ 723 | ATH79_MACH_TL_WR1043ND, /* TP-LINK TL-WR1043ND */ 724 | ATH79_MACH_TL_WR1043ND_V2, /* TP-LINK TL-WR1043ND v2 */ 725 | + ATH79_MACH_TL_WR2041N_V1, /* TP-LINK TL-WR2041N v1 */ 726 | ATH79_MACH_TL_WR2543N, /* TP-LINK TL-WR2543N/ND */ 727 | ATH79_MACH_TL_WR703N, /* TP-LINK TL-WR703N */ 728 | ATH79_MACH_TL_WR710N, /* TP-LINK TL-WR710N */ 729 | ``` 730 | 731 | 仅作为参考。 732 | 733 | 然后验证下修改的内容: 734 | 735 | ``` 736 | $ quilt diff # 查看 diff 737 | $ quilt refresh # 保存所有 diff 到 patch 文件 738 | ``` 739 | 740 | 这个时候我们的 patch 文件还在 build_dir 里, 大概位置是 `patches/platform/` 下. 需要同步到 OpenWrt 代码树. 741 | 742 | 退回到顶层工作目录, 执行: 743 | 744 | ``` 745 | $ make target/linux/update V=s 746 | ``` 747 | 748 | 同步完成后, patch 文件会出现在 `target/linux/ar71xx/patches-3.x/` 下. 749 | 750 | 以后代码更新后需要编辑 patch 时,遵从上面的 quilt 对 patch 的管理操作。 751 | 752 | ##### 准备 linux 内核板级支持(新) 753 | 754 | 从 https://github.com/openwrt/openwrt/commit/1e82d9f741cd827e33bfa3d8b3cadffaeb2773c1 开始重新安排了linux内核的板级支持架构,以后添加新板子可以不用添加patch,只需要修改如下文件(目前仅限于 ar71xx): 755 | 756 | > target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt 757 | > target/linux/ar71xx/files/arch/mips/ath79/Makefile 758 | > target/linux/ar71xx/files/arch/mips/ath79/machtypes.h 759 | 760 | 对于原来修改 `arch/mips/ath79/Kconfig`的,添加到`Kconfig.openwrt`里面,以此类推,可以参考上面所述以前添加linux内核patch的说明照猫画虎。官方的这种修改避免每次添加新板子需要重新组织内核patch序列,不管是OP的核心开发者合并修改还是给项目贡献代码都很方便。 761 | 762 | ##### 开始编译 763 | 764 | 再次记得, **删除 tmp 目录** 765 | 766 | ``` 767 | $ rm -rf tmp/ 768 | $ make menuconfig 769 | ``` 770 | 771 | #### 几个问题解决的案例 772 | 773 | ##### 参考链接 774 | 775 | > http://wiki.openwrt.org/doc/devel/add.new.device 776 | > http://wiki.openwrt.org/doc/devel/hw.hacking.first.steps 777 | > http://wiki.openwrt.org/doc/devel/patches 778 | > http://andelf.diandian.com/post/2013-05-22/40050677370 779 | > http://tilt.lib.tsinghua.edu.cn/node/841 780 | > http://www.openwrt.org.cn/bbs/forum.php?mod=viewthread&tid=211 781 | > http://www.tuicool.com/kans/481707042 782 | > http://www.openwrt.org.cn/bbs/forum.php?mod=viewthread&tid=60&extra=page%3D1 783 | 784 | 785 | 786 | -------------------------------------------------------------------------------- /07.md: -------------------------------------------------------------------------------- 1 | # 教程:自托管 planet / moon 自动更新 2 | 3 | 通过研究代码可以看到controller 分发网络变更事件,并且zt内置了 World(planet 或 moon)更新机制。 通过控制器端更新world文件可以实现所有控制器管理的网络一起更新world。 4 | 5 | ```cpp 6 | /** 7 | * Check whether a world update should replace this one 8 | * 9 | * @param update Candidate update 10 | * @return True if update is newer than current, matches its ID and type, and is properly signed (or if current is NULL) 11 | */ 12 | inline bool shouldBeReplacedBy(const World &update) 13 | { 14 | if ((_id == 0)||(_type == TYPE_NULL)) { 15 | return true; 16 | } 17 | if ((_id == update._id)&&(_ts < update._ts)&&(_type == update._type)) { 18 | Buffer tmp; 19 | update.serialize(tmp,true); 20 | return C25519::verify(_updatesMustBeSignedBy,tmp.data(),tmp.size(),update._signature); 21 | } 22 | return false; 23 | } 24 | ``` 25 | 26 | 从这里看到更新的条件是:id相同,type相同,时间戳ts更大(更新),C25519通过_updatesMustBeSignedBy校验成功 27 | 28 | 回看 world 创建方法,type不用管,id默认固定 `const uint64_t id = ZT_WORLD_ID_EARTH;`,key一致即可更新。 29 | 30 | ```cpp 31 | /** 32 | * Create a World object signed with a key pair 33 | * 34 | * @param t World type 35 | * @param id World ID 36 | * @param ts World timestamp / revision 37 | * @param sk Key that must be used to sign the next future update to this world 38 | * @param roots Roots and their stable endpoints 39 | * @param signWith Key to sign this World with (can have the same public as the next-update signing key, but doesn't have to) 40 | * @return Signed World object 41 | */ 42 | ``` 43 | 44 | 而且代码自带处理函数 45 | ```cpp 46 | case ZT_STATE_OBJECT_PLANET: 47 | OSUtils::ztsnprintf(p,sizeof(p),"%s" ZT_PATH_SEPARATOR_S "planet",_homePath.c_str()); 48 | break; 49 | case ZT_STATE_OBJECT_MOON: 50 | OSUtils::ztsnprintf(dirname,sizeof(dirname),"%s" ZT_PATH_SEPARATOR_S "moons.d",_homePath.c_str()); 51 | OSUtils::ztsnprintf(p,sizeof(p),"%s" ZT_PATH_SEPARATOR_S "%.16llx.moon",dirname,(unsigned long long)id[0]); 52 | break; 53 | ... 54 | if (f) { 55 | if (fwrite(data,len,1,f) != 1) 56 | fprintf(stderr,"WARNING: unable to write to file: %s (I/O error)" ZT_EOL_S,p); 57 | fclose(f); 58 | if (secure) 59 | OSUtils::lockDownFile(p,false); 60 | } else { 61 | fprintf(stderr,"WARNING: unable to write to file: %s (unable to open)" ZT_EOL_S,p); 62 | } 63 | ``` 64 | 65 | IncomingPacket 内检测是否可以更新 66 | ```cpp 67 | // Handle planet or moon updates if present 68 | if ((ptr + 2) <= size()) { 69 | const unsigned int worldsLen = at(ptr); 70 | ptr += 2; 71 | if (RR->topology->shouldAcceptWorldUpdateFrom(peer->address())) { 72 | const unsigned int endOfWorlds = ptr + worldsLen; 73 | while (ptr < endOfWorlds) { 74 | World w; 75 | ptr += w.deserialize(*this,ptr); 76 | RR->topology->addWorld(tPtr,w,false); 77 | } 78 | } else { 79 | ptr += worldsLen; 80 | } 81 | } 82 | ``` 83 | 84 | 签名key通过 https://github.com/zerotier/ZeroTierOne/blob/dev/attic/world/mkworld.cpp 可以看出 current.c25519 就是上面要求的 _updatesMustBeSignedBy。 85 | 86 | 总结,在更新前mkworld基础之上,ts取当前时间戳,与更新前用的 current.c25519 保持一致,重新生成新world,替换控制器上的文件即可。 87 | 88 | 控制器重启一下,初始读取world->全网Topology stateObjectGet ->所有客户端 stateObjectPut即可实现全网world更新。 89 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LinuxNotes 2 | 3 | #### I will put some notes in this repository, including How-tos and some tutorials about GNU/Linux. I will switch to ArchLinux. Keep it simple, stupid. 4 | 5 | #### I will use Markdown file to discribe the procedures. 6 | ## Note List 7 | 8 | 1. [Setup system](https://github.com/wongsyrone/LinuxNotes/blob/master/01.md) 9 | 2. [Setup build environment, including C/C++, GNOME and Java](https://github.com/wongsyrone/LinuxNotes/blob/master/02.md) 10 | 3. [Compile software from source](https://github.com/wongsyrone/LinuxNotes/blob/master/03.md) 11 | 4. [Basic usage of "dd" tool](https://github.com/wongsyrone/LinuxNotes/blob/master/04.md) 12 | 5. [dnscrypt-proxy and dnsmasq instructions](https://github.com/wongsyrone/LinuxNotes/blob/master/05.md) 13 | 6. [OpenWRT configure and compile](https://github.com/wongsyrone/LinuxNotes/blob/master/06.md) 14 | --------------------------------------------------------------------------------