首页 > 其他分享 >随笔

随笔

时间:2022-12-12 13:34:31浏览次数:42  
标签:name nmcli controller2 etc 随笔 root con

逻辑卷uuid查询

[root@controller2 ~]# vgs -o name --noheadings
cl
[root@controller2 ~]# vgs -o name,uuid --noheadings
cl 0TXkYz-gw09-rgwb-Oj5Z-V4rM-zz2u-E90iMl
[root@controller2 ~]# vgs -o name,uuid
VG VG UUID
cl 0TXkYz-gw09-rgwb-Oj5Z-V4rM-zz2u-E90iMl
[root@controller2 ~]# lvs -o name,uuid
LV LV UUID
home g73qwR-6rJR-T0lA-lelz-pl2n-AR3a-xH7Prh
root 5lEabG-Yc8o-AJX8-bjix-O5cI-xEdY-pCu2H0
swap KvM6Dn-Hdf0-OUc8-5EZC-2tjH-SjGq-OHlb7P
[root@controller2 ~]# pvs -o name,uuid
PV PV UUID
/dev/sda3 jWMe7W-BnA6-Yw6O-7Pza-9hPP-v350-W4gt05
[root@controller2 ~]#

 

新安装的系统初始化(清空yum文件,清空log,清空tmp;清理root目录;刷新dns,刷新网卡mac地址对应关系,刷新远程记录)

{
find /etc/yum.repos.d /var/lib/dhclient /var/log /tmp -type f
find /root \( -name .bash_history -o -name authorized_keys -o -name anaconda-ks.cfg \)
find /etc \( -name resolv.conf -o -name 70-persistent-net.rules -o -name "ssh_host_*" \)
} | xargs rm -f
touch /var/log/wtmp

 

redhat系列-linux改系统标识

echo 'Santia-god test_8.5 OS' > /etc/issue
ls /etc/*-release|egrep -v '/etc/system-release|/etc/os-release'|xargs rm -rf
sed -i 's/CentOS/Santia-god/g' /etc/{system,os}-release

 

rc.local只执行一次(删除ks文件,开机改ip)

### rc.local
cat <<'EOF' >> /etc/rc.d/rc.local
#START#
find /root -type f -name \*-ks.cfg -exec rm -f {} \;
find /tmp  -type f -name ks-\*     -exec rm -f {} \;
find /var/log \( -name anaconda -o -name installer.log \) -exec rm -rf {} \;

### Network
nmcli -g UUID con | xargs -I{} nmcli con down {}
nmcli -g UUID con | xargs -I{} nmcli con del {}
IF2=$(nmcli -g DEVICE dev | grep -v lo | head -1)
if [ -n "$IF2" ]; then
    nmcli con add type ethernet ifname $IF2 con-name $IF2
    nmcli con mod $IF2 ipv4.method manual ipv4.addr 192.168.1.10/24
    nmcli con mod $IF2 ipv4.gateway 192.168.1.1 autoconnect yes
    nmcli con reload
    nmcli con up $IF2
fi


IF3=$(nmcli -g DEVICE dev | grep -v lo | tail -n +2 | head -1)
if [ -n "$IF3" ]; then
    nmcli con add type ethernet ifname $IF3 con-name $IF3
    nmcli con mod $IF3 ipv4.method manual ipv4.addr 10.10.1.10/24 autoconnect yes
    nmcli con reload
    nmcli con up $IF3
fi
 
chmod -x /etc/rc.d/rc.local
sed -i '/^#START#$/,/^#END#$/d' /etc/rc.d/rc.local
#END#
EOF
chmod +x /etc/rc.d/rc.local

 

系统调优

### Kernel Tuning
cat > /etc/sysctl.d/98-thesys.conf <<-\EOF_SYSCTL
kernel.sem = 4010 641600 4010 1024
fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65501
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 1048576
net.core.wmem_max = 1048576
vm.swappiness = 0    #禁用swap交换空间
vm.dirty_background_bytes=102400000
vm.dirty_bytes=409600000
vm.min_free_kbytes=512000
kernel.pid_max = 4194303
EOF_SYSCTL

cat > /etc/security/limits.d/20-nofile.conf <<-\EOF_LIMITS
*       soft    nproc   131072
*       hard    nproc   131072
*       soft    nofile  131072
*       hard    nofile  131072
EOF_LIMITS

 

 

nmcli抓取网卡uuid

[root@controller2 ~]# nmcli c s
NAME UUID TYPE DEVICE
ens192 a5da65b0-5136-416a-9bdd-55db0ce94ef6 ethernet ens192
ens224 8e8f76cc-1f83-4071-881b-5ed665d14895 ethernet --
[root@controller2 ~]# nmcli -g UUID con
a5da65b0-5136-416a-9bdd-55db0ce94ef6
8e8f76cc-1f83-4071-881b-5ed665d14895
[root@controller2 ~]# nmcli -g NAME,UUID con
ens192:a5da65b0-5136-416a-9bdd-55db0ce94ef6
ens224:8e8f76cc-1f83-4071-881b-5ed665d14895
[root@controller2 ~]#

 

标签:name,nmcli,controller2,etc,随笔,root,con
From: https://www.cnblogs.com/santia-god/p/16975799.html

相关文章