“Linux cmd”的版本间的差异
(→iptables) |
|||
(未显示同一用户的2个中间版本) | |||
第19行: | 第19行: | ||
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-remote-access-for-the-gnome-desktop-on-centos-7 | https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-remote-access-for-the-gnome-desktop-on-centos-7 | ||
sudo systemctl restart vncserver@:5.service | sudo systemctl restart vncserver@:5.service | ||
+ | === VNCServer === | ||
+ | systemctl start vncserver@:5.service | ||
+ | systemctl enable vncserver@:5.service | ||
=== FGREP === | === FGREP === | ||
第49行: | 第52行: | ||
sudo iptables -t nat -L --line-number -n | more | sudo iptables -t nat -L --line-number -n | more | ||
+ | |||
+ | |||
+ | === Destination Host Prohibited === | ||
+ | 出现这个问题原因是因为服务器上iptables配置原因造成的。 | ||
+ | |||
+ | 解决方法: | ||
+ | 检查filter表中的FORWARD链 | ||
+ | |||
+ | iptables -t filter --list | ||
+ | 看看结果中是否有这一句 | ||
+ | |||
+ | REJECT all -- anywhere anywhere reject-with icmp-host-prohibited | ||
+ | 如果有,就删除它 | ||
+ | |||
+ | iptables -L INPUT --line-numbers | ||
+ | 找到这一行的行号,我的主机上显示为11行 | ||
+ | |||
+ | 执行删除命令,删除第11行 | ||
+ | |||
+ | iptables -D INPUT 11 #-D是删除参数 | ||
+ | |||
=== debug 8190 port === | === debug 8190 port === | ||
nc -s 60.10.13.43 -v 100.1.1.1 8190 ----------向100.1.1.1 8190 模拟发包 | nc -s 60.10.13.43 -v 100.1.1.1 8190 ----------向100.1.1.1 8190 模拟发包 | ||
第68行: | 第92行: | ||
sudo firewall-cmd --permanent --add-port=37/udp | sudo firewall-cmd --permanent --add-port=37/udp | ||
sudo firewall-cmd --reload | sudo firewall-cmd --reload | ||
+ | |||
+ | === SSH login slow === | ||
+ | 1. DNS反向解析的问题 | ||
+ | |||
+ | OpenSSH在用户登录的时候会验证IP,它根据用户的IP使用反向DNS找到主机名,再使用DNS找到IP地址,最后匹配一下登录的IP是否合法。如果客户机的IP没有域名,或者DNS服务器很慢或不通,那么登录就会很花时间。 | ||
+ | |||
+ | 解决办法: | ||
+ | |||
+ | 在目标服务器上修改sshd服务器端配置,并重启sshd | ||
+ | |||
+ | vi /etc/ssh/sshd_config,设置UseDNS为no即可 |
2018年4月11日 (三) 03:16的最新版本
目录
change ip
/etc/network/interfaces sudo /etc/init.d/network-manager restart service network-manager restart
route add default gw 10.124.8.1
netstat -rn 看下路由
route del default gw
route add -net 192.168.0.0/24 gw 192.168.0.1
vnc can not copy 1.vncconfig ---real vnc 2.autocutsel -s PRIMARY -fork ----- tite vnc
vncserver config https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-remote-access-for-the-gnome-desktop-on-centos-7 sudo systemctl restart vncserver@:5.service
VNCServer
systemctl start vncserver@:5.service systemctl enable vncserver@:5.service
FGREP
fgrep -R "RPD RPD" *
SED
sed -i 's/60.10.13.61/60.10.13.66/g' /etc/dhcp/dhcpd.conf
awk
sudo virsh list | grep running | grep -v grep | awk '{print $2}' ---- awk 将第二列输出
awk '{print $2}' | sudo xargs kill -9 ----- xargs 将管道输出作为参数传入
netstat
netstat -tulpn
iptables
iptables -L -n -t nat
./iptables.sh 172.25.13.51 192.168.125.195 sudo iptables -t nat -I PREROUTING -p tcp -d 10.74.54.210 --dport 8190 -j DNAT --to-destination 60.10.13.215:8190 delete ip table all sudo iptables -F -t nat
[root@smartphy-deployment install]# iptables -P INPUT ACCEPT [root@smartphy-deployment install]# iptables -P FORWARD ACCEPT [root@smartphy-deployment install]# iptables -t nat -A POSTROUTING -s 192.168.125.0/24 -o ens192 -j MASQUERADE -------------源地址转换
sudo iptables -I FORWARD -m state -d 192.168.125.0/24 --state NEW,RELATED,ESTABLISHED -j ACCEPT 转发包 sudo iptables -t nat -I PREROUTING -p tcp -d $1 --dport 8190 -j DNAT --to-destination $2:8190--------目的地址转换 删除nat某一条 sudo iptables -t nat -D PREROUTING 6
sudo iptables -t nat -L --line-number -n | more
Destination Host Prohibited
出现这个问题原因是因为服务器上iptables配置原因造成的。
解决方法: 检查filter表中的FORWARD链
iptables -t filter --list 看看结果中是否有这一句
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited 如果有,就删除它
iptables -L INPUT --line-numbers 找到这一行的行号,我的主机上显示为11行
执行删除命令,删除第11行
iptables -D INPUT 11 #-D是删除参数
debug 8190 port
nc -s 60.10.13.43 -v 100.1.1.1 8190 ----------向100.1.1.1 8190 模拟发包 sudo tcpdump -i enp4s0f1.608 -n port 8190
no ip route 60.10.13.60 255.255.255.255
Fireware
telnet 10.74.54.208 37 |hexdump 0000000 7254 6979 676e 3120 2e30 3437 352e 2e34 0000010 3032 2e38 2e2e 0a0d 6f43 6e6e 6365 6574 0000020 2064 6f74 3120 2e30 3437 352e 2e34 3032 0000030 2e38 0a0d 7345 6163 6570 6320 6168 6172 0000040 7463 7265 6920 2073 5e27 275d 0d2e dd0a Connection closed by foreign host. 0000050 1f22 003a 0000053
sudo firewall-cmd --permanent --add-port=37/tcp sudo firewall-cmd --permanent --add-port=37/udp sudo firewall-cmd --reload
SSH login slow
1. DNS反向解析的问题
OpenSSH在用户登录的时候会验证IP,它根据用户的IP使用反向DNS找到主机名,再使用DNS找到IP地址,最后匹配一下登录的IP是否合法。如果客户机的IP没有域名,或者DNS服务器很慢或不通,那么登录就会很花时间。
解决办法:
在目标服务器上修改sshd服务器端配置,并重启sshd
vi /etc/ssh/sshd_config,设置UseDNS为no即可