此文章以红帽Linux9版本为例进讲解。

红帽Linux9版本的网路管理非常全面,可在多处进行网路配置的更改,但须要注意的是,在9版本内,用户可在配置文件内进行网路配置的更改,但系统不会执行更改的命令,而在9之前的版本可执行。

VMware虚拟机上的三种网路联接形式

桥接模式:

通过虚拟集线器将主机上的网卡与虚拟网卡Vmnet0相联接,桥接模式下虚拟机的网卡都与虚拟交换机Vmnet0相联接,当虚拟机想要上网时linux系统与网络管理linux系统好用吗,需将虚拟机IP地址,子网网段,网段等配置与主机网卡相同。

NAT模式:

通过虚拟集线器将主机上的网卡与虚拟网卡Vmnet8相联接,NAT模式下虚拟机的DHCP服务器联接在Vmnet8虚拟交换机上,须要注意的是,虚拟网卡Vmnet8只是作为主机与虚拟机通讯的插口,虚拟机最终还是借助主机网卡进行联网。

Host-Only模式:

通过虚拟网卡Vmnet1与虚拟交换机Vmnet1相联接,进而实现虚拟机通讯,当虚拟机须要进行联网时,将主机联网的网卡共享给虚拟网卡Vmnet1,实现虚拟机联网。

NetworkManager的特征

NetworkManager是2004年RedHat启动的项目,借以才能让Linux用户更轻松地处理现代网路需求,能手动发觉网卡并配置ip地址。

NetworkManager的特征

NM能管理各类网路:

有线网卡、无线网卡

动态ip、静态ip

以太网、非以太网

化学网卡、虚拟网卡

工具齐全:

命令行、文本界面、图形界面、web

招纳天地:

管理各类网路,有线、无线、物理、虚拟

参数丰富:

多达200多项配置参数(包括ethtool参数)

一统江湖:

RedHat系、Suse系、Debian/Ubuntu系,均支持

linux系统与网络管理_网络管理系统admin_网络管理系统入口

大势所趋:

从红帽Linux9版本开始,只能通过NM管理网路

一、配置网路

网路插口是指网路中的计算机或网路设备与其他设备实现通信的进出口。这儿,主要是指计算机的网路插口即网卡设备。

从红帽Linux7版本开始引入了一种新的“一致网路设备命名”的形式为网路插口命名,该方法可以依据固件、设备拓扑、设备类型和位置信息分配固定的名子。网路插口的名称的前两个字符为网路类型符号。

网路类型符号:

en:表示以太网(Ethernet)

wl:表示无线局域网(wlan)

ww:表示无线广域网(wwan)

依据设备类型或位置选择符号:

o:表示外置(onboard)于显卡上的集成设备(即集成网卡)及索顿号;

s:表示是插在可以热插拔的插孔上的独立设备及索顿号;

x:表示基于MAC地址命名的设备;p——表示PCI插孔的数学位置及编号。

须要注意的是:

一个网路插口,可以有多个网路联接,但同一时间只能有一个网路联接处于活动状态。

一、修改配置文件(不推荐)

前提:

须要有network服务

步入配置文件

vim/etc/NetworkManager/system-connections/ens160.nmconnection

在配置文件内进行相应内容的编撰

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># vim /etc/NetworkManager/system-connections/ens160.nmconnection </span>
<span class="token punctuation">[</span>connection<span class="token punctuation">]</span>
<span class="token assign-left variable">id</span><span class="token operator">=</span>ens160
<span class="token assign-left variable">uuid</span><span class="token operator">=</span>63a4d8e6-5b83-3145-b9d8-81ac17ac17cc
<span class="token assign-left variable">type</span><span class="token operator">=</span>ethernet
autoconnect-priority<span class="token operator">=</span>-999
interface-name<span class="token operator">=</span>ens160
<span class="token assign-left variable">timestamp</span><span class="token operator">=</span><span class="token number">1708402421</span>
<span class="token punctuation">[</span>ethernet<span class="token punctuation">]</span>
<span class="token punctuation">[</span>ipv4<span class="token punctuation">]</span>
<span class="token assign-left variable">address1</span><span class="token operator">=</span><span class="token number">192.168</span>.218.4/24,192.168.218.2
<span class="token assign-left variable">dns</span><span class="token operator">=</span><span class="token number">223.5</span>.5.5<span class="token punctuation">;</span>
<span class="token assign-left variable">method</span><span class="token operator">=</span>manual
<span class="token punctuation">[</span>ipv6<span class="token punctuation">]</span>
addr-gen-mode<span class="token operator">=</span>eui64
<span class="token assign-left variable">method</span><span class="token operator">=</span>auto
<span class="token punctuation">[</span>proxy<span class="token punctuation">]</span>

登录后复制

二、使用IP命令配置临时生效的网路联接查看网卡在网路层的配置信息,加-s表示平添显示相关统计信息,如接收(RX)及传送(TX)的数据包数目等

ip[-s]addrshow[网卡设备名]

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># ip addr show ens160</span>
<span class="token number">2</span>: ens160: <span class="token operator"><</span>BROADCAST,MULTICAST,UP,LOWER_UP<span class="token operator">></span> mtu <span class="token number">1500</span> qdisc mq state UP group default qlen <span class="token number">1000</span>
link/ether 00:0c:29:57:78:25 brd ff:ff:ff:ff:ff:ff
altname enp3s0
inet <span class="token number">192.168</span>.218.4/24 brd <span class="token number">192.168</span>.218.255 scope global noprefixroute ens160
 valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe57:7825/64 scope <span class="token function">link</span> noprefixroute 
 valid_lft forever preferred_lft forever

登录后复制

查看网卡在数据链路层的配置信息

ip[-s]linkshow[网卡设备名]

linux系统与网络管理_网络管理系统入口_网络管理系统admin

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># ip link show ens160</span>
<span class="token number">2</span>: ens160: <span class="token operator"><</span>BROADCAST,MULTICAST,UP,LOWER_UP<span class="token operator">></span> mtu <span class="token number">1500</span> qdisc mq state UP mode DEFAULT group default qlen <span class="token number">1000</span>
link/ether 00:0c:29:57:78:25 brd ff:ff:ff:ff:ff:ff
altname enp3s0

登录后复制

添加或删掉网卡的临时IPv4地址;添加或删掉网卡的临时IPv6地址

ip[-4]addradd|delIP地址[/网段宽度]dev网卡联接名

ip-6addradd|delIP地址[/网段宽度]dev网卡联接名

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># ip addr add 192.168.218.5/24 dev ens160</span>
<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># ip a</span>
inet <span class="token number">192.168</span>.218.4/24 brd <span class="token number">192.168</span>.218.255 scope global noprefixroute ens160
 valid_lft forever preferred_lft forever
inet <span class="token number">192.168</span>.218.5/24 scope global secondary ens160
 valid_lft forever preferred_lft forever

登录后复制

禁用|启用指定网卡

iplinksetdev网卡的设备名down|up

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># ip link set dev ens160 up</span>

登录后复制

三、nmcli命令(命令行工具)

命令界面输入“nmcli”,按下”Tab”键,输出相匹配的后续命令,输入相匹配的命令后,按下”Tab”键继续输出相匹配的后续命令。

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># nmcli </span>
agent connectiondevicegeneral <span class="token builtin class-name">help</span>monitor networkingradio
<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># nmcli connection </span>
<span class="token function">add</span>delete edit <span class="token builtin class-name">help</span> load modify reload up 
clonedown <span class="token builtin class-name">export</span> <span class="token function">import</span> migratemonitorshow

登录后复制

查看网卡设备

nmclidevice

缩写:nmclid

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># nmcli device</span>
DEVICETYPESTATECONNECTION 
ens160ethernetconnectedens160 
loloopbackunmanaged-- 

登录后复制

nmclideviceshow

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># nmcli device show </span>
GENERAL.DEVICE: ens160
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 00:0C:29:57:78:25
GENERAL.MTU:<span class="token number">1500</span>
GENERAL.STATE:<span class="token number">100</span> <span class="token punctuation">(</span>connected<span class="token punctuation">)</span>

登录后复制

connected:已被NM管理,但是当前有活跃的connection

disconnected:已被NM管理,并且当前没有活跃的connection

unmanaged:未被NM管理

unavailable:不可用,NM难以管理,一般出现于网卡为down的时侯

查看网卡相应的会话

nmcliconnection

缩写:nmclic

nmclicshow

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># nmcli connection </span>
NAMEUUIDTYPEDEVICE 
ens16063a4d8e6-5b83-3145-b9d8-81ac17ac17ccethernetens160 

登录后复制

配置已存在会话的网卡的IP地址

非交互式:

nmclicmodify……)—-非交互式的相关配置

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># nmcli connection modify ens160 ipv4.method manual ipv4.addresses 192.168.218.5/24ipv4.gateway 192.168.218.2ipv4.dns 223.5.5.5autoconnectyes</span>
<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># nmcli c up ens160(重启网卡设备)</span>

登录后复制

交互式:

nmclicedit……)—-交互式的相关配置

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># nmcli connection edit ens160</span>
nmcli<span class="token operator">></span> goto ipv4
nmcli ipv<span class="token operator"><span class="token file-descriptor important">4</span>></span> <span class="token builtin class-name">set</span> addresses <span class="token number">192.168</span>.168.11/24
nmcli ipv<span class="token operator"><span class="token file-descriptor important">4</span>></span> activate<span class="token punctuation">(</span>激活<span class="token punctuation">)</span>
nmcli ipv<span class="token operator"><span class="token file-descriptor important">4</span>></span> quit
<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># nmcli c up ens160</span>

登录后复制

添加新的会话

nmclicaddtypeethernetcon-name会话名称ifname网卡设备ipv4.addressesIP地址ipv4.gateway网段ipv4.dnsdns服务器ipv4.methodmanualautoconnectyes

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># nmcli c add type ethernet con-name 1 ifname ens160 ipv4.addresses 192.168.218.11/24 ipv4.gateway 192.168.218.2 ipv4.dns 223.5.5.5 ipv4.method manual autoconnect yes</span>
Connection <span class="token string">'1'</span> <span class="token punctuation">(</span>635585a9-aed8-4327-9bf8-7fbf1565036b<span class="token punctuation">)</span> successfully added.(会话建立成功)
<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># nmcli c show</span>
NAMEUUIDTYPEDEVICE 
ens16063a4d8e6-5b83-3145-b9d8-81ac17ac17ccethernetens160 
<span class="token number">1</span> 635585a9-aed8-4327-9bf8-7fbf1565036bethernet--

登录后复制

联接、断开、删除会话

联接会话

[root@tym~]#nmclicup网卡设备

断掉会话

[root@tym~]#nmclicdown网卡设备

删掉会话

[root@tym~]#nmclicdelete网卡设备

四、nmtui(图形界面工具)

nmtui(命令行回车后linux系统与网络管理,步入图形化界面)

命令回车后步入的第一页面如右图。

在这里插入图片描述

使用按键上的上下左右键可进行不同选项的选择,选项的涵义如下:

Edit a connection ----编辑一个网络连接,即可创建或修改一个网络连接
Activate a connection ----激活一个网络连接
Set system <span class="token function">hostname</span> ----设置系统的主机名

登录后复制

步入选项“Editaconnection”,创建一个新的网路联接。

在这里插入图片描述

步入选项后,我们使用鼠标左右键联通光标,选中“Add”选项,创建一个新的网路联接

在这里插入图片描述

步入“Add”选项后,我们选择“Ethernet”选项

网络管理系统入口_网络管理系统admin_linux系统与网络管理

在这里插入图片描述

选择完成网路类型后,回车步入如下页面

在这里插入图片描述

在此页面,使用上下键联通光标,我们须要将IPv4的配置模式修改为自动模式,并在虚拟机相对应的网路联接模式(桥接模式、NAT模式、Host-Only模式)下进行相应的IP地址、网关、DNS服务器等配置

在这里插入图片描述

配置完成后,使用上下键将光标联通至最下方,并选中“OK”,之后回车

在这里插入图片描述

步入选项“Activateaconnection”,激活创建的网路联接。

在这里插入图片描述

使用上下左右键选中创建的新网路联接,并将光标联通至“Deactivate”处,进行回车,如网路联接前显示“*”号,则代表该联接已激活

在这里插入图片描述

最后,回到最初的页面,选中“Quit”,并联通光标至“OK”,之后回车,完成新网路联接的创建和激活。

网络管理系统admin_linux系统与网络管理_网络管理系统入口

二、网络测试命令一、ping命令

用于测试网路的连贯性

命令格式为:

ping[选项]

选项:

<span class="token parameter variable">-c</span> 数字:用于设定本命令发出的ICMP消息包的数量,若无此选项,则会无限次发送消息包直到 用户按【Ctrl+C】组合键才终止命令。
<span class="token parameter variable">-s</span> 字节数:设置ping命令发出的消息包的大小,默认发送的测试数据大小为56字节;自动添加8字节的ICMP协议头后,显示的是64字节;再添加20字节的IP协议头,则显示的为84字节。最大设置值为65507B。
<span class="token parameter variable">-i</span> 时间间隔:设定前后两次发送ICMP消息包之间的时间间隔,无此选项时,默认时间间隔为1 秒。为了保障本机和目标主机的安全,一般不要小于0.2秒。
<span class="token parameter variable">-t</span> :设置存活时间TTL<span class="token punctuation">(</span>Time To Live<span class="token punctuation">)</span>

登录后复制

使用疗效如下:

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># ping -c 2 www.baidu.com</span>
PING www.a.shifen.com <span class="token punctuation">(</span><span class="token number">120.232</span>.145.185<span class="token punctuation">)</span> <span class="token number">56</span><span class="token punctuation">(</span><span class="token number">84</span><span class="token punctuation">)</span> bytes of data.
<span class="token number">64</span> bytes from <span class="token number">120.232</span>.145.185 <span class="token punctuation">(</span><span class="token number">120.232</span>.145.185<span class="token punctuation">)</span>: <span class="token assign-left variable">icmp_seq</span><span class="token operator">=</span><span class="token number">1</span> <span class="token assign-left variable">ttl</span><span class="token operator">=</span><span class="token number">128</span> <span class="token assign-left variable">time</span><span class="token operator">=</span><span class="token number">35.1</span> ms
<span class="token number">64</span> bytes from <span class="token number">120.232</span>.145.185 <span class="token punctuation">(</span><span class="token number">120.232</span>.145.185<span class="token punctuation">)</span>: <span class="token assign-left variable">icmp_seq</span><span class="token operator">=</span><span class="token number">2</span> <span class="token assign-left variable">ttl</span><span class="token operator">=</span><span class="token number">128</span> <span class="token assign-left variable">time</span><span class="token operator">=</span><span class="token number">36.1</span> ms
--- www.a.shifen.com <span class="token function">ping</span> statistics ---
<span class="token number">2</span> packets transmitted, <span class="token number">2</span> received, <span class="token number">0</span>% packet loss, <span class="token function">time</span> 1002ms
rtt min/avg/max/mdev <span class="token operator">=</span> <span class="token number">35.093</span>/35.573/36.053/0.480 ms

登录后复制

二、tracepath命令

用于追踪并显示报文抵达目的主机所经过的路由信息

命令格式为:

tracepath[选项]

常用选项:

<span class="token parameter variable">-n</span> :对沿途各主机节点,,仅仅获取并输出IP地址,不在每个IP 地址的节点设备上通过DNS查找其主机名,以此来加快测试速度。
<span class="token parameter variable">-b</span> :对沿途各主机节点同时显示IP地址和主机名。
<span class="token parameter variable">-l</span> 包长度:设置初始的数据包的大小。
<span class="token parameter variable">-p</span> 端口号:设置UDP传输协议的端口<span class="token punctuation">(</span>缺省为33434<span class="token punctuation">)</span>。

登录后复制

网络管理系统admin_网络管理系统入口_linux系统与网络管理

使用疗效如下:

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># tracepath -b www.baidu.com</span>
 <span class="token number">1</span>?: <span class="token punctuation">[</span>LOCALHOST<span class="token punctuation">]</span>pmtu <span class="token number">1500</span>
 <span class="token number">1</span>:_gateway <span class="token punctuation">(</span><span class="token number">192.168</span>.218.2<span class="token punctuation">)</span><span class="token number">0</span>.198ms 
 <span class="token number">1</span>:_gateway <span class="token punctuation">(</span><span class="token number">192.168</span>.218.2<span class="token punctuation">)</span><span class="token number">0</span>.337ms 
 <span class="token number">2</span>:no reply

登录后复制

三、traceroute命令(Windows系统下是tracert)

该命令借助ICMP合同定位计算机和目标计算机之间的所有路由器,追踪数据包在网路上传输时的全部路径linux系统教程,它默认发送的数据包大小是40字节

命令格式为:

traceroute[选项]

常用选项:

<span class="token parameter variable">-I</span> :使用ICMP协议

登录后复制

三、通过域名来访问主机一、配置静态解析,通过/etc/hosts文件实现域名解析

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># cat /etc/hosts</span>
<span class="token number">127.0</span>.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
<span class="token number">192.168</span>.218.4 tym
<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># ping tym</span>
PING tym <span class="token punctuation">(</span><span class="token number">192.168</span>.218.4<span class="token punctuation">)</span> <span class="token number">56</span><span class="token punctuation">(</span><span class="token number">84</span><span class="token punctuation">)</span> bytes of data.
<span class="token number">64</span> bytes from tym <span class="token punctuation">(</span><span class="token number">192.168</span>.218.4<span class="token punctuation">)</span>: <span class="token assign-left variable">icmp_seq</span><span class="token operator">=</span><span class="token number">1</span> <span class="token assign-left variable">ttl</span><span class="token operator">=</span><span class="token number">64</span> <span class="token assign-left variable">time</span><span class="token operator">=</span><span class="token number">0.091</span> ms
<span class="token number">64</span> bytes from tym <span class="token punctuation">(</span><span class="token number">192.168</span>.218.4<span class="token punctuation">)</span>: <span class="token assign-left variable">icmp_seq</span><span class="token operator">=</span><span class="token number">2</span> <span class="token assign-left variable">ttl</span><span class="token operator">=</span><span class="token number">64</span> <span class="token assign-left variable">time</span><span class="token operator">=</span><span class="token number">0.083</span> ms

登录后复制

二、通过/etc/resolv.conf文件委派域名解析服务器的地址,由dns服务器做域名解析

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># vim /etc/resolv.conf </span>
<span class="token comment"># Generated by NetworkManager</span>
nameserver <span class="token number">223.5</span>.5.5
nameserver <span class="token number">192.168</span>.218.4
<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># host www.baidu.com 192.168.218.4</span>
Using domain server:
Name: <span class="token number">192.168</span>.218.4
Address: <span class="token number">192.168</span>.218.4<span class="token comment">#53</span>
Aliases: 
www.baidu.com is an <span class="token builtin class-name">alias</span> <span class="token keyword">for</span> www.a.shifen.com.
www.a.shifen.com has address <span class="token number">120.232</span>.145.144
www.a.shifen.com has address <span class="token number">120.232</span>.145.185
www.a.shifen.com has IPv6 address <span class="token number">2409</span>:8c54:870:67:0:ff:b0c2:ad75
www.a.shifen.com has IPv6 address <span class="token number">2409</span>:8c54:870:34e:0:ff:b024:1916

登录后复制

四、从网站下载文件一、wget命令

用于在终端命令行里下载网路文件,中文全称为:webget

命令格式为:

wget[选项]网址

选项:

<span class="token parameter variable">-P</span> :下载到指定目录
<span class="token parameter variable">-t</span> :最大尝试次数
<span class="token parameter variable">-b</span> :后台下载模式
<span class="token parameter variable">-c</span> :断点续传
<span class="token parameter variable">-p</span> :下载页面内所有资源,包括图片、视频等
<span class="token parameter variable">-r</span> :递归下载

登录后复制

使用疗效如下:

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment">#wget http://rpmfind.net/linux/epel/8/Everything/x86_64/Packages/s/sl-5.02-1.el8.x86_64.rpm</span>
--2024-04-03 <span class="token number">21</span>:23:56--http://rpmfind.net/linux/epel/8/Everything/x86_64/Packages/s/sl-5.02-1.el8.x86_64.rpm
Resolving rpmfind.net <span class="token punctuation">(</span>rpmfind.net<span class="token punctuation">)</span><span class="token punctuation">..</span>. <span class="token number">195.220</span>.108.108
Connecting to rpmfind.net <span class="token punctuation">(</span>rpmfind.net<span class="token punctuation">)</span><span class="token operator">|</span><span class="token number">195.220</span>.108.108<span class="token operator">|</span>:80<span class="token punctuation">..</span>. connected.
HTTP request sent, awaiting response<span class="token punctuation">..</span>. <span class="token number">200</span> OK
Length: <span class="token number">16564</span> <span class="token punctuation">(</span>16K<span class="token punctuation">)</span> <span class="token punctuation">[</span>application/x-rpm<span class="token punctuation">]</span>
Saving to: ‘sl-5.02-1.el8.x86_64.rpm’
sl-5.02-1.el8.x86_64.rpm<span class="token number">100</span>%<span class="token punctuation">[</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">=</span><span class="token operator">></span><span class="token punctuation">]</span><span class="token number">16</span>.18K<span class="token number">5</span>.77KB/s<span class="token keyword">in</span> <span class="token number">2</span>.8s
<span class="token number">2024</span>-04-03 <span class="token number">21</span>:24:02 <span class="token punctuation">(</span><span class="token number">5.77</span> KB/s<span class="token punctuation">)</span> - ‘sl-5.02-1.el8.x86_64.rpm’ saved <span class="token punctuation">[</span><span class="token number">16564</span>/16564<span class="token punctuation">]</span>
<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># ls</span>
anaconda-ks.cfgsl-5.02-1.el8.x86_64.rpm

登录后复制

二、curl命令

curl命令是一个网路工具,其主要作用是通过http、https、ftp等形式下载/上传文件

命令格式为:

curl网址[选项]

选项:

<span class="token parameter variable">-o</span> :指定名称

登录后复制

使用疗效如下:

<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># curl www.baidu.com -o baidu.html</span>
% Total% Received % XferdAverage Speed TimeTime TimeCurrent
 DloadUpload Total SpentLeftSpeed
<span class="token number">100</span><span class="token number">2381</span><span class="token number">100</span><span class="token number">2381</span><span class="token number">0</span> <span class="token number">0</span><span class="token number">19677</span><span class="token number">0</span> --:--:-- --:--:-- --:--:-- <span class="token number">19677</span>
<span class="token punctuation">[</span>root@tym ~<span class="token punctuation">]</span><span class="token comment"># ls</span>
anaconda-ks.cfgbaidu.htmlsl-5.02-1.el8.x86_64.rpm

登录后复制

以上就是红帽 Linux9 版本网络管理及 VMware 虚拟机三种网络连接方式解析的详细内容,更多请关注小闻网其它相关文章!

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。