良许Linux教程网 干货合集 redhat中配置网络的多种方法

redhat中配置网络的多种方法

linux系统配置网络有多种方式,本篇文章重点为大家讲解一下redhat中配置网络的多种方法,有需要的小伙伴可以参考一下。

redhat中配置网络的多种方法

图形界面配置方法

点击桌面右上角有线连接处,选中配置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=4163  mtu 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=73  mtu 65536
       inet 127.0.0.1  netmask 255.0.0.0
       inet6 ::1  prefixlen 128  scopeid 0x10
       loop  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=4099  mtu 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

以上就是良许教程网为各位朋友分享的Linu系统相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多干货等着你 !

img
本文由 良许Linux教程网 发布,可自由转载、引用,但需署名作者且注明文章出处。如转载至微信公众号,请在文末添加作者公众号二维码。
良许

作者: 良许

良许,世界500强企业Linux开发工程师,公众号【良许Linux】的作者,全网拥有超30W粉丝。个人标签:创业者,CSDN学院讲师,副业达人,流量玩家,摄影爱好者。
上一篇
下一篇

发表评论

联系我们

联系我们

公众号:良许Linux

在线咨询: QQ交谈

邮箱: yychuyu@163.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部