linux-01-網路

dhxx發表於2018-07-24

Linux copy 聯網問題

centos7 克隆多個後

[root@centos-min4 network-scripts]# service network restart
Restarting network (via systemctl):  Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

解決方案
首先

[root@centos-min4 network-scripts]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:4c:d2:36 brd ff:ff:ff:ff:ff:ff
    inet 192.168.94.133/24 brd 192.168.94.255 scope global noprefixroute dynamic ens33
       valid_lft 1430sec preferred_lft 1430sec
    inet6 fe80::fb0f:5a78:aadb:a0ee/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

注意上面的00:0c:29:4c:d2:36 和ens33

其次
編輯:/etc/sysconfig/network-scripts/ifcfg-enXXXX

TYPE=Ethernet
BOOTPROTO=static #static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=ens33
UUID=292f356b-57e9-432e-bad5-6b931dec4d99
#DEVICE=eno16777736 #註釋
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPADDR=192.168.94.130 #新增
NETMASK=255.255.255.0 #新增
GATEWAY=192.168.94.1 #新增,net 模式
HWADDR=00:0c:29:73:81:0e   #新增,上一步ip addr 獲取的

最後
將ifcfg-enXXXX檔名改為第一步獲取的 值ifcfg-ens33

相關文章