!
也想出现在这里? 联系我们
广告位
当前位置:首页>教程分享>服务器教程>云服务器CentOS8 Stream 网卡配置操作

云服务器CentOS8 Stream 网卡配置操作

CentOS8 Stream 网卡配置操作

CentOS8  已废弃network.service,网卡操作需要使用nmcli ,当前整理配置文件操作及相关命令

命令:nmcli

配置文件:/etc/sysconfig/network-scripts/ifcfg-eth0

配置单个ipv4地址

  • IP:60.247.159.221    掩码:255.255.255.0     网关:60.247.159.1

[root@ebs-113436 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

# 申明网卡eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=60.247.159.221
NETMASK=255.255.255.0
GATEWAY=60.247.159.1
TYPE=Ethernet
ONBOOT=yes

配置多个ipv4地址

  • IP1:60.247.159.221  掩码1:255.255.255.0  网关1:60.247.159.152

  • IP2:60.247.159.221  掩码2:255.255.255.0

    多ip配置一般只需要配置一个GATEWAY0 网关即可

[root@ebs-113436 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

# 申明网卡eth0
DEVICE=eth0
BOOTPROTO=static
TYPE=Ethernet
ONBOOT=yes
IPADDR0=60.247.159.221
IPADDR1=60.247.159.152
NETMASK0=255.255.255.0
NETMASK1=255.255.255.0
.
.
.
.
.
.
GATEWAY0=60.247.159.1

几个依此添加即可,如果ip较多,一个IP段添加。

先通过http://tool.520101.com/wangluo/ipjisuan/ 计算ip地址

云服务器CentOS8 Stream 网卡配置操作

获取到第一个和最后一个可用ip尾数为193和254,以及掩码255.255.255.192,并注意服务器上网络连接名称,加入

for I in $(seq 193 254); do nmcli con mod eth0 +ipv4.addresses 192.168.1.${I}/26; done

单个ipv6配置

  • ipv4:60.247.159.221     掩码:255.255.255.0    网关:60.247.159.1

  • ipv6:240E:D9:C200:160:9404::1A80   掩码位数:64   网关:240e:d9:c200:160::1

[root@ebs-113436 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

# 申明网卡eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=60.247.159.221
NETMASK=255.255.255.0
GATEWAY=60.247.159.1
TYPE=Ethernet
ONBOOT=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6ADDR=240E:D9:C200:160:9404::1A80/64
IPV6_DEFAULTGW=240e:d9:c200:160::1

多个ipv6配置

  • ipv4:60.247.159.221     掩码:255.255.255.0    网关:60.247.159.1

  • ipv6:240E:D9:C200:160:9404::1A80-240E:D9:C200:160:9404::1a9f   掩码位数:64   网关:240e:d9:c200:160::1

[root@ebs-113436 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

# 申明网卡eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=60.247.159.221
NETMASK=255.255.255.0
GATEWAY=60.247.159.1
TYPE=Ethernet
ONBOOT=yes
# IPV6配置
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6ADDR=240E:D9:C200:160:9404::1A80/64
IPV6_DEFAULTGW=240e:d9:c200:160::1
# 多IPV6配置  用空格分开
IPV6ADDR_SECONDARIES=\"240E:D9:C200:160:9404::1a80/64  240E:D9:C200:160:9404::1a81/64  240E:D9:C200:160:9404::1a82/64  240E:D9:C200:160:9404::1a83/64  240E:D9:C200:160:9404::1a84/64  240E:D9:C200:160:9404::1a85/64  240E:D9:C200:160:9404::1a86/64  240E:D9:C200:160:9404::1a87/64  240E:D9:C200:160:9404::1a88/64  240E:D9:C200:160:9404::1a89/64  240E:D9:C200:160:9404::1a8a/64  240E:D9:C200:160:9404::1a8b/64  240E:D9:C200:160:9404::1a8c/64  240E:D9:C200:160:9404::1a8d/64  240E:D9:C200:160:9404::1a8e/64  240E:D9:C200:160:9404::1a8f/64  240E:D9:C200:160:9404::1a90/64  240E:D9:C200:160:9404::1a91/64  240E:D9:C200:160:9404::1a92/64  240E:D9:C200:160:9404::1a93/64  240E:D9:C200:160:9404::1a94/64  240E:D9:C200:160:9404::1a95/64  240E:D9:C200:160:9404::1a96/64  240E:D9:C200:160:9404::1a97/64  240E:D9:C200:160:9404::1a98/64  240E:D9:C200:160:9404::1a99/64  240E:D9:C200:160:9404::1a9a/64  240E:D9:C200:160:9404::1a9b/64  240E:D9:C200:160:9404::1a9c/64  240E:D9:C200:160:9404::1a9d/64  240E:D9:C200:160:9404::1a9e/64  240E:D9:C200:160:9404::1a9f/64\"

ipv6 批量配置教程https://www.west.cn/faq/list.asp?unid=2276

以上配置后需要重启网卡生效;

网卡服务重启

<pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" style=\"margin-top: 15px;margin-bottom: 15px;padding: 8px 4px 6px;font-family: var(--monospace);font-size: 0.9em;line-height: 20px;overflow-wrap: break-word;white-space: normal;background-color: rgb(245, 245, 245);border: 1px solid rgb(231, 234, 237);border-radius: 3px;color: rgb(51, 51, 51);box-sizing: border-box;overflow: visible;break-inside: avoid;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;b

给TA打赏
共{{data.count}}人
人已打赏
服务器教程

网站域名被墙了如何判断解决

2021-4-17 19:56:13

服务器教程

mysql占cpu资源,如何查看当前执行sql语句连接

2021-4-17 19:56:16

声明 本站上的部份代码及教程来源于互联网,仅供网友学习交流,若您喜欢本文可附上原文链接随意转载。无意侵害您的权益,请发送邮件至 [email protected] 或点击右侧 私信:吉吉国王 反馈,我们将尽快处理。
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索
OneEase