Linux cmd

来自qingwei personal wiki
Yuanliu2讨论 | 贡献2018年1月15日 (一) 07:32的版本
跳转至: 导航搜索

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

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

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