内容一:导出 iptables 防火墙规则
# iptables-save > /root/iptables_save
(补充:这里以将 iptables 防火墙规则导出到 /root/iptables_save 文件为例)
内容二:导入 iptables 防火墙规则
# iptables-restore < /root/iptables_save
(补充:这里以将 /root/iptables_save 文件里的内容导入到 iptables 防火墙为例)
# iptables-save > /root/iptables_save
(补充:这里以将 iptables 防火墙规则导出到 /root/iptables_save 文件为例)
# iptables-restore < /root/iptables_save
(补充:这里以将 /root/iptables_save 文件里的内容导入到 iptables 防火墙为例)
# snmpwalk -v3 -u siemens -l authNoPriv -a MD5 -x DES -A '<user>' -X '<password>' localhost
# tcpdump <option> <proto> <dir> <type>
1) -A use ASCII print all data, it is convenient for read website date.
2) -c <number>, number of packet captures
3) -C <file size>,size of file
4) -e, display data link layer
5) -G <second>, create a new file after these seconds
6) -l, send the output to next command, example: tcpdump -i eth0 -s0 | grep 'Server:'
7) -n, do not resolve domain only display IP address
8) -nn, do not resolve domain and port only display IP address
9) -i <interface>, such as internet card and can use: -i any
10) -p, only display the data which point it self
11) -r <file>, read data from file
12) -s <snaplen>, size of length of the network package and can use: -s 0 to ulimite the length, the default value is 96B
13) -v , display detail
14) -vv, display detail more than -v
15) -vvv, display detail more than -vv
16) -w <file>, write the output result into a file
17) -W <number>, how many files will output result into
1) tcp or proto 6
2) udp or proto 17
3) icmp, example: proto \\icmp is icmp
4) ip
5) ip6
6) arp
7) rarp
8) ether
9) wlan
1) src
2) dst
1) host <IP address>
2) net <network segment>, example: 10 is 10.x.x.x/8 , 192.168.0 is 192.168.0.0/24
3) port <port>
4) portrange <port range>
1) and or &&
2) or or ||
3) not or !
# tcpdump -i any dst 192.168.0.1 and udp port 514
(补充:这里以显示发送到 IP 地址 192.168.0.1 的 UDP 514 端口为例,如果有这类网络数据包的话则详细信息会在命令输出后显示出来)
# tcpdump -vv src host 192.168.0.1
(补充:这里以显示从 IP 地址 192.168.0.1 发送来的网络数据包为例,如果有这类网络数据包的话则详细信息会在命令输出后显示出来)
# tcpdump -i any -w /tmp/telnet.cap
(补充:这里以将所有抓到的数据包导出到文件 /tmp/telnet.cap 为例)
# tcpdump -i eth0 -s 0 -w /tmp/$(hostname)-$(date +"%Y-%m-%d-%H-%M-%S").pcap host 192.168.1.1 or host 192.168.1.2
(补充:这里以将网卡 eth0 网卡上抓到的来源或目的是 192.168.1.1 或 192.168.1.2 的数据包导出到文件 /tmp/$(hostname)-$(date +”%Y-%m-%d-%H-%M-%S”).pcap 为例)
94.140.14.14
94.140.14.15
94.140.15.15
94.140.15.16
1.0.0.1
1.0.0.2
1.0.0.3
1.1.1.1
1.1.1.2
1.1.1.3
8.20.247.20
8.26.56.26
84.200.69.80
84.200.70.40
216.146.35.35
216.146.36.36
209.244.0.3
209.244.0.4
156.154.70.1
156.154.71.1
37.235.1.174
37.235.1.177
8.8.4.4
8.8.8.8
208.67.220.220
208.67.222.222
195.46.39.39
195.46.39.40
199.85.126.10
199.85.137.10
ssh 远程某台服务器时很慢,但是 ping 时延迟却很低。这可能是 DNS 解析出现问题造成的,禁用服务器上 sshd 的 GSSAPIAuthentication 参数和 UseDNS 参数可以解决,这两个参数的作用是:
1) GSSAPIAuthentication,当服务器的 sshd 服务此参数处于开启状态时,客户端 SSH 登录此服务器时,客户端会对服务器的 IP 地址进行 PTR 反解析,获得服务器的域名,再通过服务器的域名对服务器进行 DNS A 正向 IP 地址解析,通过此方法来防止欺骗。
2) UseDNS,当服务器的 sshd 服务此参数处于开启状态时,客户端 SSH 登录此服务器时,服务器会对客户端的 IP 地址进行反解析,获得客户端的域名,再通过客户端的域名对客户端进行 DNS A 正向 IP 地址解析,通过此方法来防止欺骗。
# vim /etc/ssh/sshd_conf
将以下内容:
......
UseDNS yes
......
GSSAPIAuthentication yes
......
修改为:
......
UseDNS no
......
GSSAPIAuthentication no
......
# systemctl restart sshd
# systemctl restart dbus
# systemctl restart systemd-logind
(注意:如果不重启 dbus 直接重启 systemd-logind 则可能会报错)