“Linux cmd”的版本间的差异

来自qingwei personal wiki
跳转至: 导航搜索
(创建页面,内容为“ === 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…”)
 
第28行: 第28行:
 
=== awk ===
 
=== awk ===
 
sudo virsh list | grep running | grep -v grep | awk '{print $2}'  ---- 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
  
  awk '{print $2}' | sudo xargs kill -9 ----- xargs 将管道输出作为参数传入
+
[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

2018年1月15日 (一) 07:30的版本

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