圖形界面配置方法
點擊桌面右上角有線連接處,選中配置ens33
在此輸入ip地址,掩碼,DNS,網關等
然後選中啟動就ok了
如此網絡配置就完成了!
通過修改配置文件
通過修改ifcfg-ens33配置文件來修改配置ip
<code>[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=dhcpDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens33UUID=96a5f670-6b15-4711-af6e-92aa92e1c66bDEVICE=ens33ONBOOT=no~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "/etc/sysconfig/network-scripts/ifcfg-ens33" 15L, 279C /<code>
將BOOTPROTO改為staticONBOOT=no改為ONBOOT=yes添加IPADDR NETMASK GATEWAY DNS1字段 如下所示:
<code>[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens33UUID=96a5f670-6b15-4711-af6e-92aa92e1c66bDEVICE=ens33ONBOOT=yesIPADDR=172.16.1.115NETMASK=255.255.255.0GATEWAY=172.16.1.254DNS1=8.8.8.8/<code>
如此重啟網卡就可以了![root@localhost ~]# systemctl restart network
利用工具配置
輸入以下命令,指定ip 掩碼
<code>[root@localhost ~]# nmcli connection modify ens33 ipv4.method manual ipv4.address 172.16.1.120/24 connection.autoconnect yes/<code>
重啟網卡
<code>[root@localhost ~]# ifconfigens33: 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 0lo: 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 0virbr0: 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/<code>
以上就是linux系統網絡配置的多種方法
閱讀更多 IT生涯 的文章