容易忘记的命令

查看虚拟机端口号:  hostname -I

ifconfig查看当前活着的网络接口信息

[root@localhost ~]#ifconfig ens33 down    #关闭网卡
[root@localhost ~]#ifconfig ens33 up        #开启网卡
[root@localhost ~]#ifconfig ens36:0 192.168.10.200    #设置临时虚拟网卡
[root@localhost ~]#ifconfig -s            #网络通讯情况

ip address修改IP地址

[root@feizirui ~]#ip address add 192.168.10.100/24 dev ens33
[root@feizirui ~]#ip address del 192.168.10.10/24 dev ens33

永久配置网络相关配置文件

[root@localhost ~]#vim /etc/sysconfig/network-scripts/ifcfg-ens33 

BOOTPROTO=static    ##获取地址静态方式
ONBOOT=yes        ##开机自启
IPADDR=192.168.10.10    ##IP地址
NETMASK=255.255.255.0    ##子网掩码
GATEWAY=192.168.10.2    ##网关
DNS1=8.8.8.8        ##DNS1:谷歌的
DNS2=114.114.114.114    ##DNS2:三大运营商

[root@localhost ~]#systemctl restart network    ##重启网卡
[root@localhost ~]#ping www.baidu.com -c4

关于themleft  运算符 : ${a + b}

posted @ 2022-10-22 01:17  鸽宗  阅读(25)  评论(0)    收藏  举报