10.7总结与练习

1、配置网络
(1)为网卡添加一个会话static,在此会话配置ip地址为x.x.x.123

[root@server ~]# nmcli connection s
NAME        UUID                                  TYPE      DEVICE     
ens160      6cd06fe2-c194-42a2-ad3f-d8de4b1104e0  ethernet  ens160     
virbr0      48ebb188-fb6c-4dfd-a23f-cdfb1904830d  bridge    virbr0     
virbr0-nic  5a2ea478-6c13-431f-8d89-083598efdee0  tun       virbr0-nic 
[root@server ~]# nmcli connection add type ethernet con-name static  ifname ens160 ipv4.method manual ipv4.addresses 10.10.0.123/24 ipv4.gateway 10.10.0.254 ipv4.dns 114.114.114.114 autoconnect yes
Connection 'static' (e7b26ebd-824d-4b20-8147-543f25427fea) successfully added.
[root@server ~]# nmcli connection show 
NAME        UUID                                  TYPE      DEVICE     
ens160      6cd06fe2-c194-42a2-ad3f-d8de4b1104e0  ethernet  ens160     
virbr0      48ebb188-fb6c-4dfd-a23f-cdfb1904830d  bridge    virbr0     
virbr0-nic  5a2ea478-6c13-431f-8d89-083598efdee0  tun       virbr0-nic 
static      e7b26ebd-824d-4b20-8147-543f25427fea  ethernet  --       

(2)测试网络连通性,看是否能够ping通百度,并把百度首页文件下载下来

[root@server ~]# ping www.baidu.com
PING www.a.shifen.com (183.232.231.174) 56(84) bytes of data.
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=1 ttl=128 time=41.1 ms
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=2 ttl=128 time=58.6 ms
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=4 ttl=128 time=55.9 ms
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=5 ttl=128 time=32.2 ms
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=6 ttl=128 time=32.8 ms
^C
--- www.a.shifen.com ping statistics ---
6 packets transmitted, 5 received, 16.6667% packet loss, time 70ms
rtt min/avg/max/mdev = 32.164/44.108/58.620/11.236 ms

[root@server ~]# wget http://www.baidu.com
--2022-11-01 19:52:11--  http://www.baidu.com/
Resolving www.baidu.com (www.baidu.com)... 183.232.231.172, 183.232.231.174
Connecting to www.baidu.com (www.baidu.com)|183.232.231.172|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2381 (2.3K) [text/html]
Saving to: ‘index.html’

index.html           100%[=====================>]   2.33K  --.-KB/s    in 0s      

2022-11-01 19:52:11 (532 MB/s) - ‘index.html’ saved [2381/2381]
[root@server ~]# ll ./index.html 
-rw-r--r--. 1 root root 2381 Nov  1 19:52 ./index.html

(3)设置系统开机时,该网卡通过DHCP协议自动获取IP地址

[root@server ~]# nmcli connection modify ens160 ipv4.method auto
[root@server ~]# nmcli connection up ens160

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值