Author: jpuyy

  • iptables的ip(ipv4) match

    这个内置的匹配不用加 -m (match)就可以实现

    internet protocol ip协议

    -d [!] addr[/mask] 目标地址或范围
    –destination 同-d
    –dst 同-d

    [!] -f 第二标识,链接追踪会自动识别,不常用

    -i [!] 在哪个interface,后面有+,则会匹配所有有这个名字的interface
    –in-interface 同 -i

    -o [!] 不在哪个interface,后面有+,则不会匹配所有有这个名字的interface
    –out-interface 同 -o

    -p [!] 原始协议名或识别码,在 /etc/protocols 文件中或参见http://www.iana.org/assignments/protocol-numbers.

    -p 隐藏-m选项的,协议如 icmp, tcp, or udp.

    -s [!] addr[/mask] 原地址或范围
    –source Synonym for -s.
    –src Synonym for -s.

    可以用老式的 dotted-quad notation 点分四组表示法,如192.168.1.0/255.255.255.0,或

    Common Inter-Domain Routing(CIDR)表示法,如192.168.1.0/24

     

  • iptables的icmp match

     

    Internet Control Message Protocol(ICMP)

    ICMP的头信息如图

    ICMP header

    –icmp-type[!] typename匹配类型
    –icmp-type[!] type[/code]匹配标识码

  • office2010每次退出时会出现宏和保存normal.dotm

    很烦人,我又不是什么高级用户,不在乎那么多安全

    提示有两个

    1.您正试图运行的函数包含有宏或需要宏语言支持的内容。而在安装此软件时,您(或您的管理员)选择了不安装宏或宏的控件的支持功能

    2.所做更改会影响共用模板normal.dotm

    按下面操作即可,不要问我为什么,我不知道

    Word选项(I) >加载项 >转到(G) >把里面的3项内容都删除 >确定

    Word选项(I) >信任中心 > 信任中心设置 (T) >选择 “启用所有宏”和“信任对 VBA 工程对象模型的访问” > 确定

    重新启动 WORD 2010

  • iptables的DROP target

    这个内置的target使内核不继续处理这条链,也不给发送者发送任何的拒绝信息。

    只有DROP target 和 ACCEPT target 可以被用来当做内部链

    可以看REJECT target,它会给发送者发送一个ICMP回复

    禁止上某网站:

    iptables -I OUTPUT -p tcp -m string --string "jd.com" --algo bm -j DROP
    iptables -I OUTPUT -p tcp -m string --string "58.com" --algo bm -j DROP
    iptables -I OUTPUT -p tcp -m string --string "taobao.com" --algo bm -j DROP
    iptables -I OUTPUT -p tcp -m string --string "v2ex.com" --algo bm -j DROP
    iptables -I OUTPUT -p tcp -m string --string "qq.com" --algo bm -j DROP

    也可以使用reject

    iptables -I OUTPUT -p tcp -m string --string "v2ex.com" --algo bm -j REJECT

    删除一条记录

    iptables -D OUTPUT 3

    禁用 4001 端口

    /sbin/iptables -A INPUT -p tcp --destination-port 4001 -j DROP

    临时禁用到 domain.com 的访问

    iptables -A INPUT -d domain.com -j REJECT
    iptables -L -n --line-numbers
    

    如果你的机器是 NAT

  • iptables的DNAT target

    Destination Network Address Translation (DNAT)是通过修改包的目标地址和/或端口实现的。如果目标地址是多个,这些地址就会被分离。连接跟踪信息确保包的每一个地址走向同一主机和端口。

    选项

    --to-destination a1[-a2][:p1-p2]

    a1和a2标明了目标地址,p1和p2标明了端口范围。

    DNAT target只在nat表的PREROUTHING和OUTPUT链中可有

    如:从80端口进来的包传到内部监听的电脑192.168.1.80

    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.80

    注意:当使用这种DNAT时,将内外DNS区分,才可以使内网的主机使用内部地址访问外网。

     

     

  • iptables的connmark匹配和目标

    来自于

    Linux iptables Pocket Reference

    connmark Match 是基于packet’s connection mark(包连接标记)

    匹配:

    –mark value 匹配=value的连接

    目标:

    –set-mark value 设置标记为整数值
    –save-mark 保存包的标记
    –restore-mark 恢复包的标记