RHEL7多種方式配置ip地址

安全劍客發表於2020-02-29
配置網路有多種方式,接下來我們介紹幾種供大家工作使用

RHEL7多種方式配置ip地址RHEL7多種方式配置ip地址

圖形介面配置方法

點選桌面右上角有線連線處,選中配置ens33
RHEL7多種方式配置ip地址RHEL7多種方式配置ip地址
在此輸入ip地址,掩碼,DNS,閘道器等
RHEL7多種方式配置ip地址RHEL7多種方式配置ip地址
然後選中啟動就ok了
RHEL7多種方式配置ip地址RHEL7多種方式配置ip地址
如此網路配置就完成了!

透過修改配置檔案

透過修改ifcfg-ens33配置檔案來修改配置ip

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
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=ens33
UUID=96a5f670-6b15-4711-af6e-92aa92e1c66b
DEVICE=ens33
ONBOOT=no
~                                                                                                                                                                       
~                                                                                                                                                                       
~                                                                                                                                                                       
~                                                                                                                                                                       
~                                                                                                                                                                       
~                                                                                                                                                                       
~                                                                                                                                                                       
~                                                                                                                                                                       
~                                                                                                                                                                       
~                                                                                                                                                                       
~                                                                                                                                                                       
"/etc/sysconfig/network-scripts/ifcfg-ens33" 15L, 279C

將BOOTPROTO改為static
ONBOOT=no改為ONBOOT=yes
新增IPADDR NETMASK GATEWAY DNS1欄位 如下所示:

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 
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=ens33
UUID=96a5f670-6b15-4711-af6e-92aa92e1c66b
DEVICE=ens33
ONBOOT=yes
IPADDR=172.16.1.115
NETMASK=255.255.255.0
GATEWAY=172.16.1.254
DNS1=8.8.8.8

如此重啟網路卡就可以了!
[root@localhost ~]# systemctl restart network

利用工具配置

輸入以下 ,指定ip 掩碼

[root@localhost ~]# nmcli connection modify ens33 ipv4.method manual ipv4.address 172.16.1.120/24 connection.autoconnect yes

重啟網路卡

[root@localhost ~]# ifconfig
ens33: flags=4163mtu 1500
        inet 172.16.1.120  netmask 255.255.255.0  broadcast 172.16.1.255
        inet6 fe80::d09c:682a:b786:6214  prefixlen 64  scopeid 0x20
        ether 00:0c:29:65:07:1a  txqueuelen 1000  (Ethernet)
        RX packets 2536  bytes 836453 (816.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2054  bytes 277233 (270.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10loop  txqueuelen 1  (Local Loopback)
        RX packets 96  bytes 8256 (8.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 96  bytes 8256 (8.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
virbr0: flags=4099mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:dc:7d:cf  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

以上就是 系統網路配置的多種方法

原文地址:

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31559985/viewspace-2677763/,如需轉載,請註明出處,否則將追究法律責任。

相關文章