命令:nmcli
配置文件:/etc/sysconfig/network-scripts/ifcfg-eth0
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 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地址
获取到第一个和最后一个可用ip尾数为193和254,以及掩码255.255.255.192,并注意服务器上网络连接名称,加入
[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
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 ~]# nmcli c NAME UUID TYPE DEVICE System eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 ethernet eth0 System eth1 9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04 ethernet eth1 # 重启网卡服务 [root@ebs-113436 ~]# nmcli c reload "System eth0" / nmcli c up "System eth0" # 如果不生效 [root@ebs-113436 ~]# nmcli device reapply eth0 [root@ebs-113436 ~]# nmcli device connect e
Copyright © 2013-2021 8a.hk All Rights Reserved. 八艾云 版权所有 中山市八艾云计算有限公司 粤ICP备14095776号