CentOS: Troubleshooting Network Connections

yum can not operate normally considered to be inertia needs to be replaced BaseURL, results later found to be wrong Gateway do not know when to be set, memo follows.

Phenomenon
performance in yum not operate normally, confirm the operation ping and found to be unable to resolve DNS

[root @ liumiaocn ~] # www.baidu.com the ping
^ C long waits ctrl + C to exit
[root @ liumiaocn ~] #

Confirm DNS settings
    [root @ liumiaocn ~] # CAT /etc/resolv.conf
    # Generated by NetworkManager
    nameserver 8.8.8.8
    nameserver 8.8.4.4
    [root @ liumiaocn ~] #

the DNS normal set, indicates that the problem is more basic, that should complete network is not properly set. Really can not ping 8.8.8.8

    [root@liumiaocn ~]# ping -w1 8.8.8.8
    PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.

    --- 8.8.8.8 ping statistics ---
    1 packets transmitted, 0 received, 100% packet loss, time 0ms

    [root@liumiaocn ~]#

 


Connection confirmation itself is no problem

    [root@liumiaocn ~]# ping -w1 192.168.32.123
    PING 192.168.32.123 (192.168.32.123) 56(84) bytes of data.
    64 bytes from 192.168.32.123: icmp_seq=1 ttl=64 time=0.023 ms
    64 bytes from 192.168.32.123: icmp_seq=2 ttl=64 time=0.059 ms

-    -- 192.168.32.123 ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 999ms
    rtt min/avg/max/mdev = 0.023/0.041/0.059/0.018 ms
    [root@liumiaocn ~]#

 


Gateway connection confirmation

    PING 192.168.32.2 (192.168.32.2) 56(84) bytes of data.
    64 bytes from 192.168.32.2: icmp_seq=1 ttl=128 time=0.334 ms

    --- 192.168.32.2 ping statistics ---
    1 packets transmitted, 1 received, 0% packet loss, time 0ms
    rtt min/avg/max/mdev = 0.334/0.334/0.334/0.000 ms
    [root@liumiaocn ~]#


    addr IP
IP addr confirm network conditions, the following status

    [root@liumiaocn ~]# ip addr
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
    valid_lft forever preferred_lft forever
    2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:9d:48:21 brd ff:ff:ff:ff:ff:ff
    inet 192.168.32.123/24 brd 192.168.32.255 scope global eno16777736
    valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe9d:4821/64 scope link
    valid_lft forever preferred_lft forever
    [root@liumiaocn ~]#

 


Setting confirmation
CentOS RHEL network settings and files are located in the / etc / sysconfig case / network-scripts, to confirm the current settings as follows:

    [root@liumiaocn ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno16777736
    TYPE="Ethernet"
    BOOTPROTO="none"
    DEFROUTE="yes"
    IPV4_FAILURE_FATAL="no"
    IPV6INIT="yes"
    IPV6_AUTOCONF="yes"
    IPV6_DEFROUTE="yes"
    IPV6_FAILURE_FATAL="no"
    NAME="eno16777736"
    UUID="56975740-33eb-4306-9ecf-f7d62745c3a0"
    DEVICE="eno16777736"
    ONBOOT="yes"
    IPADDR="192.168.32.123"
    PREFIX="24"
    GATEWAY="192.168.32.31"
    DNS1="8.8.8.8"
    DNS2="8.8.4.4"
    IPV6_PEERDNS="yes"
    IPV6_PEERROUTES="yes"
    IPV6_PRIVACY="no"
    [root@liumiaocn ~]#


GATEWAY immediately confirm the setting is incorrect

In a corresponding manner
as amended restart it

Correction

    [root@liumiaocn ~]# diff /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eno16777736.bak
    15c15
    < GATEWAY="192.168.32.2"
    ---
    > GATEWAY="192.168.32.31"
    [root@liumiaocn ~]#

ifdown

[root@liumiaocn ~]#
[root@liumiaocn ~]# ifdown eno16777736


ifup

If you are using a terminal ifdown to do so, after the execution This command will naturally turn off the current terminal, you can start using ifup can be directly connected in place 

 

 

 

The results confirmed

By re-connecting terminal, the confirmation result, the normal operation

 

PING www.a.shifen.com (14.215.177.37) 56(84) bytes of data.
64 bytes from 14.215.177.37: icmp_seq=1 ttl=128 time=164 ms

--- www.a.shifen.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 164.538/164.538/164.538/0.000 ms
[root@liumiaocn ~]#
[root@liumiaocn ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:9d:48:21 brd ff:ff:ff:ff:ff:ff
inet 192.168.32.123/24 brd 192.168.32.255 scope global eno16777736
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe9d:4821/64 scope link
valid_lft forever preferred_lft forever
[root@liumiaocn ~]#

to sum up

Super simple question, but it is the result of headache medicine foot. RCA tell us where the problem is, not necessarily require surgery or place, empiricism often wasted our precious time.



Original link: https: //blog.csdn.net/liumiaocn/article/details/60467892

Guess you like

Origin www.cnblogs.com/isme-zjh/p/11448132.html