CentOS 7中网络设置图文详解(5)

下面我们进入网卡配置文件目录,这时候时没有ens36网卡的配置文件的,我们就需要把ens33的配置文件直接复制,更改为ens36的配置文件,然后把配置文件的内容更改就可以了

[root@localhost ~]# cd /etc/sysconfig/network-scripts/ //进入网卡配置文件目录 [root@localhost network-scripts]# ls //查看 ifcfg-ens33 ifdown-isdn ifup ifup-plip ifup-tunnel ifcfg-lo ifdown-post ifup-aliases ifup-plusb ifup-wireless ifdown ifdown-ppp ifup-bnep ifup-post init.ipv6-global ifdown-bnep ifdown-routes ifup-eth ifup-ppp network-functions ifdown-eth ifdown-sit ifup-ib ifup-routes network-functions-ipv6 ifdown-ib ifdown-Team ifup-ippp ifup-sit ifdown-ippp ifdown-TeamPort ifup-ipv6 ifup-Team ifdown-ipv6 ifdown-tunnel ifup-isdn ifup-TeamPort [root@localhost network-scripts]# cp -p ifcfg-ens33 ifcfg-ens36 //复制ens33配置文件 [root@localhost network-scripts]# ls //查看 ifcfg-ens33 ifdown-ipv6 ifdown-tunnel ifup-isdn ifup-TeamPort ifcfg-ens36 ifdown-isdn ifup ifup-plip ifup-tunnel ifcfg-lo ifdown-post ifup-aliases ifup-plusb ifup-wireless ifdown ifdown-ppp ifup-bnep ifup-post init.ipv6-global ifdown-bnep ifdown-routes ifup-eth ifup-ppp network-functions ifdown-eth ifdown-sit ifup-ib ifup-routes network-functions-ipv6 ifdown-ib ifdown-Team ifup-ippp ifup-sit ifdown-ippp ifdown-TeamPort ifup-ipv6 ifup-Team [root@localhost network-scripts]# vim ifcfg-ens36 //进入编辑ens36配置文件 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=ens36 //更改33为36 DEVICE=ens36 //更改33为36 ONBOOT=yes IPADDR=192.168.10.10 //更改IP地址网段 NETMAS=255.255.255.0 GATEWAY=192.168.10.0 //更改网关地址 ~ ~ 注意,配置文件里面的UUID条目要删掉,让系统自动识别添加就可以了(UUID不可相同 ) ~ ~ ~ ~ ~ ~ :wq [root@localhost network-scripts]# service network restart //重新启动网络服务 Restarting network (via systemctl): [ 确定 ] [root@localhost network-scripts]# ifconfig //查看网卡信息 ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.100.10 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::a85a:c203:e2e:3f3c prefixlen 64 scopeid 0x20<link> ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) RX packets 3705 bytes 788818 (770.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1978 bytes 243934 (238.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 //成功获取IP地址 inet 192.168.10.10 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::f6eb:23e3:3afb:fef4 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:5b:d3:aa txqueuelen 1000 (Ethernet) RX packets 248 bytes 33751 (32.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 280 bytes 49781 (48.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/11658.html