centos7 ens33无ip地址查错

12 篇文章 0 订阅

1.网络不正常原因

修改网络配置后发现不能上网了,执行ifconfig看到ens33已经没有IP地址,如下

[sandwich@centos-elk ~]$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:fb:27:2d:97  txqueuelen 0  (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

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:3f:0c:ec  txqueuelen 1000  (Ethernet)
        RX packets 1  bytes 243 (243.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 60  bytes 10088 (9.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 64  bytes 5184 (5.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 64  bytes 5184 (5.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:d1:3a:4c  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

2.查看失败原因

[sandwich@centos-elk network-scripts]$ sudo ifup ens33
/etc/sysconfig/network-scripts/ifcfg-ens33: line 16: IPADDR-192.168.32.3: command not found
/etc/sysconfig/network-scripts/ifcfg-ens33: line 16: IPADDR-192.168.32.3: command not found
/etc/sysconfig/network-scripts/ifcfg-ens33: line 16: IPADDR-192.168.32.3: command not found
/etc/sysconfig/network-scripts/ifcfg-ens33: line 16: IPADDR-192.168.32.3: command not found
./ifcfg-ens33: line 16: IPADDR-192.168.32.3: command not found

原来是IPADDR地址配置的“=”写成“-”了
在这里插入图片描述

3.修改回来后重启网络

[sandwich@centos-elk network-scripts]$ service network restart
Restarting network (via systemctl):                        [  OK  ]

4.确认ip地址正常

在这里插入图片描述

[sandwich@centos-elk network-scripts]$ ping www.baidu.com
PING www.a.shifen.com (163.177.151.109) 56(84) bytes of data.
64 bytes from 163.177.151.109 (163.177.151.109): icmp_seq=1 ttl=128 time=7.88 ms
64 bytes from 163.177.151.109 (163.177.151.109): icmp_seq=2 ttl=128 time=7.61 ms
64 bytes from 163.177.151.109 (163.177.151.109): icmp_seq=4 ttl=128 time=6.48 ms
64 bytes from 163.177.151.109 (163.177.151.109): icmp_seq=5 ttl=128 time=7.05 ms
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT三明治

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值