LINUX centos7.6修改靜態IP與配置引數NM_CONTROLLED
目前,各種OS作業系統版本瘋狂升級,並且隨之而變的作業系統設定也有很大的改變。對於CENTOS目前最新版本已經
是8.x,但是,centos 7.6相對與以前的老版本,作業系統相關的部分配置已經有比較大的變化,舉例:靜態IP與配置引數
NM_CONTROLLED,當網路配置檔案中沒有改引數時,即便其IP配置使用靜態IP,也不起作用。
--ifcfg-ens34的配置
[root@centos76mysqlpri network-scripts]# cat ifcfg-ens34
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static #此處已經宣告使用靜態IP
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens34
UUID=af87d788-f524-4095-81c9-367eba488f9a
DEVICE=ens34
>
IPADDR=192.168.192.201
PREFIX=24
GATEWAY=192.168.192.1
IPV6_PRIVACY=no
[root@centos76mysqlpri network-scripts]#
--ifcfg-ens34啟動後的IP地址缺不是期望中的
[root@centos76mysqlpri network-scripts]# ifup ens34
[root@centos76mysqlpri network-scripts]# ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.248.129 netmask 255.255.255.0 broadcast 192.168.248.255
inet6 fe80::7391:3e5e:cead:f642 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:26:76:0c txqueuelen 1000 (Ethernet)
RX packets 13523 bytes 17404331 (16.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5554 bytes 343077 (335.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens34: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.192.128 netmask 255.255.255.0 broadcast 192.168.192.255
inet6 fe80::2162:583:8ee:d0be prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:26:76:16 txqueuelen 1000 (Ethernet)
RX packets 63 bytes 7008 (6.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 138 bytes 20565 (20.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 224 bytes 18384 (17.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 224 bytes 18384 (17.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:2f:86:09 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0-nic: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 52:54:00:2f:86:09 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@centos76mysqlpri network-scripts]#
到此,感覺有點莫名其妙!經查詢是:centos7.6使用NM_CONTROLLED引數控制是否透過網路管理器進行管理。
--修改ifcfg-ens34的配置
[root@centos76mysqlpri network-scripts]# cat ifcfg-ens34
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens34
UUID=af87d788-f524-4095-81c9-367eba488f9a
DEVICE=ens34
>
NM_CONTROLLED=no
IPADDR=192.168.192.201
PREFIX=24
GATEWAY=192.168.192.1
IPV6_PRIVACY=no
[root@centos76mysqlpri network-scripts]#
--ifcfg-ens34網路卡重啟後
[root@centos76mysqlpri network-scripts]# ifup ens34
[root@centos76mysqlpri network-scripts]# ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.248.129 netmask 255.255.255.0 broadcast 192.168.248.255
inet6 fe80::7391:3e5e:cead:f642 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:26:76:0c txqueuelen 1000 (Ethernet)
RX packets 13523 bytes 17404331 (16.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5554 bytes 343077 (335.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens34: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.192.201 netmask 255.255.255.0 broadcast 192.168.192.255
inet6 fe80::20c:29ff:fe26:7616 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:26:76:16 txqueuelen 1000 (Ethernet)
RX packets 81 bytes 8664 (8.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 167 bytes 24573 (23.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 224 bytes 18384 (17.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 224 bytes 18384 (17.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:2f:86:09 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0-nic: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 52:54:00:2f:86:09 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@centos76mysqlpri network-scripts]#
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29357786/viewspace-2687828/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- linux靜態ip 配置Linux
- Linux中配置靜態IPLinux
- 【002】Linux配置靜態ip地址Linux
- Linux靜態Ip配置失敗Linux
- ubuntu修改mac地址及配置靜態ipUbuntuMac
- Linux伺服器配置靜態IPLinux伺服器
- CentOS配置靜態IPCentOS
- Linux IP地址修改與配置問題Linux
- 恢復linux網路介面並配置靜態ipLinux
- Liunx配置靜態ip VMware
- Ubuntu 16.04 配置靜態 ipUbuntu
- ubuntu 配置靜態IP 和 DNSUbuntuDNS
- 動態IP與靜態IP的主要區別
- Ubuntu下遠端配置靜態IPUbuntu
- CentOS7配置靜態IP地址CentOS
- centos8 中 如何配置靜態IPCentOS
- 第三天-centos配置靜態IPCentOS
- 如何配置RHEL8靜態 IP 地址
- Ubuntu Server18.04 靜態 IP 配置教程UbuntuServer
- linux 靜態地址配置選項Linux
- Linux配置靜態IP解決無法訪問網路問題Linux
- Linux Mint 20 設定靜態IP地址Linux
- linux修改系統引數Linux
- 靜態路由原理與配置路由
- Linux CentOS 配置靜態 ip 和 解決 配置後無法聯網的問題LinuxCentOS
- VirtualBox配置centos7靜態ip(詳解)CentOS
- VMware配置centos虛擬機器靜態ipCentOS虛擬機
- 靜態住宅IP與動態住宅IP有什麼區別?
- Linux-靜態路由相關配置Linux路由
- Linux虛擬機器設定靜態IPLinux虛擬機
- 靜態IP與動態IP有什麼區別?海外代理IP詳解
- 在Linux中,linux核心引數如何修改?Linux
- Linux系統超詳細Linux設定靜態IP教程!Linux
- linux靜態ip的ens33部署LinuxS3
- 海外靜態代理IP如何搭建?靜態IP有什麼好處?
- VMware 虛擬機器,配置 Ubuntu 22.04 靜態 IP 地址。虛擬機Ubuntu
- Centos7 配置靜態ip及問題處理CentOS
- Python3.10動態修改Windows系統(win10/win11)本地IP地址(靜態IP)PythonWindowsWin10