linux 常用操作

Ubuntu22.04 server 

创建随操作系统自动启动:

创建rc-local.service

   cp /lib/systemd/system/rc.-local.service /etc/systemd/system/ 

修改 :/etc/systemd/system/rc-local.service

在最后新增: 

[Install]
WantedBy=multi-user.target
Alias=rc-local.service

 创建/etc/rc.local

在里面写入要执行的命令保存,然后增加执行权限,如

#!/bin/bash
echo "aa" >> aa.log

 chmod +x /etc/rc.local 

调整时区:

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

 路由:

root@node03:~# cat /etc/netplan/00-installer-config.yaml 
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens33:
      dhcp4: false
      addresses: [192.168.3.113/24]
      nameservers:
        addresses: [192.168.3.1]
      routes:
      - to: default
        via: 192.168.3.1
  ethernets:
    ens37:
      dhcp4: false
      addresses: [10.0.1.113/24]
      routes:
      - to: 10.0.0.0/16
        via: 10.0.1.1
  version: 2

tcpdump

抓取ICMP报文:tcpdump -nn -i  ens37 icmp

#并发测试工具 hey

/usr/bin/hey -z 60s -c 20 -host "hello-world.myland.com" "http://10.0.8.119:8099?sleep=100&prime=10000&bloat=5"

 

Centos:

永久路由:

[root@centos7 ~]# vim /etc/sysconfig/network-scripts/route-eth0
10.15.150.0/24 via 10.10.10.1 dev eth0
10.25.250.0/24 via 10.10.10.1 dev eth0

systemctl restart network

然后重启网络

 

posted @ 2022-09-13 14:28  西风发财  阅读(24)  评论(0编辑  收藏  举报