RHEL7配置ip地址的方式有哪些

发布时间:2021-08-03 09:57:43 作者:chen
来源:亿速云 阅读:196

本篇内容介绍了“RHEL7配置ip地址的方式有哪些”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!


图形界面配置方法

点击桌面右上角有线连接处,选中配置ens33
RHEL7配置ip地址的方式有哪些
在此输入ip地址,掩码,DNS,网关等
RHEL7配置ip地址的方式有哪些
然后选中启动就ok了
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

“RHEL7配置ip地址的方式有哪些”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!

推荐阅读:
  1. RHEL7设置网关、IP地址和DNS服务的方法有哪些
  2. 配置linux的ip地址的方法有哪些

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

rhel7 ip

上一篇:vue如何使用Jade模板写html,stylus写css

下一篇:如何解决某些HTML字符打不出来的问题

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》