2020-06-15linux网络管理命令学习

[20:59:59 root@localhost data]#cat /etc/resolv.conf 
# Generated by NetworkManager
search localdomain
nameserver 192.168.70.2

/etc/nsswitch.conf文件定义了hosts文件和DNS哪个的优先级高

/etc/sysconfig/network-scripts/route-IFACE
1592229952(1).png

1592230164(1).png

修改网卡名

[21:50:20 root@localhost ~]#vim /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="spectre_v2=retpoline rhgb quiet net.ifnames=0"                                                                                                                             
GRUB_DISABLE_RECOVERY="true"

[22:21:01 root@localhost ~]#grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1062.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1062.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-d7de12f50a7e47beb32ef014fb277940
Found initrd image: /boot/initramfs-0-rescue-d7de12f50a7e47beb32ef014fb277940.img
done
[22:21:49 root@localhost ~]#grep linux16 /boot/grub2/grub.cfg 
    linux16 /vmlinuz-3.10.0-1062.el7.x86_64 root=UUID=5323ffc1-3434-41b0-b8ec-909403493a60 ro spectre_v2=retpoline rhgb quiet net.ifnames=0 
    linux16 /vmlinuz-0-rescue-d7de12f50a7e47beb32ef014fb277940 root=UUID=5323ffc1-3434-41b0-b8ec-909403493a60 ro spectre_v2=retpoline rhgb quiet net.ifnames=0 
[22:22:10 root@localhost ~]#reboot

改主机名

[root@centos6 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=centos6.localdomain
centos7:
[22:25:19 root@localhost ~]#cat /etc/hostname 
localhost.localdomain
[22:29:50 root@localhost ~]#hostnamectl set-hostname
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。