Rumah > Tutorial sistem > LINUX > Analisis pengurusan rangkaian versi Red Hat Linux9 dan tiga kaedah sambungan rangkaian mesin maya VMware

Analisis pengurusan rangkaian versi Red Hat Linux9 dan tiga kaedah sambungan rangkaian mesin maya VMware

PHPz
Lepaskan: 2024-06-23 15:34:18
asal
1181 orang telah melayarinya

红帽 Linux9 版本网络管理及 VMware 虚拟机三种网络连接方式解析

Artikel ini menggunakan versi Red Hat Linux9 sebagai contoh untuk menerangkan.

Pengurusan rangkaian versi Red Hat Linux 9 adalah sangat komprehensif, dan perubahan konfigurasi rangkaian boleh dibuat di banyak tempat Walau bagaimanapun, perlu diperhatikan bahawa dalam versi 9, pengguna boleh membuat perubahan konfigurasi rangkaian dalam fail konfigurasi, tetapi sistem tidak boleh. Perintah yang diubah akan dilaksanakan, dan versi sebelum versi 9 boleh melaksanakannya.

Tiga jenis sambungan rangkaian pada mesin maya VMware

Mod Jambatan:

Sambungkan kad rangkaian pada hos ke kad rangkaian maya Vmnet0 melalui hab maya Dalam mod jambatan, kad rangkaian mesin maya disambungkan ke suis maya Vmnet0 Apabila mesin maya ingin mengakses Internetsistem Linux dan pengurusan rangkaianAdakah sistem Linux mudah digunakan , alamat IP mesin maya, segmen subnet, segmen rangkaian, dll. perlu dikonfigurasikan sama seperti kad rangkaian hos.

Mod NAT:

Sambungkan kad rangkaian pada hos ke kad rangkaian maya Vmnet8 melalui hab maya Dalam mod NAT, pelayan DHCP mesin maya disambungkan ke suis maya Vmnet8 Perlu diingatkan bahawa kad rangkaian maya Vmnet8 sahaja digunakan sebagai soket komunikasi antara hos dan mesin maya Mesin akhirnya menyambung ke Internet dengan bantuan kad rangkaian hos.

Mod Hos Sahaja:

Kad rangkaian maya Vmnet1 disambungkan ke suis maya Vmnet1 untuk merealisasikan komunikasi mesin maya apabila mesin maya perlu disambungkan ke Internet, kad rangkaian rangkaian hos dikongsi dengan kad rangkaian maya Vmnet1 untuk merealisasikan mesin maya. rangkaian.

Ciri-ciri NetworkManager

NetworkManager ialah projek yang dilancarkan oleh RedHat pada tahun 2004 untuk membolehkan pengguna Linux mengendalikan keperluan rangkaian moden dengan lebih mudah dan menemui kad rangkaian dan mengkonfigurasi alamat IP secara manual.

Ciri-ciri NetworkManager

NM boleh menguruskan pelbagai jenis rangkaian:

Kad rangkaian berwayar, kad rangkaian wayarles

Ip dinamik, ip statik

Ethernet, bukan Ethernet

Kad rangkaian kimia, kad rangkaian maya

Alat lengkap:

Baris arahan, antara muka teks, antara muka grafik, web

Rekrut dunia:

Urus pelbagai jenis rangkaian, berwayar, tanpa wayar, fizikal, maya

Parameter yang kaya:

Sehingga 200 parameter konfigurasi (termasuk parameter ethtool)

Menyatukan dunia:

Sistem RedHat, sistem Suse, sistem Debian/Ubuntu, semuanya disokong

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

Arah aliran umum:

Bermula dari Red Hat Linux versi 9, rangkaian hanya boleh diuruskan melalui NM

1. Konfigurasikan rangkaian

Soket rangkaian merujuk kepada pintu masuk dan keluar untuk komunikasi antara komputer atau peralatan rangkaian dan peranti lain pada rangkaian. Di sini, ia terutamanya merujuk kepada soket rangkaian komputer, iaitu, peranti kad rangkaian.

Bermula dari versi Red Hat Linux 7, borang "Penamaan Peranti Rangkaian Konsisten" baharu telah diperkenalkan untuk menamakan soket rangkaian Kaedah ini boleh menetapkan nama tetap berdasarkan perisian tegar, topologi peranti, jenis peranti dan maklumat lokasi. Dua aksara pertama nama bicu rangkaian ialah simbol jenis rangkaian.

Simbol jenis rangkaian:

en: singkatan kepada Ethernet

wl: singkatan kepada LAN Wayarles (wlan)

ww: singkatan kepada rangkaian kawasan luas tanpa wayar (wwan)

Pilih simbol berdasarkan jenis peranti atau lokasi:

o: Menunjukkan peranti bersepadu (iaitu kad rangkaian bersepadu) dan nombor Soton di luar kad grafik;

s: Menunjukkan peranti bebas yang dipalamkan ke bicu boleh tukar panas;

x: mewakili peranti yang dinamakan berdasarkan alamat MAC; p——mewakili kedudukan matematik dan nombor bicu PCI.

Perkara yang perlu diambil perhatian ialah:

Soket rangkaian boleh mempunyai berbilang sambungan rangkaian, tetapi hanya satu sambungan rangkaian boleh aktif pada masa yang sama.

1 Ubah suai fail konfigurasi (tidak disyorkan)

Prasyarat:

Memerlukan perkhidmatan rangkaian

Masuk ke profil

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

Kompilasikan kandungan yang sepadan dalam fail konfigurasi

<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>
Salin selepas log masuk

2. Gunakan arahan IP untuk mengkonfigurasi sambungan rangkaian berkesan sementara untuk melihat maklumat konfigurasi kad rangkaian pada lapisan rangkaian untuk memaparkan maklumat statistik yang berkaitan, seperti bilangan paket data yang diterima (RX) dan dihantar (TX).

ip[-s]addrshow[nama peranti kad rangkaian]

<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
Salin selepas log masuk

Lihat maklumat konfigurasi kad rangkaian pada lapisan pautan data

ip[-s]pameran pautan[nama peranti kad rangkaian]

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
Salin selepas log masuk

Tambah atau padam alamat IPv4 sementara kad rangkaian; tambah atau padam alamat IPv6 sementara kad rangkaian

ip[-4]addradd|alamat delIP[/lebar segmen rangkaian]nama sambungan kad rangkaian pembangun

ip-6addradd|alamat delIP[/lebar segmen rangkaian]nama sambungan kad rangkaian 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
Salin selepas log masuk

禁用|启用指定网卡

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>
Salin selepas log masuk

三、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
Salin selepas log masuk

查看网卡设备

nmclidevice

缩写:nmclid

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

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>
Salin selepas log masuk

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 
Salin selepas log masuk

配置已存在会话的网卡的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>
Salin selepas log masuk

交互式:

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>
Salin selepas log masuk

添加新的会话

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">&#039;1&#039;</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--
Salin selepas log masuk

联接、断开、删除会话

联接会话

[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> ----设置系统的主机名
Salin selepas log masuk

步入选项“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>
Salin selepas log masuk

使用疗效如下:

<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
Salin selepas log masuk

二、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>。
Salin selepas log masuk

网络管理系统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
Salin selepas log masuk

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

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

命令格式为:

traceroute[选项]

常用选项:

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

三、通过域名来访问主机一、配置静态解析,通过/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
Salin selepas log masuk

二、通过/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
Salin selepas log masuk

四、从网站下载文件一、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> :递归下载
Salin selepas log masuk

使用疗效如下:

<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
Salin selepas log masuk

二、curl命令

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

命令格式为:

curl网址[选项]

选项:

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

使用疗效如下:

<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
Salin selepas log masuk

Atas ialah kandungan terperinci Analisis pengurusan rangkaian versi Red Hat Linux9 dan tiga kaedah sambungan rangkaian mesin maya VMware. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!

sumber:itcool.net
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan