主机配置静态IP

LVS虚拟机配置网关

路径:

CentOS 6: 

vim /etc/sysconfig/network-scripts/ifcfg-eth0

CentOS 7:

vim /etc/sysconfig/network-scripts/ifcfg-ens32

 1 DEVICE="eth0"  #CentOS 6 的静态ip配置文件
 2 BOOTPROTO="static"  #静态ip
 3 IPADDR=192.168.189.130  # 局域网自由分配ip
 4 GATEWAY=192.168.189.2   #网关
 5 HWADDR="00:0C:29:E6:63:F4"
 6 IPV6INIT="yes"
 7 NM_CONTROLLED="yes"
 8 ONBOOT="yes"
 9 TYPE="Ethernet"
10 UUID="d3052071-4e6f-4bb9-8779-ab9cd8745fa0"
11 DNS1='192.168.189.129'  #根据实际情况填写
12 DNS2='202.106.0.20'
 1 TYPE=Ethernet    #此配置为CentOS7
 2 PROXY_METHOD=none
 3 BROWSER_ONLY=no
 4 BOOTPROTO='static'   #静态标注
 5 DEFROUTE=yes
 6 IPV4_FAILURE_FATAL=no  ##
 7 IPV6INIT=yes
 8 IPV6_AUTOCONF=yes
 9 IPV6_DEFROUTE=yes
10 IPV6_FAILURE_FATAL=no
11 IPV6_ADDR_GEN_MODE=stable-privacy
12 NAME=ens32
13 UUID=387ffc24-3d8a-4e25-8997-e2682c2d2872
14 DEVICE=ens32
15 ONBOOT=yes
16 IPADDR=192.168.189.139  #局域网静态ip
17 GATEWAY=192.168.189.2    #局域网静态网关
18 NETMASK=255.255.255.0
19 DNS1=192.168.189.2

:x 保存后记得重启网卡 service network restart      systemctl restart network

ifconfig查看ip是否成功

 

posted @ 2019-11-30 16:56  Security  阅读(388)  评论(0编辑  收藏  举报