nmcli device (设备) status 显示设备和会话链接状态
show 显示设备的详细信息
[root@localhost ~]# nmcli device connect ens224 将指定设备和会话进行链接
disconnect
nmcli connection (会话) modify ens160会话文件 ipv4.method(网络模式) auto (动态)
manual (静态模式)
connection.autoconnect(开机网卡是否自动连接) yes
ipv4.addresses
ipv4.dns
ipv4.gateway
案例一:当前主机配置静态IP地址 ----修改网卡会话文件
[root@localhost ~]#nmcli connection modify ens160 ipv4.addresses 192.168.220.111/24 ipv4.gateway 192.168.220.2 ipv4.dns 114.114.114.114 ipv4.method manual connection.autoconnect
[root@localhost ~]# nmcli connection up ens160
案例二:当前主机配置静态IP地址---添加网卡会话文件
802-3-ethernet bridge-slave infiniband ovs-interface vlan wireguard
adsl cdma ip-tunnel ovs-port wpan
bluetooth dummy macsec pppoe vxlan
[root@localhost ~]# nmcli connection add type ethernet ifname ens160 con-name work
Connection 'work' (bd1d5cf2-9a4a-45d5-be73-3f3623222eba) successfully added.
[root@localhost ~]# nmcli connection show
NAME UUID TYPE DEVICE
ens224 149097f9-e90e-4d96-b5b0-d88bbfe57d4d ethernet ens224
ens160 abd652c2-4e0f-48e6-965e-c5e1bbcac1c1 ethernet ens160
work bd1d5cf2-9a4a-45d5-be73-3f3623222eba ethernet --
[root@localhost ~]# nmcli connection modify work ipv4.addresses 192.168.220.123/24 ipv4.gateway 192.168.220.2 ipv4.dns 114.114.114.114 ipv4.method manual connection.autoconnect yes
[root@localhost ~]# nmcli connection up work
案例三:当前主机配置动态IP地址---edit进入编辑
[root@localhost ~]# nmcli connection edit work
===| nmcli interactive connection editor |===
Editing existing '802-3-ethernet' connection: 'work'
Type 'help' or '?' for available commands.
Type 'print' to show all the connection properties.
Type 'describe [
You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, dcb, sriov, ethtool, match, ipv4, ipv6, tc, proxy
nmcli> goto ipv4
You may edit the following properties: method, dns, dns-search, dns-options, dns-priority, addresses, gateway, routes, route-metric, route-table, routing-rules, ignore-auto-routes, ignore-auto-dns, dhcp-client-id, dhcp-iaid, dhcp-timeout, dhcp-send-hostname, dhcp-hostname, dhcp-fqdn, dhcp-hostname-flags, never-default, may-fail, dad-timeout
nmcli ipv4> set ipv4.method auto
nmcli ipv4>remove addresses
nmcli ipv4>remove gateway
nmcli ipv4> remove dns
nmcli ipv4> save
Connection 'work' (bd1d5cf2-9a4a-45d5-be73-3f3623222eba) successfully updated.
nmcli ipv4> quit
[root@localhost ~]# nmcli connection up work
案例四:nmtui
案例五:nm-connection-editor
案例六: vim /etc/sysconfig/network-scripts/ifcfg-ens160
BOOTPROTO=none
ONBOOT=yes
IPADDR0=192.168.220.100
IPADDR1=192.168.220.111
PREFIX=24
GATEWAY=192.168.220.2
DNS=114.114.114.114
#systemctl restart network
本地获取 ---本地光盘文件
1.mount /dev/sr0 /mnt
2.cd /mnt/AppStream/Packages
3.rpm -ivh 包名
rpm -evh 软件名
-ql 查询软件释放文件列表
-qf 查看某个文件由拿个包释放
-qa
-Uvh
-qpi
yum/dnf 可以自动解决依赖关系,并且一次性下载并安装依赖包
本地源
配置yumc仓库文件(yum配置文件)------
Vim /etc/yum.repos.d/base.repo --注意:后缀必须是.repo
[BaseOS] ---源标识名称
name=RHEL-rpm --源名称
baseurl=file:///mnt/BaseOS --资源定位符
gpgcheck=0 --公私钥验证 0关闭 1开启
[AppStream]
name=RHEL-rpm
baserul=file:///mnt/AppStream
gpgcheck=0
网络源
Vim /etc/yum.repos.d/base.repo
[Centos8-App]
name=Centos8
baseurl=http://mirrors.163.com/centos/8/AppStream/x8664/os/
gpgcheck=0
[Centos8-Base]
name=Centos8
baseurl=http://mirrors.163.com/centos/8/BaseOS/x8664/os/
gpgcheck=0
dnf install 软件名
remove 软件名 ==erase
clean all 更改yum配置文件清除源缓存
makecache